Issues with multiple instances of objects...

For questions about using Classic.

Post » Wed Apr 06, 2011 2:50 am

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!
B
1
G
1
Posts: 7
Reputation: 439

Post » Wed Apr 06, 2011 3:54 am

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"?
B
2
S
2
G
2
Posts: 158
Reputation: 1,366

Post » Wed Apr 06, 2011 4:09 am

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 :-/
B
1
G
1
Posts: 7
Reputation: 439

Post » Wed Apr 06, 2011 4:25 am

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
B
2
S
2
G
2
Posts: 158
Reputation: 1,366

Post » Wed Apr 06, 2011 4:55 am

Ah, there it goes. You're completely and totally awesome. :D Thanks so much!
B
1
G
1
Posts: 7
Reputation: 439


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests