Missles like in "Missle Command"

BlitzPlus Forums/BlitzPlus Programming/Missles like in "Missle Command"

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This should be close enough to get you started

Graphics 640,480

Type missile
	Field x,y
	Field startx,starty
	Field tx,ty
End Type

For i=0 To 5
	m.missile=New missile
	m\x=Rnd(GraphicsWidth())
	m\y=0
	m\tx=Rnd(GraphicsWidth())
	m\ty=GraphicsHeight()
	m\startx=m\x
	m\starty=m\y
Next

Function movemissiles()

	For m.missile=Each missile
		If m\x<m\tx m\x=m\x+1
		If m\x>m\tx m\x=m\x-1
		If m\y<m\ty m\y=m\y+1
		Color 255,255,255
		Line m\startx,m\starty,m\x,m\y
		Color 255,0,0
		Oval m\x-2,m\y-2,4,4
	Next

End Function

tim=CreateTimer(30)
SetBuffer(BackBuffer())

While Not KeyHit(1)

	WaitTimer(tim)
	Cls
	movemissiles()
	Flip

Wend
End


have fun.