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

How to make a message pop up when you click "z" near a specific object

R

RADRI

Guest
So I've started to make an indie-type sort of game and I'm running into some issues on programming.
Let's say there is a note on the desk, my goal is when the character is in the notes collision area and Z is pressed then a message pops up.
Right now I have the event under "collision" with the code being
if (keyboard_check(ord('z')));
{
show_message ("message")
}
And nothing is working with that. Is there any way to make this work?? I'm open to like any solution.
 

NeoShade

Member
Doesn't it need to be capital?

Code:
ord("Z")
Correct me if I'm wrong, but pretty sure ord is case sensitive.
 
P

p055ible

Guest
So I've started to make an indie-type sort of game and I'm running into some issues on programming.
Let's say there is a note on the desk, my goal is when the character is in the notes collision area and Z is pressed then a message pops up.
Right now I have the event under "collision" with the code being
if (keyboard_check(ord('z')));
{
show_message ("message")
}
And nothing is working with that. Is there any way to make this work?? I'm open to like any solution.
You need to put the code in Step Event and use either place_meeting or point_distance or distance_to_object to check if you are near enough to the note object. Then check pressing of the Z key and show your message.

Step Event
Code:
if place_meeting(x,y,objNote)
if keyboard_check(ord("Z"'))
show_message("Message");
 
Top