Enemy bullets do not move when fired [RESOLVED]

This forum is currently in read-only mode.
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • 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:

    <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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)