What I wonder is why adding to an entity’s Y value makes it go downward, when it should go upward?
Who came up with the idea of an inverted Y axis?
This is a basic question about flash. Basically the coordenade system have origin (the point (0,0)
) at the top left corner of the stage
. So basically the vector representing the y is going down so increasing the y value makes the entity go downwards.
To make the enetity go upwards you simply have to decrease the value of y.
PD: Yes this coordinate system have the y inverted if you compare it to the most common system. But in math it’s known that there are an infinite amount of systems and for screens this is a common one.
It’s just interesting, because several times I’ve been extremely confused to what’s going on.
And don’t let me get started on hitboxes and their offsets!
Seeing them makes all the difference. So in console mode you can hit F1 to show the boxes
FP.console.enable();
or use:
override public function render():void
{
super.render();
var o:Array = new Array();
getAll(o);
for each (var e:Entity in o)
{
Draw.hitbox(e, true, 0xFF0000, 1);
}
}
This is the standard for a lot of things screen related. I think it stems from how televisions used to draw the images: left to right, top to bottom. It starts at the upper left corner.