ive got a quite qierd problem on the game im working on. i have a ship running about a map which fires bullets each time you hit a button. the ship is pointing in a direction from 0 to 360 and uses trig functions to move the sprite approprietly.
when i fire a bullet it places a sprite at the players coordinates and moves it in the same direction using the same concept. when use print playerx and print bx[6] they will start off the same and prining their directions starts off the same.
unfortunatly, when they draw, the bullets always start of from the positions the ship is in when it starts the game and moves in a diagonal to top left or bottom right.
this makes no sense to me as the ship and the bullet have the same coordinates and so should start in the same place......
anyhow, heres the code if anyone can see whats wrong

procedure movebullet()
for n=5 to 49
if bulletexists[n]
bx[n]=bx[n] + bxvel[n]
by[n]=bx[n] + byvel[n]
sprite n,bx[n],by[n],001
end if
next
end proc

11-13-2003 12:42

Posted by:-wyvern

Location:Bedroom

Look in the directory section for my spacetest file. It has a firing routine and describes how to implement one.

Good luck.

11-13-2003 17:44

Posted by:madscientist

Location:n.ireland

humble apologies

having spent a week trying to fix this bug (and the last couple of hours searching through that example-which i might add is quite excellent, particularly the comments) i as usual found my own stupid mistake after posting the problem.

can anyone see my incompetence from the source?
try looking at the movebullet() procedure...
specificaly look at the line by[n]=bx[n] +byvel[n]
then notice the x....