Here's a quick example that shows you how to handle your problem. If you have any questions, ask away.
Graphics 800,600,32,2 SetBuffer BackBuffer() Const DIR_LEFT = 1 Const DIR_RIGHT = 2 Type Laser Field x,y,dir End Type Function CreateLaser.Laser(x,y,dir) laser.Laser=New Laser laser\x=x laser\y=y laser\dir=dir Return laser End Function Function UpdateLaser(l.Laser) Select l\dir Case DIR_LEFT ;Move the laser left l\x=l\x-3 Color 255,255,255 Line l\x,l\y,l\x-5,l\y ;If the laser goes too far left, get rid of it If l\x+10<0 Delete l EndIf Case DIR_RIGHT ;Move the laser right l\x=l\x+3 Color 255,255,255 Line l\x,l\y,l\x+5,l\y ;If the laser goes too far right, get rid of it If l\x>GraphicsWidth() Delete l EndIf End Select End Function Type Player Field x,y,dir End Type Function CreatePlayer.Player(x,y,dir) player.Player=New Player player\x=x player\y=y player\dir=dir Return player End Function Function UpdatePlayer(p.Player) ;Move the player if the left or right arrow is pressed If KeyDown(203) p\x=p\x-1 p\dir=DIR_LEFT ElseIf KeyDown(205) p\x=p\x+1 p\dir=DIR_RIGHT EndIf ;If the player hits the space bar, create a laser at a certain position based on the player's ;current direction. If KeyHit(57) Select p\dir Case DIR_LEFT CreateLaser(p\x-10,p\y+20,p\dir) Case DIR_RIGHT CreateLaser(p\x+30,p\y+20,p\dir) End Select EndIf ;Draw the player depending upon its direction Select p\dir Case DIR_LEFT Color 255,0,0 Rect p\x,p\y,20,60 Rect p\x-10,p\y+20,10,3 Case DIR_RIGHT Color 255,0,0 Rect p\x,p\y,20,60 Rect p\x+20,p\y+20,10,3 End Select End Function player.Player=CreatePlayer(495,540,DIR_LEFT) Repeat Cls() UpdatePlayer(player) ;Update all the lasers For l.Laser=Each Laser UpdateLaser l Next Flip() Until KeyDown(1)