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

Help with a script that is not working

C

Casityny

Guest
image_speed = 0;
if (position_meeting(obj_cursor.x, obj_cursor.y self))
{
image_index = 1;
}
else
{
image_index = 0;
}
Is this code accurate? I'm coding a game and can't seem to make this script work...
 

Gamebot

Member
Not quite sure what your trying to do/accomplish.

1. My guess is your trying to change the image_index with the mouse over it? Use:
position_meeting(mouse_x, mouse_y, self) in that objects step event.

2. If your trying to draw a cursor for text it needs to be in the draw event.

3. If this is an actual script for an object that is checking for object cursor you will still need to call this script in the step event of the object that is supposed to be running it. Then again you could just put it in the step event to see if it works...

Otherwise a better explanation and/or code would help.
 
if (position_meeting(obj_cursor.x, obj_cursor.y self))
Look at this line very carefully and you will see an error (hint: you are missing a comma right before self). To be honest, the IDE should be throwing this as an error anyway but as you have not provided any more information than "I can't seem to make this script work", we are having to guess at what your actual problem is.
 
Top