Platformer Enemy Behaviour

Just started using Construct 2? Post your questions here

Post » Sat Mar 08, 2014 6:49 am

I just completed Ashley's beginner platformer tutorial and am trying to get my two enemies to behave independent of eachother but animations will get triggered simultaneously and if I kill one enemy the other will die too. I have been reading up on instance variables but have yet to find a solution. I don't have a coding background and the logic has me going in circles. Any help would be much appreciated.
B
3
Posts: 2
Reputation: 181

Post » Sat Mar 08, 2014 7:21 am

I kinds wish there were FAQ of how to ask help....

Firstly, it's nearly impossible to tell what's the problem on your code unless we can see it. So please, get (like) Dropbox account and upload the capx file there and post a link .... That way we can see the problem and explain the fix to you.
Need help? Upload .capx file with your question.
B
16
S
4
G
2
Posts: 233
Reputation: 2,560

Post » Sat Mar 08, 2014 8:05 am

No need of Dropbox.
The forum supports Attachments
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Sat Mar 08, 2014 8:17 am

Oh.. yes, you are right. Just need to use full editor instead of Quick Reply to see upload-button. That was something that was part of the new features of forum change.
Need help? Upload .capx file with your question.
B
16
S
4
G
2
Posts: 233
Reputation: 2,560

Post » Sat Mar 08, 2014 10:10 am

the reason this happens is that c2 considers your 2 "enemy's" instances as one.
many reasons for that.
one solution would be to add " for each" -it is under the system commands" this way c2 will react to "each" lol.
if you are using an invisible square sprite and on top of it your enemy's sprite then you must add both in a container.
this way c2 will treat each instance as separate.
if you could post a .capx i would be able to help you more specifically .
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

Post » Sat Mar 08, 2014 11:36 am

mustangflex use instance variables learn from this tutorial
https://www.scirra.com/tutorials/806/instance-variable
B
251
S
39
G
15
Posts: 1,964
Reputation: 40,721

Post » Sat Mar 08, 2014 6:21 pm

Or maybe you're using system events, such as "Compare two values" and those don't pick objects. If you compare the enemy variable directly, it should work
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Sat Mar 08, 2014 11:44 pm

Hey guys, thanks so much for the help. I was able to resolve the issue by giving each instance of my enemy and sprite a unique ID.
B
3
Posts: 2
Reputation: 181


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 4 guests