Jetpac laser problem

BlitzPlus Forums/BlitzPlus Beginners Area/Jetpac laser problem

Is it possible to retrieve temporary co-ordinates of a moving object & store (fix) them ? I am trying to do a version of Jetpac but cannot get to grips with the laser routine, if I fire a laser & then move the player the laser follows the player - Aaaggh!
Any help greatly appreciated!

Basically, you should store the Y coordinate of the new laser, then use that to update it, instead of using the players Y position, which obviously, you are.

Something like this may give you the general jist on how to go about it:-

Type laser
	Field laserX
	Field laserY 
End Type

Graphics 640,480,16,2

Global countLasers = 0

Repeat
Cls
mx = MouseX()
my = MouseY()

If MouseHit(1)
	CreateLaser(mx,my)
End If

UpdateLasers()

Text 0,0,"Lasers Amount:"+countLasers

Flip 
Until KeyDown(1)

Function CreateLaser(startX,startY)
	newLaser.laser = New laser
	newLaser\laserX = startX
	newLaser\laserY = startY
End Function

Function UpdateLasers()
	countLasers = 0
	For loopLasers.laser = Each laser
		Line 0,loopLasers\laserY,loopLasers\laserX,loopLasers\laserY
		loopLasers\laserX = loopLasers\laserX - 5
		If loopLasers\laserX =< 0
			Delete loopLasers
		Else
			countLasers = countLasers + 1
		End If
	Next 
End Function


Thanks for help Dabz