Issues with multiple instances of objects...

This forum is currently in read-only mode.
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • Hi All,

    In my most recent game, I'm starting to use containers for more than one object for the first time. As such, I'm having some issues with getting them to behave correctly.

    I've got an angle checker for angle between enemies and the player character. Depending on the angle, the enemy will move in a specified location. The reason I'm doing this instead of just having the enemies track the player directly and move at whichever angle is most direct, is because I want to make them move as if they are on a track, IE, just at right angles. This method works brilliantly for one instance, but whenever I instantiate more enemies, they SOMETIMES don't move at all, for seemingly no reason.

    Also, I have a private variable for health, and it isn't acting as it should. Instead of each enemy having 2 health, the enemies collectively have 2 health. I may be doing something glaringly wrong, but I can't see what the issue is if I am <_>

    To summarize, my issues are:

    Oddly behaving enemies when there is more than one instance of them.

    Oddly behaving health variable.

    Cap file: http://files.me.com/steven.foskett/scml4y

    Thanks!

  • As regards HP variables issue: it's because of Delay object, using its event or action will break selected objects list.

    But you can make delay between animations with 'on animation finished' event (first uncheck "loop" in ''hurt animation properties and adjust animation speed)

    Also, do you know you can change sprite's angle without rotating? Just set No Rotation in obj' properties

    Also, why do you use angle expression instead "set angle towards object"?

  • I didn't know that you could change the sprite's angle without rotating, since I can do that, my method seems quite pointless, and a bit wordy in terms of lines of statements. Your solution for the angle/movement fixed the issues I was having with that. Many thanks.

    However, even though i removed the 'delay' object, and set it up the way you suggested, the health still seems to be linked :-/

  • Here's exemple

    http://dl.dropbox.com/u/24325446/ann.cap

    I changed only 'ireStatus==false' case

    Btw you don't need deleting Delay object, just don't use it with picking

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah, there it goes. You're completely and totally awesome. Thanks so much!

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