Number vs int for x, y position in world [Solved]


(Lozza JP) #1

Hi all, still new to FP and trying to get my head around some things.

In the documentation (http://useflashpunk.net/docs/net/flashpunk/Entity.html) it asks for entities x and y to be in Number. Which in my understand is a double float in AS3, could this not cause problems as opposed to using whole integers?

How does it handle if it accidentally gets a float instead of whole number?

It then asks for width and height to be int, as well as its X and Y position. Then centerX and centerY are in Number…

Is it best to just follow suit of the documentation, or do other people wholly use int’s?


(Martí Angelats i Ribera) #2

Number is not equal to double or float is a bit different (really similar but not exactly the same)

The width and the height needs to be int becouse of the way FP handles the hitboxes, but the x and y can be numbers so it’s better to use it (it is good to allow it if you have some physics).


(Lozza JP) #3

Ah yes, when it comes to projectile arcing and the like I imagine?

Thanks copying.