Calculator Community > HP Prime

Spaceinvader game

<< < (2/6) > >>

DJ Omnimaga:

--- Quote from: Handmixer on January 03, 2014, 01:58:37 am ---The graphic is predrawn into G3, so that G3 contains all animations. This takes up less space.
In the end of the gameloop there is a WAIT(0.05), this is entirely for the emulator, since it will run to fast.

The gameloop doe contain a lot of FOR-loops for moving, collision detect and rendering, I Think that it may be possible to optimize by reducing to a few FOR loops.

Star background is a good idea. It could be predrawn i G4 and Blit'ed to the render buffer at the beginning of each render cycle


--- End quote ---
I think it wouldn't be a big issue to use more space with a larger GROB to store each possible frame of the entire enemy army rather than each ship, since the calculator has over 16 MB of RAM available for the user. Even with the largest possible army it would most likely take 1 MB or less (assuming, for example, that an enemy army takes a 300x200 area and has 8 frames, each pixel taking 2 bytes). The hardest part would probably be to erase destroyed ships, since you would need to apply a RECT_P command on all 8 frames on the destroyed ship, while also updating your matrix data or whatever.

I the worst case scenario, you could always cut down animation frames to save space.

As for the WAIT command, I think a trick would be to use a TICKS command at the start of the frame then another one at the end. Then you just have to use a WAIT command where you substract both resulting ticks value then divide the result, to keep frame rate consistent.

Handmixer:
Ok, this afternoon I have modified the rendering so that the Whole army is in one GROB.
I was also worried that when 1 alien is killed I had to do 10xRECT and it would affect playing the game, but it hardly does.
I decreased the bombs and bullits to 10, but I think making a queue, rather than a FOR-loop also could reduce som time.
Later I will try to reduce the amount of FOR loops by collecting the movement and the rendering in the same loop.

Thanks for the feedback

DJ Omnimaga:
Yeah, there could possibly be some minor slowdown when killing an alien, more noticeable if everything moves very smoothly. However, I noticed that Zelda: Windwaker for the GameCube, which is a commercially aclaimed game, also does it, so I guess it's not too bad unless the lag is extreme. :P

By the way, how do we use bombs? ???

Handmixer:
The file has been updated.

Bombs are dropped by aliens >B)

DJ Omnimaga:
Ok thanks. I'll try the new version later. :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version