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

Mac OSX The craziest bug ever or am I missing something!?

knightshaft

Member
I'm still mostly working in DND but I have an 'execute code' box with this:

if point_in_rectangle(mouse_x, mouse_y, 950, 530, 980, 550 )
{
url_open("http://www.mysite.com");
}

It's the only thing in a 'left pressed' event, It works fine....but the code never works anywhere else.... EVER! If I want another click event I have to duplicate the object. If I want to do it in another project I have to import the object. This has lead to a bizarre discovery....

When I import the object, it also import a completely unrelated sprite, if I delete the sprite, ALL the click events stop working!!!!
 

TheouAegis

Member
When you say doesn't work anywhere else do you mean in any other projects or do you mean in any other events? Or in other objects?

Also, the left press event only works if the object has a sprite. You need to use global left press.
 

knightshaft

Member
When you say doesn't work anywhere else do you mean in any other projects or do you mean in any other events? Or in other objects?
other events AND other projects.

Also, the left press event only works if the object has a sprite.
That would explain why it doesn't work anywhere else but not why or how it's selected an unrelated sprite to make itself work.

I think you have given me enough info to move forward. Cheers.
 
T

Taddio

Guest
Well, if you change sprites, the collision box will most likely change too, which could break your mouse_pressed code.
Make sure you have a collision mask, I'm guessing that's just that.
Also, if you copy and paste it in a new project, the room coordinates might not be where they were last project, if you messed with the size and all.
 

knightshaft

Member
After further inspection, this would seem to be an issue with sprites and the draw event. I'm working in DND, I was using the draw event to draw a rectangle to experiment with positioning, then using the coordinates in 'point_in_rectangle'. Then I deleted the draw event or disable the DND blocks. This would seem to be the root of the problem, disabling has no effect but deleting stops the click event working. If I assign a sprite to the object and it's big enough to reach the 'point_in_rectangle' coordinates it works again.

However, after saying all this, I still have objects with click events and NO sprite or draw activity that work fine, and none of this explains why importing (into a new project) the original object that I used to test this, which had no sprite or draw event and worked, also imports an unrelated sprite.

Anyhow, I can now deal with it and move on (to the next quirk of DND).
 
Top