• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Local Multiplayer

Bulldrome

Member
Hello I'm currently working on a top down, spaceship arena game and have a few questions about getting local multiplayer working. I have a menu set up for selecting your ship and color as well as a stage select.
After player 1 has selected a ship, is there a way to return to the ship select/color select screen now for player 2 to pick a ship? I could create duplicate rooms for each player with the global variable being changed each room but that seems cumbersome and not too optimal.
 

Attachments

woods

Member
use code tags and copy your code in.. it makes it ALOT easier for people to help instead of screenshots..

in the menu to select your ships i would have player1 have control and select their options, when finished pass control to player2. when they are finished give control back to player1
when both players are satisfied with the layout, then hit the final ok button to goto game room.

what controls are your players using?
if its all on the keyboard something like P1 is wasd and P2 is arrowkeys.. a simple check if both ships are selected before allowing to goto the game room.
if its mouse and keyboard for P1 and controller for P2 / or controllers for both.. have P1 controller grab the mouse until they hit the ok button, and then disable P1 control and give it to P2. once both ships are selected, allow the goto next room to be clickable.
 

Bulldrome

Member
Ship Select Menu:
Code:
menu_x += (menu_x_target - menu_x) / menu_speed;


//Keyboard Controls
if (menu_control)
 {
  if(keyboard_check_pressed(vk_up))
  {
    menu_cursor ++;
    if (menu_cursor >= menu_items) menu_cursor = 0;
    audio_play_sound(snd_MenuPip, 10, false);
  }
 }
 
 if (menu_control)
 {
  if(keyboard_check_pressed(vk_down))
  {
    menu_cursor --;
    if (menu_cursor < 0) menu_cursor = menu_items - 1;
    audio_play_sound(snd_MenuPip, 10, false);
  }
  
  //Menu press
  if (keyboard_check_pressed(vk_space))
  {
    menu_x_target = gui_width + 200;
    menu_committed = menu_cursor;
    menu_control = false;
    audio_play_sound(snd_MenuSelect, 10, false);
  }
 }
 

 //SWORD
 {
     switch (menu_committed)
 {
case 4: 
    {
       {
    switch (room)
          {
     case roomShipSelect:
     
     room_goto(roomShipColorSword);
     break 
          }
       }
    }
 }
}
 
 //BLAST
 {
     switch (menu_committed)
 {
case 3: 
    {
       {
    switch (room)
          {
     case roomShipSelect:
     
     room_goto(roomShipColorBlast); 
     break 
          }
       }
    }
 }
}
 
 //SNIPE
 {
     switch (menu_committed)
 {
case 2: 
    {
       {
    switch (room)
          {
     case roomShipSelect:
     
     room_goto(roomShipColorSnipe);
     break 
          }
       }
    }
 }
}
 
 //GHOST
{
     switch (menu_committed)
 {
case 1: 
    {
       {
    switch (room)
          {
     case roomShipSelect:
     
     room_goto(roomShipColorGhost);
     break 
          }
       }
    }
 }
}

//BACK
{
 {
    switch (menu_committed)
    {
case 0: 
{
    {
    switch (room)    
    {
      case roomShipSelect:
     room_goto(roomMenu);
       break //End
      }
    }
  }
 }
}
}
[/CODE

This menu takes you to the color select screen, when you pick a color, the global variable for the player is set to a specific number. That number is used to determine what ship to spawn in after a level is selected

Color Select Menu:
[CODE]
menu_x += (menu_x_target - menu_x) / menu_speed;


//Keyboard Controls
if (menu_control)
 {
  if(keyboard_check_pressed(vk_up))
  {
    menu_cursor ++;
    if (menu_cursor >= menu_items) menu_cursor = 0;
    audio_play_sound(snd_MenuPip, 10, false);
  }
 }
 
 if (menu_control)
 {
  if(keyboard_check_pressed(vk_down))
  {
    menu_cursor --;
    if (menu_cursor < 0) menu_cursor = menu_items - 1;
    audio_play_sound(snd_MenuPip, 10, false);
  }
  
  //Menu press
  if (keyboard_check_pressed(vk_space))
  {
    menu_x_target = gui_width + 200;
    menu_committed = menu_cursor;
    menu_control = false;
    audio_play_sound(snd_MenuSelect, 10, false);
  }
 }
 

//THUNDER
 {
     switch (menu_committed)
 {
case 4: 
    {
       {
    switch (room)
          {
     case roomShipColorSword:
    
     global.p1ship = 11;
     
     room_goto(roomStageSelect);
     break 
          }
       }
    }
 }
}
 
 //BLAZE
 {
     switch (menu_committed)
 {
case 3: 
    {
       {
    switch (room)
          {
     case roomShipColorSword:
     
     global.p1ship = 12;
     
     room_goto(roomStageSelect); 
     break 
          }
       }
    }
 }
}
 
 //AZURE
 {
     switch (menu_committed)
 {
case 2: 
    {
       {
    switch (room)
          {
     case roomShipColorSword:
     
      global.p1ship = 13;
     
     room_goto(roomStageSelect);
     break 
          }
       }
    }
 }
}
 
 //MYTHRIL
{
     switch (menu_committed)
 {
case 1: 
    {
       {
    switch (room)
          {
     case roomShipColorSword:
     
      global.p1ship = 14;
     
     room_goto(roomStageSelect);
     break 
          }
       }
    }
 }
}

//BACK
{
 {
    switch (menu_committed)
    {
case 0: 
{
    {
    switch (room)    
    {
      case roomShipColorSword:
     room_goto(roomShipSelect);
       break //End
      }
    }
  }
 }
}
}
[/CODE
 
Top