Depending on the variable type that you use, the actual data contained can wrap-around the constraints.
For example, an unsigned short ranges from 0 -> 65535. Now an overflow would occur when trying to increase the data to a value greater than 65535, which would then wrap back around to zero again ...
Search found 15 matches
- Tue Jul 28, 2009 3:40 pm
- Forum: DS/DSi Development
- Topic: Collision of moving object with rectangular target
- Replies: 4
- Views: 5798
- Tue Jul 28, 2009 1:37 pm
- Forum: DS/DSi Development
- Topic: Generating dynamic backgrounds
- Replies: 5
- Views: 6787
Re: Generating dynamic backgrounds
Just a quick update. I have been playing around with the pixel editor mentioned earlier, and while it looks good, i dont know of any good map editors to work in conjunction with it. Would some people like to give examples of the program they use to create maps for their games? I tried looking up one ...
- Wed Jul 22, 2009 9:12 am
- Forum: DS/DSi Development
- Topic: Generating dynamic backgrounds
- Replies: 5
- Views: 6787
Re: Generating dynamic backgrounds
Following the examples in the all-in-one folder, i was more looking into the ability to use an array to create the maps. The only problem i have, is organizing the 8x8 tiles into an order, the grit rules associated with it, and then the correct way to reference them. I have played around with ...
- Wed Jul 22, 2009 1:21 am
- Forum: DS/DSi Development
- Topic: Generating dynamic backgrounds
- Replies: 5
- Views: 6787
Generating dynamic backgrounds
I have looked through the libnds forums, trying to find an answer to my current problem, and i have only seen it touched upon. What i am looking to do is to generate a landscape based on a bi-dimensonal array that is read in at run time. I know that the display is made up of 8x8 tiles, and that i ...
- Sun Jul 19, 2009 12:24 am
- Forum: DS/DSi Development
- Topic: Looking to generate random sprite colours
- Replies: 22
- Views: 20317
Re: Looking to generate random sprite colours
OK, i found out why i had the problem. It was because i was mis-using the static keyword in the header file, thus giving each file their own value for the memory location. I have fixed that now and my sprite animation is now working. (Stupid memory and forgetfulness)
- Sat Jul 18, 2009 11:44 pm
- Forum: DS/DSi Development
- Topic: Looking to generate random sprite colours
- Replies: 22
- Views: 20317
Re: Looking to generate random sprite colours
the balloon pops on the bottom screen, but you allocate vram for the main engine (while the main engine defaults to the top screen). is there any reason why you switched the engines around? AFAIK, there aren't many differences between them when just using 2d, and it makes things harder to follow ...
- Sat Jul 18, 2009 1:54 pm
- Forum: DS/DSi Development
- Topic: Looking to generate random sprite colours
- Replies: 22
- Views: 20317
Re: Looking to generate random sprite colours
Ok, now i have a different sort of problem.
I wanted to have a simple popping animation for when a balloon is touched, so what i have done is
loaded the 3 32x32 4bit sprites into memory, using the following piece of code.
//balloon.h
static u16* balloon_gfx_mem;
static u16* balloon_pop1_gfx_mem ...
I wanted to have a simple popping animation for when a balloon is touched, so what i have done is
loaded the 3 32x32 4bit sprites into memory, using the following piece of code.
//balloon.h
static u16* balloon_gfx_mem;
static u16* balloon_pop1_gfx_mem ...
- Thu Jul 16, 2009 2:49 pm
- Forum: DS/DSi Development
- Topic: Looking to generate random sprite colours
- Replies: 22
- Views: 20317
Re: Looking to generate random sprite colours
Well its not like i dont know the c / c++ languages, as i am doing a degree at university in computer science. Its more getting used to the toolchain and the available methods and structures in it. My group in the uni game making club decided to make one on the ds, so here i am.
- Thu Jul 16, 2009 12:45 pm
- Forum: DS/DSi Development
- Topic: Looking to generate random sprite colours
- Replies: 22
- Views: 20317
Re: Looking to generate random sprite colours
Those artifact balloons could be down to a wrapping of the Y location of other ballons. basically your Y position is limited to 0-255, and is signed (-127-128), so ((rand() % 100*wave) + 195) = somewhere near the top of the screen in some cases of your init code, or even wrapping the screen twice ...
- Thu Jul 16, 2009 11:51 am
- Forum: DS/DSi Development
- Topic: Looking to generate random sprite colours
- Replies: 22
- Views: 20317
Re: Looking to generate random sprite colours
After a quick glance:
in setupgraphics():
SPRITE_PALETTE_SUB[(n*16)+2] = SPRITE_PALETTE[(n*16)+1];
Should that not be:
SPRITE_PALETTE_SUB[(n*16)+2] = SPRITE_PALETTE[(n*16)+2];
also you are dmaCopying 32x32 pixels, the sprite is 16x32 pixels - you might want to change that and see if it fixes ...
in setupgraphics():
SPRITE_PALETTE_SUB[(n*16)+2] = SPRITE_PALETTE[(n*16)+1];
Should that not be:
SPRITE_PALETTE_SUB[(n*16)+2] = SPRITE_PALETTE[(n*16)+2];
also you are dmaCopying 32x32 pixels, the sprite is 16x32 pixels - you might want to change that and see if it fixes ...