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

GameMaker Display text?

R

Rhqusa

Guest
I have a new problem. The text for a certain variable won't show up on my screen. I have the text set to show up at my character sprite's origin, but it does not appear. The room background is blue by the way.

step event:
Code:
var hinput_ = keyboard_check(vk_right) - keyboard_check(vk_left);
var vinput_ = keyboard_check(vk_down) - keyboard_check(vk_up);
if hinput_ != 0 {
    hspeed_ += hinput_ * Accel_
    hspeed_ = clamp(hspeed_,-maxhspeed_,maxhspeed_)
} else {
    hspeed_ = lerp(hspeed_,0,.3)

}
if vinput_ != 0 {
    vspeed_ += vinput_ * Accel_
    vspeed_ = clamp(vspeed_,-maxvspeed_,maxvspeed_)
} else {
    vspeed_ = lerp(vspeed_,0,.3)

}
if keyboard_check(vk_space) {
    if supersecretvariable_!= 0 and othersecretvariable = 1{
        instance_create_depth(x_,y_,1,o_secretobject);
        alarm_set(0,5);
        reloaded = 0
        supersecretvariable_ -= 1;
    }   
}
draw_text_colour(512,608, "secret:" + string(supersecretvariable),c_black,c_black,c_black,c_black,1);
x_=x;
y_=y
x += hspeed_;
y += vspeed_;
create event:
Code:
/// @description Insert description here
keyboard_set_map(ord("W"),vk_up);
keyboard_set_map(ord("A"),vk_left);
keyboard_set_map(ord("S"),vk_down);
keyboard_set_map(ord("D"),vk_right);
hspeed_=0;
vspeed_=0;
maxhspeed_=7;
maxvspeed_=7;
Accel_=1;
x_=x;
y_=y
Velocity_=6;
supersecretvariable_ = 300;
othersecretvariable = 1;
alarm event (alarm 0):
Code:
/// @description Insert description here
// You can write your code in this editor
othersecretvariable = 1
 
First I'd change the draw_text to this if you want to draw at the players origin (assuming your player is called oPlayer):
draw_text_colour(oPlayer.x ,oPlayer.y, "secret:" + string(supersecretvariable),c_black,c_black,c_black,c_black,1);

And then move that line from step event to draw event right after
draw_self();
 
R

Rhqusa

Guest
First I'd change the draw_text to this if you want to draw at the players origin (assuming your player is called oPlayer):
draw_text_colour(oPlayer.x ,oPlayer.y, "secret:" + string(supersecretvariable),c_black,c_black,c_black,c_black,1);

And then move that line from step event to draw event right after
draw_self();
The problem is that I'm not using a draw event for my player, or at all. Is that code supposed to go in the draw event anyway?
 
Top