Suggestion about pixel perfect detection on scaled sprites

Started by Dusk, Fri 17/09/2004 12:37:18

Previous topic - Next topic

Dusk

We checked that to have smooth animations of a character, due to scaling approximations, it's not always sufficient to center sprites on the y axis: you must import views with the same width. So, you have to choose as width the largest one, that usually involves having some views with a quite large transparent area.
I can imagine that implementing pixel perfect detection on scaled sprites is not easy, and probably not many users need it.
But I was thinking: what about providing each view with two properties activation_x/activation_y, better if graphically (as the baselines) that would form a virtual rectangle easy to check for "mouse over" purposes? I suppose that the actual code to check interaction on a scaled sprite uses a rectangle formed by sprite.width*getScalingAt(sprite.x,sprite.y)/100 and sprite.height*getScalingAt(sprite.x,sprite.y)/100.
To mitigate the transparent area detection problem, at this point the sprite.activation_x and sprite.activation_y would substitute sprite.width and sprite.height.

How many stupid things have I written? :)
Bye,
D.

Pumaman

As it happens, I implemented pixel-perfect click detection for scaled sprites last weekend, so it'll be in the next beta.

I hope that will mean this suggestion is unnecessary?

Dusk

Sure that it's unnecessary! :D
Pixel perfect detection for scaled sprites, great.. thanks a lot, CJ! ;)

D.

SMF spam blocked by CleanTalk