Heres some code snippets from a simple game I made with a stationary 'ship' that fires bullets upwards from the bottom of the screen.
I'm sure you could modify it to fit your needs.
The rotation variable in this code:
Set the bullets starting x,y values here:
I'm sure you could modify it to fit your needs.
Type bullet Field image Field bulletx# Field bullety# Field xangle# Field yangle# End Type bulletimage = LoadImage("bullet.png") MidHandle bulletimage shoot = KeyDown(57) ;space If shoot And MilliSecs() > lastshot thisBullet.bullet = New bullet thisBullet\image = CopyImage(bulletimage) RotateImage thisBullet\image, rotation thisBullet\bulletx# = 400 thisBullet\bullety# = 550 thisBullet\xangle# = Sin(rotation) thisBullet\yangle# = -(Cos(rotation)) lastshot = MilliSecs() + 1000 EndIf ;bullet advance For thisBullet.bullet = Each bullet thisBullet\bulletx# = thisBullet\bulletx# + thisBullet\xangle# * 5 thisBullet\bullety# = thisBullet\bullety# + thisBullet\yangle# * 5 If thisBullet\bulletx# < -40 Or thisBullet\bulletx# > 840 Or thisBullet\bullety# < -40 FreeImage thisBullet\image Delete thisBullet EndIf Next ;draw bullets For thisBullet.bullet = Each bullet DrawImage thisBullet\image, thisBullet\bulletx#, thisBullet\bullety# If ImagesCollide(thisBullet\image, thisBullet\bulletx#, thisBullet\bullety#, 0, enemy, (enemyx-1)*40, (enemyy-1)*40, 0) KillEnemy(enemy) EndIf Next
The rotation variable in this code:
RotateImage thisBullet\image, rotationis equal to the 'ships' rotation.
Set the bullets starting x,y values here:
thisBullet\bulletx# = 400 thisBullet\bullety# = 550equal to the 'ships' location in your game.