#18339 - jenswa - Wed Mar 24, 2004 2:58 pm
I want to use coins in my game,
so i thought of the following structure,
the coins will have an x and y position (integer) and a boolean to check wether it was taken by the player or not.
I display a maximum number of coins on the screen, 10 coins is the max currently.
So there could be a hundred coins in a level, but only 10 can be on screen.
So i wrote this code (see: zip-file)
to display a max of tens coins on the screen, i started out with less coins, like 4 as the max first, then 8, then 10.
And i had 20 coins in the level, this was working for me. So the code worked fine, i increased the number of coins in te level
to 100 and that didn't work. So i decreased it to 40, that works. So i then increased to 60 and that didn't work.
Now the maximum number of coins for a level is stuck at 40 (actually 45).
The problem which arises when i go above 45, first of all the file compiles fine, but when i run it on visualboyadvance,
nothing happens, the file gets loaded, but doesn't display the first coin, like it does when i set the maxcoins to 40.
So i tried to get around this problem by increasing by compiling the file with 40 and manually adding 1 in the game loop itself,
that gave me a strange artifact (see: zip-file). Som extra coins are added and move with a multiple speed of the original coins.
My earlier attempt was to use the OAMentries 20 ~ 80 for coins (since i am not using them anyway),
but that gave more or less the same problem, it also got stuck at a number of fourty.
Can anyone help me with this problem?
(a fix or a new solution would probably be best)
Oh i forgot to tell, all is compiled as multiboot, i also tried a normal binairy, but both have the same problem.
Thanks Jenswa
attachments:
http://www.geocities.com/gouwevrouwe/coins.zip [62 k]
(code included, working file and a not working file, all other sources need and the artifact)
PS:
I've an old version of devkitadvance
_________________
It seems this wasn't lost after all.
so i thought of the following structure,
the coins will have an x and y position (integer) and a boolean to check wether it was taken by the player or not.
I display a maximum number of coins on the screen, 10 coins is the max currently.
So there could be a hundred coins in a level, but only 10 can be on screen.
So i wrote this code (see: zip-file)
to display a max of tens coins on the screen, i started out with less coins, like 4 as the max first, then 8, then 10.
And i had 20 coins in the level, this was working for me. So the code worked fine, i increased the number of coins in te level
to 100 and that didn't work. So i decreased it to 40, that works. So i then increased to 60 and that didn't work.
Now the maximum number of coins for a level is stuck at 40 (actually 45).
The problem which arises when i go above 45, first of all the file compiles fine, but when i run it on visualboyadvance,
nothing happens, the file gets loaded, but doesn't display the first coin, like it does when i set the maxcoins to 40.
So i tried to get around this problem by increasing by compiling the file with 40 and manually adding 1 in the game loop itself,
that gave me a strange artifact (see: zip-file). Som extra coins are added and move with a multiple speed of the original coins.
My earlier attempt was to use the OAMentries 20 ~ 80 for coins (since i am not using them anyway),
but that gave more or less the same problem, it also got stuck at a number of fourty.
Can anyone help me with this problem?
(a fix or a new solution would probably be best)
Oh i forgot to tell, all is compiled as multiboot, i also tried a normal binairy, but both have the same problem.
Thanks Jenswa
attachments:
http://www.geocities.com/gouwevrouwe/coins.zip [62 k]
(code included, working file and a not working file, all other sources need and the artifact)
PS:
I've an old version of devkitadvance
_________________
It seems this wasn't lost after all.