ElCheTibo
Member
Hello everyone,
I'm making a game where you control a wizard who can either shoot something or heal himself.
I've made a sprite for the cursor. It contains 3 frames and the image_speed is already set to 0.
In the first frame, the sprite is white (neutral), in the second one it's red (attack) and in the last one it's green (heal).
What I'm trying to do is to change the sprite's frame based on whether the cursor is hovering the player or the ennemy.
I've putted the code in an object named oController, which is permananent and already placed on the room.
Here is the Create event of oController:
And here is the Step event:
The problem is: the cursor's sprite is being replaced (as expected) but the sprite keeps being seizure-worthy by displaying itself frame after frame at 60fps, and even if I move the move on the player or an ennemy, it changes nothing!
What am I doing wrong?
I'm making a game where you control a wizard who can either shoot something or heal himself.
I've made a sprite for the cursor. It contains 3 frames and the image_speed is already set to 0.
In the first frame, the sprite is white (neutral), in the second one it's red (attack) and in the last one it's green (heal).
What I'm trying to do is to change the sprite's frame based on whether the cursor is hovering the player or the ennemy.
I've putted the code in an object named oController, which is permananent and already placed on the room.
Here is the Create event of oController:
GML:
window_set_cursor(cr_none);
cursor_sprite = sCursor;
sCursor.image_speed = 0;
GML:
if (collision_point(mouse_x, mouse_y, oEnemyParent, true, false)) {
sCursor.image_index = 1;
}
else if (collision_point(mouse_x, mouse_y, oPlayer, true, false)) {
sCursor.image_index = 2;
}
else {
sCursor.image_index = 0;
}
What am I doing wrong?