Windows How To Make Player Wait His Turn?

yvodlyn

Member
Hello, does anyone know a simple way to allow the player to wait their turn? Let me explain.
There are two players, Player 1 and Player 2.
Each player has a maximum of 5 steps. After the 5 steps of a player falls to zero, he can not move. He leaves his turn to the other player. Would anyone have an idea of how I could do this system?


reflexion2.png
 
K

kevins_office

Guest
One idea...
Have a controller object that deals with (keyboard?) input and keeps track of who's turn it is.
After the controller object receives input for movement it tells the player object where / how to move instead of the player object listening for input and moving on its own.
Have a variable to keep track of which players turn it is, and how many moves they have made, after the counter > 5 moves then counter = 0 and its next players turn.
 
Hello, does anyone know a simple way to allow the player to wait their turn? Let me explain.
There are two players, Player 1 and Player 2.
Each player has a maximum of 5 steps. After the 5 steps of a player falls to zero, he can not move. He leaves his turn to the other player. Would anyone have an idea of how I could do this system?
I would love to help! Can I see the code that controls the steps?
 

Fabseven

Member
I think you should create an obj_system with management of your turn.
In the step event management of what is occuring in a given state, in draw gui what you want to show during a given state

Code:
create :

_state_start = 0
_state_begin = 100
_state_turn_begin = 200
_state_turn_begin_wait = 201
_state_turn_playing = 250
_state_turn_ending = 299

_state = _state_begin
player = noone

_wait_begin = room_speed * 10
_wait_turn_begin = room_speed * 3

step :

switch(_state)
{
    case _state_start : //init of alarm0 for rules display
                 alarm[0] = _wait_begin
                 _state = _state_begin
                 player = noone
                  break
     case _state_begin :
              if(alarm[0] <= 0)
              {
                  _state = _state_turn_begin
              }
              break
      case _state_turn_begin :
             switch(player)
             {
                       default:
                       case noone :
                                  player = 1;
                       break
                       case 1 :
                                  player = 2;
                       break
                       case 2 :
                                 player = 1;
             }
          
              _state = _state_turn_begin_wait
             alarm[0] = _wait_turn_begin
             break
           case _state_turn_begin_wait:
                if(alarm[0] <= 0)
                  {
                      _state = _state_turn_playing
                 }
             break

           case _state_turn_playing:
                  //player turn ?
                  //something as to make _state to something else to play and at the end to                  _state_turn_end (with a alarm[0] to some time to display something if you want)

                break

             .....
}

draw gui :

switch(_state)
{
         case _state_begin :
                //draw rules of the game
                draw_text(10,10,"Rules # blablabla")
                break
          case _state_turn_begin_wait :
               //draw witch player it's turn
               draw_text(10,10,"Player " + string(player) + " 's turn")
                break
}
alarm 0 : add a commentary or the alarm won't decrease
 
Last edited:
Top