Trouble with jumping AI...

For questions about using Classic.

Post » Thu Apr 07, 2011 1:24 am

I've searched around for awhile on several occasions and I couldn't find anything that really helped me out... So I have a question- how can I get my AI to work with more than 1 instance of an enemy object?

Heres the problem- I have a bird enemy that jumps towards the player when he's 100 pixels close. I have that working the way I want, but I can't have more than 1 doing it at the same time... If I don't use for each object, they both jump regardless of their position relative to the player character, but if I do, only 1 bird will jump at a time. Is there anyway I can get around this? Yes, I saw the tutorial on "For Each", but I've tried several ways of using that condition.

I've done it with a plain "For Each Object", one with "For Each Object Ordered" going my object.count, and I tried "For Each Object" with a condition that checks to see if the objects "active" private variable is equal to 1(1 = active were 0 = deactive). I'm kind of lost here...

Heres my cap:

http://dl.dropbox.com/u/20855857/BabyMa ... ouble..cap

Z-Jump
X- Shoot
*Bullet range depends on the stamina bar located beneath the health bar*

Also you can hit backspace for the current time according to your computer's clock... 8)
B
1
G
1
Posts: 7
Reputation: 439

Post » Thu Apr 07, 2011 2:18 am

Try using the 'Enemy' family, which you already have set for the bird enemy. I changed a few events to use the family instead of the individual object, and the second bird enemy you have started working accordingly.

Screenshot showing both birds jumping and the portion that I changed.

http://img638.imageshack.us/i/unledyw.png/
B
4
S
1
G
3
Posts: 10
Reputation: 1,159

Post » Fri Apr 08, 2011 1:11 am

Woah dude, thanks for the help! :D I would of never thought to use a family for the jumpin...

It's a step in the right direction, but the other bird still jumps regardless of being 100 pixels close to the player... I'm not sure whats up with it! Maybe I'm not looking close enough at your changes... It's kind of cute, but maybe for another enemy, like some twin frogs.

Thanks again for the help! Any ideas on how to fix this? In the mean time I'll keep fiddling with it...
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