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

I need help with my idea, please!

P

Phemus

Guest
I got an idea but I can't make it so I hope you can :]
I want to make when you press enter a box will ask you to your name and when you type, your name will appear on your player and move with your player. Help please :/
 
N

Nexusrex

Guest
Well, i'd recommend that you check the manual and tutorials. I will give you some hints:
1- Make a textbox (You can use the keyboard_string functions, i guess..Or search on google)
2- Make a variable that changes when you enter the name
3- Use draw event to draw the text on the top of the character (example: draw_text)
 
P

Phemus

Guest
Well, i'd recommend that you check the manual and tutorials. I will give you some hints:
1- Make a textbox (You can use the keyboard_string functions, i guess..Or search on google)
2- Make a variable that changes when you enter the name
3- Use draw event to draw the text on the top of the character (example: draw_text)
I'm new to this I'll be really happy if you explain to me what should I do.
 
R

Rusty

Guest
You need to use "draw_text(x,y,keyboard_string);". This will draw the string that is typed in by the keyboard. Use it alongside "draw_rectangle" to create a textbox, put the keyboard_string into a variable when the player uses enter to close the textbox and then draw that variable "player_name" at obj_player.x,obj_player.y-16 and it will float around above the player's head.
 

Yal

šŸ§ *penguin noises*
GMC Elder
You might want to check out the show_message family, in particular get_string() that does exactly what you want for #1. They're only intended for debug stuff, but that doesn't stop them from actually working for simple 'first game' games.

Also, do some tutorials. Your wording in the first post suggest you know what a variable is but not how to actually use them.
 

ZeDuval

Member
In the Create_Event of your obj_player:
Code:
name = get_string("Enter a name:","placeholder_name");
In the Draw_Event of your obj_player:
Code:
draw_set_color(c_black);
draw_set_halign(fa_center);
draw_text(x,y-32,name);
See if that works for a start. Click with the middle mouse button on any function like get_string to open the documentation. Do this with every function you encounter, learn about the function arguments, return value etc. In the bottom-right corner of the documentation you'll always find the next interesting thing to read about. See it as an adventure, combine this with google, where you'll most often are lead to the documentation or forum threads when typing in something like "gamemaker display name above character" and in no time you'll know all the basics.
 
Last edited:
P

Phemus

Guest
In the Create_Event of your obj_player:
Code:
name = get_string("Enter a name:","placeholder_name");
In the Draw_Event of your obj_player:
Code:
draw_set_color(c_black);
draw_set_halign(fa_center);
draw_text(x,y-32,name);
See if that works for a start. Click with the middle mouse button on any function like get_string to open the documentation. Do this with every function you encounter, learn about the function arguments, return value etc. In the bottom-right corner of the documentation you'll always find the next interesting thing to read about. See it as an adventure, combine this with google, where you'll most often are lead to the documentation or forum
threads when typing in something like "gamemaker display name above character" and in no time you'll know all the basics.
Player became text when I enter name :/
 
Top