How do I create semi-complex AI?

0 favourites
  • 11 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • I'm wanting a sprite to patrol certain parts of the game and run away when it spots the player, but not run to a specific destination. Any Ideas? Thanks in advance~

    I currently have the sprite on a timer, every random(1,3) seconds picking random(layout.height) & random(layout.width)

    When it spots the player, the speed amps up, but it doesn't make an effort to get out of danger of the player. Thats what I'm aiming for.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • People are going to ask for screenshots or a .capx or a better explanation. Is this a top-down game? Platformer? What kind of behavior does this Sprite have?

    Assuming it's a top-down game, you can add a Line-of-sight behavior to the Sprite, and when it has a line-of-sight to whatever target you want, have a set of events happen, such as running faster.

  • line of sight = set angle towards (player.x, player.Y) (toggle inverted) to make it work.

  • Its not a top down platformer, the player uses the 8 direction controls

  • line of sight = set angle towards (player.x, player.Y) (toggle inverted) to make it work.

    Now this would work, but it has obstacles to get around. And within 1-3 seconds, it would find a new path.

  • add a wait time to before it goes back to it's path finding or it will still keep running as long as in line of sight of player and always runs from the player.X, player.Y

  • add a wait time to before it goes back to it's path finding or it will still keep running as long as in line of sight of player and always runs from the player.X, player.Y

    The expression "set angle towards (player.x, player.Y) (toggle inverted)" Toggle inverted? It doesn't recognize it.

  • Try this set angle AISprite.Angle-Player.X&Player.Y

  • Thanks, I'll try it out

  • Could I suggest:

    enemy Is on-screen

    if player.x<self.x simulate 8-direction moving right

    else simulate 8-direction moving left

    if player.y>self.y simulate 8-direction moving up

    else simulate 8-direction moving down

  • Good, but the objects in the game would get in the way....

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