Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2013-04-27 23:20:08

Hoksy
New member
Registered: 2013-04-27
Posts: 2

Flipping X and Y in GBDK

Hi, I was wondering if it is possible to flip both the X and Y axis of a tile in GBDK. I've found that set_sprite_prop(0,S_FLIPX); works except adding both
set_sprite_prop(0,S_FLIPX);
set_sprite_prop(0,S_FLIPY);
next to each other flips the tile on the Y axis and then occasionally reverting the Y flip and flipping the X axis. The ability to flip both axis is crucial for my game and I would loathe to have to make multiple tiles.

Offline

 

#2 2013-04-27 23:42:25

nitro2k01
Administrator
Registered: 2008-02-22
Posts: 249

Re: Flipping X and Y in GBDK

Try set_sprite_prop(0,S_FLIPX|S_FLIPY);

| is the logical "or" operator which will combine any bits that are set to one in the two numbers you give to it. For these constants, individual bits are used to turn features on or off. What you did will overwrite the old value and only flip the sprite in the Y direction.

Code:

  00100000 S_FLIPX
| 01000000 S_FLIPY
-------------------
  01100000 Result

Blog: Gameboy Genius
"A journey of a thousand miles begins with one small step"
Old Chinese Proverb

Offline

 

#3 2013-04-28 00:03:51

Hoksy
New member
Registered: 2013-04-27
Posts: 2

Re: Flipping X and Y in GBDK

Awesome that worked! Thanks!

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson