Enemy bullets do not move when fired [RESOLVED]

For questions about using Classic.

Post » Tue Jan 29, 2013 10:52 pm

https://dl.dropbox.com/u/29072735/labgame.cap

controls -

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:


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"


This problem has been puzzling me for quite some time, and I would greatly appreciate any advice in the matter. EmperorIng3602013-01-30 00:01:51
B
19
S
3
G
2
Posts: 148
Reputation: 1,945

Post » Tue Jan 29, 2013 11:20 pm

Fixed:

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.

2nd
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.
Bartosh2013-01-29 23:32:58
B
6
S
2
G
5
Posts: 249
Reputation: 2,323

Post » Wed Jan 30, 2013 12:08 am

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:


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!EmperorIng3602013-01-30 00:10:36
B
19
S
3
G
2
Posts: 148
Reputation: 1,945


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests