Last active
July 11, 2016 09:01
-
-
Save horstjens/c2233a2f223ebb46a6a6 to your computer and use it in GitHub Desktop.
turtle cannonball
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import turtle as t | |
p1 = t.Turtle() | |
p1.left(70) | |
p1.speed=9 | |
p1.dx = math.cos(p1.heading()*math.pi/180)*p1.speed | |
p1.dy = math.sin(p1.heading()*math.pi/180)*p1.speed | |
for step in range(100): | |
x = p1.xcor() | |
y = p1.ycor() | |
p1.dy -= 0.1 | |
x += p1.dx | |
y += p1.dy | |
p1.goto(x,y) | |
t.exitonclick() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment