how do i record my movements and have this as a path for an AI to follow

0 favourites
  • 3 posts
From the Asset Store
468 Dwarf vocal sounds recorded with a professional voice actor
  • I don't know the best way to phrase my question. but i'm making a racing game and i want to record my movements so i can have an AI follow these as there movement? i was wondering if anyone would have an idea how to do this

  • Two ways: Record inputs and time, or record absolute position and time.

    Either way, storage would probably be done via an array. For example...

    Every x seconds, push sprite.x to array, set sprite.y to array at (0,1)

    Would populate an array with the sprite position x and y every x seconds. Then save the array, and have your ai move to each position in the array in sequence.

    Alternatively, you would save what the player was inputting at every time instead of the sprite's position

    Depending on your game and how it is set up, either of these approaches could be optimized for further detail.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Another simple method is to spawn invisible "waypoint" sprites on player position every 0.5 seconds or so. Then you can use MoveTo behavior for the follower to move along this path.

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