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

Input and print players name

J

julianb

Guest
Okay, so i'm still learning gml and I use DnD for most of my coding, and gml where it is needed.

I need some help finding out how to make my game start with asking the players to input their names:

"Please input player 1's name"
"Please input player 2's name"

Then as the game moves on I want it to pick a random name (player) when a new room is loaded, like:

room1 loads and the game randomly picks player 2 (let's call him Harry) and prints his name on screen, like this: It's "Harry"'s time to draw!

I really hope someone can help me with this. Thanks
 

Filkata

Member
In particular, you can use get_string() to input the names and choose() to pick from the names at random.
 
N

Neo

Guest
To draw text on screen use this code
Code:
/// Put this code in draw event
draw_text(x,y,"It's "+ string(text) + " time to draw!");
To get a string by typing it out use this code in Step Event
Code:
if(keyboard_check(vk_anykey) and string_length(text) < 20)
{
    text = string(keyboard_string);
}
if(keyboard_check_pressed(vk_backspace))
{
    text = string_delete(text,string_length(text),1);
    keyboard_string = "";
}
This link describes to process more detail https://www.reddit.com/r/gamemaker/comments/5h580r/player_name_input_help/
 
Top