39 lines
683 B
Python
39 lines
683 B
Python
# Lançamento oblíquo com a biblioteca turtle de Python
|
|
import turtle
|
|
|
|
LARG = 800
|
|
ALT = 600
|
|
MEIA_LARG = LARG//2
|
|
MEIA_ALT = ALT//2
|
|
|
|
v0x = 10 # pixels/passo
|
|
v0y = 40 # pixels/passo
|
|
|
|
def sx(tempo: float) -> float:
|
|
return -MEIA_LARG + v0x*tempo
|
|
# fim-def
|
|
|
|
def sy(pos_x: float) -> float:
|
|
return -(3/800)*(pos_x**2)+300
|
|
# fim-def
|
|
|
|
def main():
|
|
turtle.setup(LARG, ALT)
|
|
turtle.shape('turtle')
|
|
turtle.color('blue', 'red')
|
|
turtle.up()
|
|
turtle.goto(-MEIA_LARG, -MEIA_ALT)
|
|
turtle.down()
|
|
|
|
for t in range(81):
|
|
x = sx(t)
|
|
y = sy(x)
|
|
turtle.goto(x, y)
|
|
# fim-for
|
|
|
|
turtle.done()
|
|
# fim-def
|
|
|
|
if __name__ == '__main__':
|
|
main()
|
|
# fim-if |