B
BenSunhoof
Guest
Hey there. I have a piece of code that changes the cursor sprite to a custom one and makes it green whenever it hovers over something clickable:
However, as you can see, there's an obj_edge that works as bounds as to where the player can go, here's the piece of code in obj_player's Step Event that creates collision:
This is how it works: my player moves towards the position of obj_click that's created when LMB is pressed. Whenever you click outside the floor panels, the player moves there, but when they hit the bbox top of obj_edge (which is invisible and covers the entire floor), they stop and obj_click gets destroyed. But that's just for context of what obj_edge does.
Anyway, that's besides the point. My main issue is that I don't want the cursor sprite to change colour when it's over obj_edge. The code I wrote doesn't seem to work. Any suggestions please?
(Also, as I was taking a screenshot, I noticed that the cursor turns green whenever I click, my idea is that it also detects obj_click for one frame)
For the record, yes, I fully understand my design and code are incredibly flawed.
Code:
var inst;
inst = instance_position(mouse_x,mouse_y,all)
if inst != noone
cursor_sprite = spr_cursor_slct
else
cursor_sprite = spr_cursor;
if position_meeting(mouse_x,mouse_y,obj_edge)
cursor_sprite = spr_cursor;
Code:
//Simple collision with bg
if !position_meeting(x,y-1,obj_edge)
{
y += 3
instance_destroy(obj_click);
speed = 0;
}
Anyway, that's besides the point. My main issue is that I don't want the cursor sprite to change colour when it's over obj_edge. The code I wrote doesn't seem to work. Any suggestions please?
(Also, as I was taking a screenshot, I noticed that the cursor turns green whenever I click, my idea is that it also detects obj_click for one frame)
For the record, yes, I fully understand my design and code are incredibly flawed.
Last edited by a moderator: