Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: hellninjas on May 31, 2012, 11:15:00 am
-
How would I use the pxl-test( command to prevent my character from falling through pixels, with acceleration of course, x256.
Or is there another, possibly easy, way to do this?
-
uhh, divide by 256 to snap to a pixel.
From there, before you draw anything but the ground or solid platforms, use pxl-test(x,y+#) the plus number will be different depending on the height of your sprite. 0 means no pixel there, 1 means pixel there
-
So..
:If getKey(1) and (pxl-test(X/256,Y/256+4)=0)
???
-
probably not. You said there is acceleration, which adds another dimension into it.
try...
:If getKey(1)
:*calculations in movement and stored to another variable, such as Z, as would be resulting location*
:If pxl-test(X/256,Z/256+4)=0
:Z->Y
:else
:Z + 256 -> Y
:end
:end
Try that.
you my need to change it to be relevant to your code.
Edit: added an example program.