individual enemies

For questions about using Classic.

Post » Sun Oct 18, 2009 10:00 pm

i have a HalfLife demake here were I wan't my AI's not all to do the same thing. I have an object that activates the enemy when you overlap it. (the yellow circle) But it activates both enemies. How do I stop this?

http://www.mediafire.com/download.php?t0gnloqlzkw
Ignore the first layout
B
7
S
2
G
3
Posts: 139
Reputation: 2,331

Post » Mon Oct 19, 2009 2:24 am

Hello?
B
7
S
2
G
3
Posts: 139
Reputation: 2,331

Post » Mon Oct 19, 2009 2:42 am

i sugest you make a for each object enemy on always loop and test if player coordinates are inside a certaing range.. if it is set enemy follow variable to one if not set zero ..

for the jump you can use a similar approach except maybe you'd want the enemy to jump only once..

i checked your cap and found a solution for it but it results in crash sometimes and the enemies glitch sometimes so i would do like i said above :mrgreen:
B
58
S
13
G
10
Posts: 632
Reputation: 12,515

Post » Mon Oct 19, 2009 3:11 am

You need to use containers.

I created a new sprite (sprite6) with the word DOG painted in it. Replaced the EnemyDogs with it. Left one Enemy dog by the side of the screen and deleted it on layout start.
Also added a sub-event to layout start: For each object sprite6 system create EnemyDog.

I put the EnemyDog in the same container as its LOS sprite, so each EnemyDog will have its own LOS sprite, which was the issue. They'll behave correctly with this, as containers will help Construct guess which dog and which LOS your script is talking about.

Keep in mind that there's a LOS behavior that would probably have saved you doing some of this.
[url:n0reub29]http://www.udec.cl/~jfuente_alba/PartialExistence.cap[/url:n0reub29]
Saved in Construct 995. Has exactly what I described before.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Tue Oct 20, 2009 4:45 am

Thank you so much! I also tried the LOS behavior but it didn't work :/ I dunno why. Still, thanks.
B
7
S
2
G
3
Posts: 139
Reputation: 2,331


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests