Hi, new user here looking for a little explanation on the topic command. Ive basically made my own buttons and want them to be clickable. This works, but Im having problems with the numbers on the imagerectcollide command.. also not sure what I should use in the image reference, since im using the standard mouse pointer, not a cursor image.
Suppose I had a button image drawn here like this...
DrawImage mybutton,20,447 ;Image dminension is 34x24
And I want to test the collision with a plain mouse pointer (with no image) what would I write after the Imagerectcollide command to get the exact detection? Im having real problems here because every time I try this, my detection area seems too big and not referenced from the correct place, I got it to work by trial and error, but its not pixel perfect..
I thought it should be this for the above DRAW line...
mx = mouseX()
my = mouseY()
If ImageRectCollide(WHAT TO PUT HERE?,mx,my,0,20,447,34,24)
and would the numbers be correct? Because to get it to work I had to write this..
If ImageRectCollide (mybutton,mx,my,0,24,455,54,10)
Those numbers seem way out to me, but what am I missing?
Furthermore, "mybutton" is not the mouse image, its the image being used for the button, so how come this works? Im happy I can get it to work, but I would rather know why its not working as I expect it to. Ive followed the command help, but the example is a bit different, any insight anyone can offer would be very welcome. Thanks for reading.
Suppose I had a button image drawn here like this...
DrawImage mybutton,20,447 ;Image dminension is 34x24
And I want to test the collision with a plain mouse pointer (with no image) what would I write after the Imagerectcollide command to get the exact detection? Im having real problems here because every time I try this, my detection area seems too big and not referenced from the correct place, I got it to work by trial and error, but its not pixel perfect..
I thought it should be this for the above DRAW line...
mx = mouseX()
my = mouseY()
If ImageRectCollide(WHAT TO PUT HERE?,mx,my,0,20,447,34,24)
and would the numbers be correct? Because to get it to work I had to write this..
If ImageRectCollide (mybutton,mx,my,0,24,455,54,10)
Those numbers seem way out to me, but what am I missing?
Furthermore, "mybutton" is not the mouse image, its the image being used for the button, so how come this works? Im happy I can get it to work, but I would rather know why its not working as I expect it to. Ive followed the command help, but the example is a bit different, any insight anyone can offer would be very welcome. Thanks for reading.