Jump to content


Photo

Enemy Movement


  • This topic is locked This topic is locked
3 replies to this topic

#1 Lilac

Lilac

    GMC Member

  • New Member
  • 19 posts
  • Version:GM:Studio

Posted 03 May 2013 - 12:13 AM

Hello so I'm creating a game with the battle system similar to the one below (player left, enemy right)

I'm just a little lost when it comes to coding the enemies movement. How do I make him move and attack depending on the space the player is on? For example, have him use a close range attack when the player is in the front row. Or just move to the same row as the player and attack that row. Thanks!

33eb6a31bfe92656e00ad5573c8bc6b8.png?v=2


  • 1

#2 jpaugh78

jpaugh78

    GMC Member

  • GMC Member
  • 1765 posts
  • Version:GM:Studio

Posted 03 May 2013 - 01:41 AM

One way to do it is to use a state machine for the enemy a.i.  The enemy will either be waiting, moving or attacking.   He would be in waiting mode to say block or waiting for the player to make his move.  Then he'd take note of the players position and if the player was close enough, go into attack mode.  If the player is too far away, then he'd go into the move state.

 

It's not terribly complicated, you just need a set of variables that keeps track of what mode the enemy is in and keeps track of where the player is and what the player is doing (most of this would probably be in the enemies step event).


  • 1

#3 Lilac

Lilac

    GMC Member

  • New Member
  • 19 posts
  • Version:GM:Studio

Posted 04 May 2013 - 01:20 AM

Are there state machines for GM Studio? The only one i could find was the Zero Engine which i don't believe is compatible. 


  • 0

#4 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 19900 posts
  • Version:GM:Studio

Posted 04 May 2013 - 06:08 AM

You HAVE a topic for this. http://gmc.yoyogames...howtopic=579573

 

Please do not post duplicate topics as that is against the rules, and unfair on the other users who are patiently waiting for help.


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users