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

Legacy GM [Solved]Having a log in a text box...

I

InfantRegalia

Guest
Hey guys, this is driving me nuts.
I drew a box on the top of my screen. And I wanted it to be always filled with notes. Like when you're walking up to a chest it says: "It's a chest! Press O to open, press L to leave it alone!" or when you bump into a wall it says "BUMP!"

So I made a drag and drop collision event in my obj_player for obj_wall. There I put a code:
Code:
if place_meeting(obj_player.x+48,obj_player.y,obj_wall)
{
draw_text(20,20,"BUMPAROO!")
}
no text anywhere when i text it.

For the love of everything, guys, can you like... teach me how to do this? Drawing text should be the simplest thing on the planet, yet I can't do it! My game is supposed to have many dialogues and such when I'm done with the basic mechanics, but now I just feel like I'm mentally deficient :/
 

LunaticEdit

Member
Not sure if collision event is the right place to draw things. You may want to set/reset flags in those events, and do the draw_text in the draw event. Also, make sure you are setting your draw font and draw color before drawing the text.

on the draw event:
Code:
draw_set_font(fntCurlyJefferson);
draw_set_color(c_white);
if (funky_collision_flag) draw_text(0, 0, "Warm creamy baileys");
Start with that, then hide/show based on flags you set on the collide events

Alternatively, if you want to use place_meeting on each frame as it appears you do, move that logic to the draw event.
 
I

InfantRegalia

Guest
Not sure if collision event is the right place to draw things. You may want to set/reset flags in those events, and do the draw_text in the draw event. Also, make sure you are setting your draw font and draw color before drawing the text.

on the draw event:
Code:
draw_set_font(fntCurlyJefferson);
draw_set_color(c_white);
if (funky_collision_flag) draw_text(0, 0, "Warm creamy baileys");
Start with that, then hide/show based on flags you set on the collide events

Alternatively, if you want to use place_meeting on each frame as it appears you do, move that logic to the draw event.
Hey, Old Gregg! So there is no way to draw text outside of the draw event? By what's the point of the collision event then? :( I don't get the logic. I placed my BUMP! into a draw event like you said, but now the word BUMP stays on the screen even after you went on your way and stopped colliding with the wall :( Btw it's a slow turn based thing so any collision checker would do, i even replaced the place_meeting for place_free to save time
 

LunaticEdit

Member
The OnDraw event is called when your object is being drawn. make sure to call the event_inherited() as well at the top of the call. If you call draw text on a collision event, where do you expect it to draw it? If it drew on the screen, it'l just get over-drawn with something else later on possibly.

Can you please reply with your exact OnDraw logic for the wall now?
 
I

InfantRegalia

Guest
Hey! Sorry for the silence. I sort of fixed it myself using what I know. TBH things you spoke of like OnDraw and event_inherited() are not even known to me right now, since I'm too much of a noob. What I did was make a step event with

if !place_free(obj_player.x + 48, obj_player.y) && keyboard_check_released(ord('D'))
{
global.mess = "BUMP!"}
else


if !place_free(obj_player.x - 48, obj_player.y) && keyboard_check_released(ord('A'))
{
global.mess = "BUMP!"
}
else


if !place_free(obj_player.x, obj_player.y+48) && keyboard_check_released(ord('S'))
{
global.mess = "BUMP!"
}
else


if !place_free(obj_player.x, obj_player.y-48) && keyboard_check_released(ord('W'))
{
global.mess = "BUMP!"
}
else

global.mess = ""

Now it says BUMP! for a fraction of a second when you collide with the player. Not what I wanted but I can't do any better :/
 
Top