The Dink Network

Pixel problem! (solved)

January 6th 2014, 11:32 AM
dragon.gif
Quiztis
Peasant He/Him Sweden bloop
Life? What's that? Can I download it?! 
Imagine two sprites with similar scripts attached to them named e1.c and e2.c, both are exactly 50x50 pixels large.

I place these sprites exactly next to each other in the editor, x-coord.

I use buttonon and buttonoff on both of them, like a pressure plate thing. When Dink stands on top of one, the sprite's frame will change and when Dink leaves it, the frame changes to something else. It is just like the mouse pointer in the menu, but Dink is the pointer.

When Dink walks over the first sprite, e1, from the left, the frame changes. BUT if Dink positions himself riiiight on pixel 50 in x coord, e2 will call buttonon!

e1 won't buttonoff until Dink is on pixel 51 which makes sense. But why does the other dang e2 buttonon at pixel 50 when it is located one pixel away from e1?! Any ideas on why this is happening? It works if I nudge e2 to start at 51, but I don't want that gap.

I haven't tried to work around it yet as I ain't able to do it right now, but any other solutions are welcome.
January 6th 2014, 12:14 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
What happens if Dink positions himself one pixel to the left of e1? Does it also go off?
January 6th 2014, 12:19 PM
dragon.gif
Quiztis
Peasant He/Him Sweden bloop
Life? What's that? Can I download it?! 
Yes, if you put four of these 50x50 sprites in a square, he could stand to activate all of them at once.
January 6th 2014, 12:29 PM
goblins.gif
Does the button brain use the hard box for collision? If so, you could modify that I think. That way the sprite doesn't have a gap but the collision does, and Dink will only be able to press one button at a time.
January 6th 2014, 12:46 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Yes. The button brain uses the sprite's hardbox, similar to how touch() works (and damage() for missiles, except that one has an added range() or distance() or whatever it was).
January 6th 2014, 12:46 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Yes, that's one solution, but it doesn't explain exactly why it happens. In any case, if you want to take thenewguy's advice (I would also fix it like that), you can modify the left x value of the hardbox in the .ini manually to make it just one pixel smaller on that side.
January 6th 2014, 12:52 PM
dragon.gif
Quiztis
Peasant He/Him Sweden bloop
Life? What's that? Can I download it?! 
Yeah, I think I know what it is now. The hardbox of the detector sprite. I tinkered too much with the buttonon sprite and modified it's hardbox instead of the real culprit's hardbox.

That's gotta be it.

EDIT: Oh yes, it was! Thanks all.
January 6th 2014, 03:01 PM
goblins.gif
You're welcome and glad you figured it out.
January 6th 2014, 08:16 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Excellent job finding out the problem!