Half a pixel.... ;-)
gyroscope
I am here.Member, Sous Chef, PRO Posts: 6,598
Hi, sometimes in the x or y position of actors, it shows a image centre position being something .5 of a pixel, e.g 240.5, etc. My guess is that the position isn't being rounded up or down, maybe?
---------------------------------------------------------------
Spiral Gyro Games
---------------------------------------------------------------
Spiral Gyro Games
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Comments
:-)
---------------------------------------------------------------
Spiral Gyro Games
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
---------------------------------------------------------------
Spiral Gyro Games
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
As for the .5, think of it like this. If you have a 480 pixel graphic and you count from one side toward the middle, you would count 240 pixels starting from either side. So each half is 240 pixels. GS measures the middle of the graphic, so if you count 240 from one side and 240 from the other side, both counts can't be the middle... it's 240 and 1/2.
I like your explanation, design219; although 240.5 as a pixel position doesn't work in the "real" sense, that's the way GS does it. I know that in another game-making app I used to use, any graphic position was top left corner, so could be any true pixel position. Of course, problems occurred there as well, when you had to refer to the middle of an uneven number of pixels; in that case, the engine rounded it up to the nearest pixel more, to give it an actual pixel position.
But middle pixel position is much more useful, I guess. So half a pixel it is!
:-)
---------------------------------------------------------------
Spiral Gyro Games
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Hang on, it's clicked. It's a virtual position, being made up of half of one pixel, and half of the next, for easy of whatever's sake. But "even" in GS, if you put an actor's x position as 35.5, it'd go to 35 or 36. Think that's it.
:-)
---------------------------------------------------------------
Spiral Gyro Games
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Remember to set the graphics settings to "fixed" instead of "stretched" for graphics with odd pixels counts, Like 63 x 64. That will keep them from blurring in an effort to make the centered "half" pixel measure work out.
:-)
---------------------------------------------------------------
Spiral Gyro Games
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
However, many graphics programs allow sub-pixel rendering. Flash has this, as does OpenGL ( which is what Gamesalad uses) and this allows you to place graphics, both raster and vector, at floating point coordinates.
Fonts use this technique extensively.
It sort of acts like "dynamic antialiasing". The iPhone uses this everywhere. Although the final image is displayed on a pixel grid, the antialiasing everywhere is the result of all the subpixel data.
In Flash you are able to position things down to 1/20th of a pixel. I am not sure how small you can position things in OpenGL.
:-)
---------------------------------------------------------------
Spiral Gyro Games
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
For example.
In my ipad app "iTonal HD", when I would sometimes place one of the pads by physically changing the x/y values of the instance, when I hit play or preview, I noticed it would shift sometimes, so I stuck a display text on the pad, and watched it.
So if I had a pad at say x=150 when I hit play, it would show as 150.5
I don't remember the exact specifics now as I made the app a while ago.. just remember it being pretty frustrating at the time.