hi im trying to shoot bullets
for now i have a very simple yet functioning code
function CreateBullet(sx as float,sy as float,angle as float,player as integer)
inc CurrentBullet
Bullets[CurrentBullet].id = CreateSprite(0)
Bullets[CurrentBullet].player = player
Bullets[CurrentBullet].Sx = sx
Bullets[CurrentBullet].sy = sy
Bullets[CurrentBullet].ang = angle
Bullets[CurrentBullet].spd = 5.0
Bullets[CurrentBullet].dmg = 10
SetSpritesize(Bullets[CurrentBullet].id,2.5,2.5)
SetSpritePosition(Bullets[CurrentBullet].id,Bullets[CurrentBullet].sx,Bullets[CurrentBullet].sy)
SetSpriteAngle(Bullets[CurrentBullet].id,Bullets[CurrentBullet].ang)
endfunction
function UpdateBullets()
for i = 1 to CurrentBullet
if Bullets[i].id > 0
MoveSprite(Bullets[i].id,bullets[i].spd)
endif
next i
endfunction
move sprite function which i took from the forum
function moveSprite(spriteID, amount#)
rem get display data
dw# = getVirtualWidth()
dh# = getVirtualHeight()
aspect# = (dw# / dh#)
if aspect# = 1.0
aspect# = getDisplayAspect()
else
aspect# = 1.0
endif
a# = getSpriteAngle(spriteID)
x# = getSpriteXbyOffset(spriteID)
y# = getSpriteYbyOffset(spriteID)
setSpritePositionByOffset(spriteID,x#+cos(a#)*amount#,y#+sin(a#)*amount#*aspect#)
endfunction
so this works great but what if i want to add physics to a bullet?
how can i "Shoot" a bullet using physics ? can anyone help ?
thank you for your time, haliop.