x - jump
c - shoot (when gun obtained)
When you reach the "Pod", the robots are supposed to become "angry", firing after a set amount of time. The bullets are supposed to go to the left if the player is to the left, and right if the player is to the right.
However, when the pod is reached, sometimes this happens:
<img src="http://i417.photobucket.com/albums/pp257/Emperor_Phoenix/Construct%20Problems/problem.png" border="0" />
And sometimes, it works fine, and other times, the robots do not fire at all!
the events for this is defined in the event sheet "Robots"
<img src="http://i417.photobucket.com/albums/pp257/Emperor_Phoenix/Construct%20Problems/problem2-1.png" border="0" />
This problem has been puzzling me for quite some time, and I would greatly appreciate any advice in the matter.
well first off the firing event needs to go above the subtract from fire event. or changed to less than or equal.or change event 12 to random(4)+1
other wise you will get a random initial number of zero, witch will become -1, witch causes the robot not to shoot.
unless of course that's intentional. its your game, you do what you want.
there needs to be a for each robot condition in event 14.
whats happening is 2 or more robots are firing at the same time, but only one bullet that's created is getting its angle and speed changed.
Its always something to do with "for each" when it comes to problems with multiple instances of the same object.
Develop games in your browser. Powerful, performant & highly capable.
Ah, thank you!
I would not have guessed that random(4) would 'accidently' return a 0 and possibly muck things up - thanks for catching that.
Using the "For Each Robot" system command for the firing event, I was able to put together a working system:
<img src="http://i417.photobucket.com/albums/pp257/Emperor_Phoenix/Construct%20Problems/Problem_solved.png" border="0" />
EDIT: picture is slightly erroneous - I did put the firing event above the subtraction event, but pressed print-screen before... Either way, it still works!
I will keep the "For Each Object" pointer in mind for future reference.
Again, your help is greatly appreciated. Thanks!