28 lines
643 B
Plaintext
28 lines
643 B
Plaintext
clear screen
|
|
open window 400, 300
|
|
window origin "cc"
|
|
|
|
rodLen = 160
|
|
gravity = 2
|
|
damp = .989
|
|
TWO_PI = pi * 2
|
|
angle = 90 * 0.01745329251 // convert degree to radian
|
|
|
|
repeat
|
|
acceleration = -gravity / rodLen * sin(angle)
|
|
angle = angle + velocity : if angle > TWO_PI angle = 0
|
|
velocity = velocity + acceleration
|
|
velocity = velocity * damp
|
|
posX = sin(angle) * rodLen
|
|
posY = cos(angle) * rodLen - 70
|
|
clear window
|
|
text -50, -100, "Press 'q' to quit"
|
|
color 250, 0, 250
|
|
fill circle 0, -70, 4
|
|
line 0, -70, posX, posY
|
|
color 250, 100, 20
|
|
fill circle posX, posY, 10
|
|
until(lower$(inkey$(0.02)) = "q")
|
|
|
|
exit
|