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

My text isn't showing

S

SpaceKill

Guest
So I'm trying to do a game-over screen but my buttons aren't visible but they're working
Here's the code
Creation code:
menu_x = x;
menu_y = y;
button_h = 32;
button[0] = "Yes"
button[1] = "Do not"
buttons = array_length_1d(button);
menu_index = 0
last_selected = 0;
Step event:
menu_move = keyboard_check_pressed(vk_left) - keyboard_check_pressed(vk_right);

menu_index += menu_move;

if (menu_index < 0) menu_index = buttons - 1;
if (menu_index > buttons -1) menu_index = 0;
if (menu_index != last_selected) audio_play_sound(Menu_Scroll,1,false);
last_selected = menu_index;

Draw event:
var i = 0;
draw_set_font(GameOver)
draw_set_halign(fa_middle)
draw_set_color(c_white)

repeat(buttons) {
draw_set_color(c_white);
if (menu_index== i) draw_set_color (c_red);
draw_text (menu_x, menu_y + button_h * i, button);
i++;
}

Key press:
switch (menu_index) {
case 0:
room_goto(room3)
break;
case 1:
room_goto(room1)
break;
}
 
Last edited by a moderator:

Azenris

Member
should the line
Code:
draw_text (menu_x, menu_y + button_h * i, button);
not be accessing an array for the final parameter
Code:
button[0] = "Yes"
button[1] = "Do not"
eg.
Code:
draw_text (menu_x, menu_y + button_h * i, button[0]);
 
S

SpaceKill

Guest
should the line
Code:
draw_text (menu_x, menu_y + button_h * i, button);
not be accessing an array for the final parameter
Code:
button[0] = "Yes"
button[1] = "Do not"
eg.
Code:
draw_text (menu_x, menu_y + button_h * i, button[0]);
I changed the code and the same thing happens
Maybe my sistem isn't good at all?
Do you have a tutorial suggestion I could watch to make a gameover screen ?
 

TheouAegis

Member
should the line
Code:
draw_text (menu_x, menu_y + button_h * i, button);
not be accessing an array for the final parameter
Code:
button[0] = "Yes"
button[1] = "Do not"
eg.
Code:
draw_text (menu_x, menu_y + button_h * i, button[0]);
He did. His actual code is
Code:
draw_text (menu_x, menu_y + button_h * i, button[i]);
[ i ] is the italics BBCode.

When you say "buttons" do you mean just the text, or do you have button sprites which are supposed to be under the text as well?

Is the instance this code is in marked as visible?
 
S

SpaceKill

Guest
He did. His actual code is
Code:
draw_text (menu_x, menu_y + button_h * i, button[i]);
[ i ] is the italics BBCode.

When you say "buttons" do you mean just the text, or do you have button sprites which are supposed to be under the text as well?
It's just text
 
S

SpaceKill

Guest
Is the object marked visible?
Yes but I solved it anyway.
I just rewrote all the code and it seems to be working now lmao.
Thanks tho I really apreciated the help.
But there's another problem.
I get 2 Yes and 2 Do not buttons
How do I solve this ?
 
S

SpaceKill

Guest
Ok I solved that too but how do I make the text go from left to right instead of up and down ?
And how do I make a sprite appear when i have a button selected.
Like the heart in Undertale when you have a piece of dialogue or a choice selected
 

TheouAegis

Member
It's going up and down because you set them to

menu_x, menu_y + button_h * i

You'd need to make it menu_x+button_w*i, menu_y

If i undertsand the last part, you just place the icon at

menu_x+button_w*menu_index-16, menu_y

Replace the 16 with the width of your icon, roughly.
 
Top