Microsoft Small Basic

Program Listing: KDM274
'position of tank
xpos=100
ypos=400

'elevation angle. 0 means horizontal right 90 means vertical 180 means horizontal left
angle=55
'velocity (power of shot) useful values are about 300-1000
velocity=600

'gravity
gravity=8
' wind speed. positive means from left to rigth, negative - opposite way. useful values are usually -50 - 50
wind=20



xvel=velocity*Math.Cos(angle*Math.Pi/180)*0.1
yvel=velocity*Math.Sin(angle*Math.Pi/180)*0.1

GraphicsWindow.Show()
GraphicsWindow.Width=Desktop.Width*0.8
GraphicsWindow.Height=Desktop.Height*0.8
GraphicsWindow.Top=100
GraphicsWindow.Left=100
GraphicsWindow.PenColor=0

For i=1 To 200
oldy=ypos
oldx=xpos
yvel=yvel-gravity
xvel=xvel+wind*0.1
ypos=ypos-yvel 'Y axis is reversed in graphics window!
xpos=xpos+xvel
GraphicsWindow.DrawLine(oldx,oldy,xpos,ypos)

EndFor