noobie question
BlitzPlus Forums/BlitzPlus Programming/noobie question
| ||
whats wrong with this?? Function pinguibullet() hits = 30 diry = 5 dirx = 5 For pbs.pb = Each pb while hits > 0 pbs\x = player\x pbs\y = player\y pbs\x = pbs\x + dirx pbs\y = pbs\y + diry DrawImage (pbimage, player\x,player\y) If ImagesCollide(pbimage,pbs\x,pbs\y,0,ship\image,ship\x,ship\y,0) PlaySound jaja hits = hits - 30 Delete pbs EndIf If pbs\y > ImageHeight Or pbs\y < 0 diry = -diry EndIf If pbs\x > ImageWidth Or pbs\x < 0 dirx = -dirx EndIf hits = hits - 1 wend Next End Function I want it to be able to shoot many bullets, but I cant!! everything else in my code is right , this is inside the main loop. |
| ||
eh, OMG! It's very hard to tell exactly what your trying to do here, This is going to sound harsh, but I think you need to start this one over and plan out exactly what you need it to do. Here are some of the problems for you to look at... I don't see why you need that "while hits>0" loop, it has little purpose, except it loops 30 times if no collision was detected. dirx = -dirx this is the same as writing dirx = 0 - dirx ; (results as -5)and when you call it again it will result as 5 again, is this what you intended? pbs\x = player\x pbs\y = player\y pbs\x = pbs\x + dirx pbs\y = pbs\y + diryis the same as writing pbs\x = player\x + dirx pbs\y = player\y + diry Practice make perfect :) |