How do I make a turn based game system?

Not favoritedFavorited Favorited 0 favourites
  • 5 posts
From the Asset Store
HTML5 Game Bundle (7 Games) – Created with Construct 3
  • Sorry for posting again but I asked this a while back but never really got any feedback.

    I am stuck on how to make a turn based game. Seams simple right?

    Basics are player can move tile to tile but the enemies/NPCs get a move for each tile the player moves.

    Player choses to move 5 tiles. Everything else moves 5 tiles correspondently. Tit for tat I guess you would say.

    When combat starts it limits movement to one tile so the player takes a turn and the enemies or NPCs get one move.

    When combat ends you can move multi tile but all the NPCs do as well.

    Examples would be: Crown Trick, Stone Shard ect...

    Seems so simple! But I need some help. Keep barking up the wrong tree.

    Thanks

    Tagged:

  • You need to use variables.

    Turn, it can have a value of 0 or 1 (0 = player, 1 = CPU or the other way around, whatever you prefer).

    Moves. Store how many moved the player has made.

    Once the player move change the Turn variable from 0 to 1, so the enemy can do their move. You will also have other events that are connected and maybe groups to enable/disable.

    When it's time for the enemies to move, just limit their movement to the variable "Moves". Each time the player moves in his turn by one tile, you increase the variable by 1.

    When the enemy's turn ends, you change again the "Turn" variable and set the variable "Moves" to 0.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I tried counting the moves and moving the NPC that number but that didn't have the desired effect.

    I wanted the Player and the NPC need to sync. Move for move. I kind of got it working in the attached CAP3 but it fails on longer moves. 1-1 works fine ¯\_(ツ)_/¯

    1drv.ms/u/c/69e7b1f136a84038/ERNliSxpU6pAjCzf0u_BVW8BL8uJ9Qu52kMsXzGWx6KHTA

  • Hi. Doesn´t work with more than 1 tile because you are using the NPC position as a reference and that is different every time the player collision with the MOVEMENT sprite. In this example I'm storing the initial position in a variable, the moves in another variable and using both to calculate how much the NPC should move.

    And then resetting when the NPC stops, including the turn so the NPC can move again.

    Take a look at it, probably not exactly what you need but It might give you some ideas. Cheers.

    drive.google.com/file/d/1PhrLk4M9-KqwvIWTHYFbWwwW86oNS46g/view

  • Slaps Forehead. Jeez. Thanks!

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