this is above all the if key
now i see the black square on startup, but then it disappears and only the original character sqaure is left showing
i also removed the delays from the ifs so there is only 1 single delay in the whole loop
bc123
Posted: Sun Jan 22, 2012 12:51 am Post subject: RE:Running something in backround?
ahh, good news, ive got the delays working fine, missle is fine, collison is find to my liking at the moment, now i need to figure how how to move left and right while in air, any ideas?
Alex C.
Posted: Sun Jan 22, 2012 1:13 am Post subject: RE:Running something in backround?
multiple if statements one after the other (no elsifs...)
bc123
Posted: Sun Jan 22, 2012 1:27 am Post subject: RE:Running something in backround?
hmm, actually, i changed my mind and im now working on shooting, now my idea is correct, but im having trouble writing it in turing
PSEUDO : press space, shoot from character coordinates, if the bullet hits missle, missle resets to original coords.
Now, i know my problem, and still unsure how to fix it.
Problem: Everything moves in increments of 10, if im 15 pixels away from missle and i shoot, ill be adding on odd numbers, not being able to colide with the missle.
Is there a way to code if bullet is withing the range of the missle then reset?
bc123
Posted: Sun Jan 22, 2012 1:45 am Post subject: RE:Running something in backround?
also, i quickly tried the right and left movement with some ifs, and it works fine, now im stuggling with this shooter thing
Alex C.
Posted: Sun Jan 22, 2012 11:00 am Post subject: RE:Running something in backround?
lower the increments and delays, that will speed up your program as well as make the collision more detectable
Sponsor Sponsor
mirhagk
Posted: Sun Jan 22, 2012 6:33 pm Post subject: RE:Running something in backround?
Or better yet just use Math.Distance to calculate how far the bullet is from the missile and if it's within 5, then count it as a hit.
Or if you want to be really accurate you can use linear collision detection (think of the lines as the paths the bullet/missile went since the last frame) It will be 100% accurate (even if your game goes a lot slower) but it might be difficult to do.