#11253 - goro - Tue Sep 30, 2003 8:53 am
Hi,
I'm trying to "wait for n frames" before updating my sprite animation.
(my main character has 6 frames in his walk.)
I have implemented a global timing system that uses vblanks. it has a global "counter",
"frames" and "seconds".
I know the gba is slow at division and a workaround is bit-masking or shifting. something like:-
I know this code is for scrolling bg's but I think I'm trying to understand the >>3
part.
Please help using simple comparisons to everyday objects such as bread
because I'm a newbie!!
Never mind - I just learned about it -
A shift-right effectively divides a number by 2 and a shift-left multiplies it by two.
ie
The bitwise number is shifted left and a 0 comes in from the right.
Now to understand how the & part works...
I'm trying to "wait for n frames" before updating my sprite animation.
(my main character has 6 frames in his walk.)
I have implemented a global timing system that uses vblanks. it has a global "counter",
"frames" and "seconds".
I know the gba is slow at division and a workaround is bit-masking or shifting. something like:-
Code: |
bg1.mapData[y * 32 + ((bg1.x_scroll>>3) & 31)]
= temp[y * 256 + (bg1.x_scroll>>3)]; |
part.
Please help using simple comparisons to everyday objects such as bread
because I'm a newbie!!
Never mind - I just learned about it -
A shift-right effectively divides a number by 2 and a shift-left multiplies it by two.
ie
Code: |
x=7; // 00000111 value of x is 7 x=x<<1; // 00001110 value of x is 14 |
The bitwise number is shifted left and a 0 comes in from the right.
Now to understand how the & part works...