Jump to content

Turn based system game logic


Recommended Posts

I am trying to create a bare-bones rpg battle system, I am trying to figure out a way to manage the turn system for each unit. I want it so that if the current turn of a unit, it will remain in that state until a target is selected and a button is pressed essentially. I thought about only rendering the buttons on screen when it is the players turn but i come up to the issue of how to detemrine whose turn it is and how to change that as needed.


I thought about using an array of booleans to determine the current unit to do its action or maybe an int whose number correspond to different units but i am having some issues visualizing it in my mind. Could I get some advice or material to read on this matter to help clear this up?


Thanks in advance.


Link to comment
Share on other sites

I usually find numbers useful for this kind of stuff. Like if a player clicks a button and a turn is taken then change from number 1 to number 2. So if number 2 is active then remove buttons and make the player wait. Afer the player has waited the turn the enemy takes the next turn and resets the number to 1 and the buttons etc are now available and ready to use again. This is how I approach this kind of stuff but there are other ways.

Link to comment
Share on other sites

thanks for the quick response guys, i got it implemented using a number like you guys said and reset to 0 to start a new turn so to speak. Ran into a different issue now, I want the user to select their target and i am trying to get the Phaser.sprite on click event to work but i am having some issues. Here is the code:

var e = this.G.add.sprite(200, 200, enemies[i].Sprite);                e.inputEnabled = true;                e.input.events.OnInputDown.add(this.StartAttack, this);         

the last line, events is not recognized as a property of sprite.input. I am not sure if this is an error in the typescript definitions or an issue with phaser itself as i dont see events in the docs for the Sprite class.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...