• 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!

4p mode help

M

Marxsoul333Gaming

Guest
In my fan game of Bomberman, I have a 4 player mode. What I am asking is can someone tell me how to make it so that when there is one player left, the game will continue to the next room. Also if it is not too much trouble, please tell me how to do a victory screen with results.
 

TheouAegis

Member
the first part is easy enough. in the end step event of a controller object check the number of player instances in the room. If it is 1, then the last player alive wins and then you go to the Next Room.
 

matharoo

manualman
GameMaker Dev.
please tell me how to do a victory screen with results
You'll have to draw the scores using draw_text().
You can either draw it in your current room when the game is over, or pass the variables to a persistent object than then carries them over to the next room where the scores are shown.
Here's an example of how you can draw the scores when the game is over:
Code:
if (game_is_over){
    draw_sprite(spr_victorypanel, 0, 30, 40);
    draw_text(40, 50, "Player 1: " + string(score1));
    draw_text(40, 80, "Player 2: " + string(score2));
    draw_text(40, 110, "Player 3: " + string(score3));
    draw_text(40, 140, "Player 4: " string(score4));
}
Or if you store your 4 player scores in an array...
Code:
if (game_is_over){
    draw_sprite(spr_victorypanel, 0, 30, 40);
    for(var i=0; i<array_length_1d(scores); i++){
        draw_text(30, 40 + (i*30), "Player " + string(i+1) + ": " + string(scores[i]));
    }
}
 
M

Marxsoul333Gaming

Guest
the first part is easy enough. in the end step event of a controller object check the number of player instances in the room. If it is 1, then the last player alive wins and then you go to the Next Room.
But each player is a different object. How would I check to see how many player objects there were?
 
L

Lysho

Guest
Or in a control object, define players = 4, and then each time a player dies, set that object's players -= 1; something like this:

obj_control's create event

Code:
players = 4;
any given player object's destroy event:

Code:
obj_control.players -= 1;
obj_controls end step event

Code:
if players = 1 then{
//game over stuff like going to the next room, show score, what have you
}
However, If you want to account for a different number of players depending on the game mode that was chosen (ie 2 player, 3 player, etc.), just make the button itself perform an action like this:

Mouse Pressed Event for obj_fourplayers

Code:
global.players = 4;
Mouse Pressed event for obj_threeplayers

Code:
global.players = 3;
And so on, and in the obj_control's create event, instead of setting players = 4, just do:

Code:
players = global.players;
 
Top