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

GML Visual Room Specific Events

TsukaYuriko

☄️
Forum Staff
Moderator
What is your problem or question?

In case, you can't draw outside of Draw events. (Technically, you can, but it won't be visible.)
 

SuchGamer

Member
What is your problem or question?

In case, you can't draw outside of Draw events. (Technically, you can, but it won't be visible.)
Well my question is I want the player if he collects lets a say a star object on a certain room. I want a text to show up and say "This is a star." I have an updated code here that will make more sense but It still wont work. This is on a draw event on a empty object i added into the instance.
 

Attachments

TsukaYuriko

☄️
Forum Staff
Moderator
You're checking for collisions with instances of oStar.

You then check if that instance of oStar is equal to oPlayer.


That makes no sense at all.


If you're trying to check for collisions with the player, do that rather than checking for collisions with stars.
If you want to check whether a collision occurred, check if the instance ID returned by the collision function is not noone.
 

TailBit

Member
the easiest way is to create a text object that only draws text and dissapears after a while, by setting an alarm in its create event and have the alarm destroy itself, give it a text variable in the create event with a string that it draws in its draw event

and when you pick up the star then you just create a instance of the text object and set its text to "This is a Star"
 

SuchGamer

Member
the easiest way is to create a text object that only draws text and dissapears after a while, by setting an alarm in its create event and have the alarm destroy itself, give it a text variable in the create event with a string that it draws in its draw event

and when you pick up the star then you just create a instance of the text object and set its text to "This is a Star"
I dont think the draw text feature will work if its not on a draw event.
 

TsukaYuriko

☄️
Forum Staff
Moderator
var inst;
inst = instance_position(x, y, oPlayer);

if(room == rm_levelT)
{
if(inst != noone){
draw_text_ext(x+10,y,"This is a star", 10, 32);
}
}
Which event is this code in? Still User 0? If so, where are you calling this event from?

You may also want to sprinkle some show_debug_messages into your code to see which parts of the code actually run, or inspect your code using the debugger to see what is happening line by line. Check whether the code you're calling is returning the results you expect (e.g. is a collision even detected?).
 

SuchGamer

Member
Which event is this code in? Still User 0? If so, where are you calling this event from?

You may also want to sprinkle some show_debug_messages into your code to see which parts of the code actually run, or inspect your code using the debugger to see what is happening line by line. Check whether the code you're calling is returning the results you expect (e.g. is a collision even detected?).
No this is on a draw event. Since i guess thats where the draw fucntions actually work?
 
Top