How To

Get X and Y flip of sprite [duplicate] [similar] [meow]

3

G-9 2021-06-29 09:03

Please, I still don’t understand, and I hope this question will help everyone :3

Timo said something about getting x flip :
SPRITE.A(I) AND %1000
But it returns 8 when sprite is x flipped (wtf?)
Also I’ve tried was8bit’s background attributes program, but they only apply on cells and not on sprites…

I’m doing a Portal NX (2). I deleted the old one because it was the worst code of the world and it was full of bugs. I preferred restarting. Same for Among Us NX who used too much ressources


G-9 2021-06-29 09:05

For the tests…

Test Program.nx | Open in app
2021-06-29 09:05

was8bit 2021-06-29 11:10

For sprites....

https://lowresnx.inutilis.com/topic.php?id=1993


was8bit 2021-06-29 11:13

CHARFLP=(SPRITE.A(sprnum) AND %00011000)/8

Yields
0 = no flip
1= xflip
2=yflip
3 =x and y flipped

So if >=2 then yflipped
If 1 or 3 then x flipped


was8bit 2021-06-29 11:15 (Edited)

For YOUR code, try SPRITE.A(I) AND %00010000/8 and see if that gets yflip..

It might not work... i am rather too sleepy now for math....

I am thinking maybe try /16....


was8bit 2021-06-29 11:25

Basically, if you use % with only one 1 and the rest zeros, then without dividing anything you will eitther get a 0 (not set) or some number (set)... divide by that number if you need it to be a 1 or a 0... or you could just code as IF =0 ELSE and regardless of what the number is your code should work..

Reading 2 bits at the same time is trickier....


was8bit 2021-06-29 11:29

To understand binary to decimal, look at this chart (just look at the decimal and binary parts... each entry is the same #, just a different way to write it)

https://www.google.com/search?q=binary+chart&client=safari&hl=en-us&prmd=inv&source=lnms&tbm=isch&sa=X&ved=2ahUKEwj5-tGN3rzxAhU1mWoFHSU6BBoQ_AUoAXoECAIQAg&biw=1024&bih=650&dpr=2#imgrc=Piz6zhTaKqz7lM


was8bit 2021-06-29 11:31

According to the chart, binary 0000100 is decimal 8


G-9 2021-06-29 13:47

ty, worked :3


was8bit 2021-06-29 14:21

Cool :)


Timo 2021-06-29 16:12

If you just want to check if it's flipped or not, don't worry about the returned number.
The "IF" command only cares about 0 or not 0. So 8 is "true".


BGelais 2021-06-29 18:20

Usefull! :)


Log in to reply.