Trying to create smart AI for platformer game

This forum is currently in read-only mode.
From the Asset Store
10 Retro songs ideal for platformers or farming games
  • I've done a smart form of AI for a game, but I'm having a problem getting multiple enemies to work properly. One enemy alone works fine, but I want separate enemies to each chase the player if they can see him. Can anyone help me get an enemy to attack when there's more than one on the layout?

    I'd like for an enemy to see the player and attack without making all of them attack. If it's possible with the way I set it up, could someone tell me how?

    http://www.mediafire.com/?ibqwh9djubwjbg3

    Note: This is called a tutorial because I planned to make a tutorial with this until I discovered this bug. If someone can help me fix this, I'll finish the tutorial and release it as soon as I can, unless there's already something like this that I missed in a search.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Doing it with the "Group Enable" method doesn't pick, and is buggy. Generally, stay away from disabling and enabling groups in events, it's buggy. I just put all your existing events under the LOS condition, and it works fine.

    http://dl.dropbox.com/u/1378330/AI%20Tu ... 20EDIT.cap

  • I didn't know that. Coming from MMF2, so I'm used to using groups for a lot of things. I forgot you could add events under other events like that in Construct. The chasing is a little odd since they stop chasing at random times, like if you run through them, but I guess that's something in my events.

    Thanks for your help. If you could hint me as to what's causing the random stopping, that would be great. I'm hoping to make it simple for everyone to follow, but I don't know how reasonable that is.

  • The LOS object doesn't like it when you collide. You can probably fake it pretty darn well. Just make a PV for the enemies, and always set it to the distance between the main character and it. When the value drops below a certain limit (i.e. the character gets close), enable the chase behaviour. This is faster than LOS, but doesn't deal with enemies not being able to see through solids.

    If you want to keep the LOS, you could implement both systems. Make the LOS enable the chase behaviour, but also make it so when the player is very close, the behaviour is also on. This should solve the stopping when your are overlapping the enemy.

  • Oddly enough, it fixed itself once I changed the sprites. I'm assuming it had something to do with hot spots or something. I'll look at it later and find out for sure.

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