Chato’s Mansion Game - Little Fast Paced Shooter

Sharing Chato’s Mansion Game

The game was done for learning Arduino, and to have fun with my kid, but it is a lot of fun!
The game is fast-paced; it is a small shooter, but with some added fun tricks. I have not programmed in C++ for many years, so the style of the code will look funny, let us know of any bugs or errors. So far it seems solid.

  • You can aim precisely in many angles

  • You can shoot up to 2 bullets per sec, even as you change the aim angle

  • Be careful!!, the bullets will fly for several seconds and ricochet all over

alt text

Game play

  • Move sideways with [left] or [right]

  • Aim with [up]/[down]

  • Fire with [B]

  • Make one point for each ghost

  • Lose two points if a bullet hits you

  • You die if a ghost touches you

  • Every 5 points you will level up, more ghosts will appear!!

Have fun.

Send comments to n141az@yahoo.com

alt text

4 Likes

Nice. I love the ricocheting bullets!

As the player and the ghost are not masked, consider changing the following …

    void virtual paint(){
        // draw player
        sprites.drawOverwrite( currentX, currentY, spriteMap, 0);         
    }

to

    void virtual paint(){
        // draw player
        sprites.drawSelfMasked( currentX, currentY, spriteMap, 0);         
    }

… or create masks for the characters.

I am also curious about the memory management in the code. The Arduboy has so little memory that you tend not to instantiate objects with new, just declare them up front and reuse them if necessary. Obviously you managed to do it properly in your game, congratulations!

1 Like

You seem to have got your licences mixed up.
The LICENSE file for the repo claims Apache 2.0 but the source code claims GPL v3.
Which is it?

Hi I am happy that you liked it! I will definitely look into the masking. Regarding the memory, I do use new to instantiate the bullets and ghosts, but I use objects and inheritance to pack all the memory together, so there is really only one delete during play. Probably not super efficient, but much easier to manage and code.

Oops, fixing to V3. What is the recommended license ?

1 Like

Speaking of which, virtual functions use up quite a lot of progmem,
so if you’ve got another game planned, consider avoiding them.

(Using ‘objects’ don the other hand oesn’t actually have any implication on memory usage compared to alternatives. Whether inheritance has an impact depends on other factors.)

In some ways, but not in others - remembering to delete anything that’s allocated and making sure there aren’t any memory leaks can be a hassle.
Not a problem in environments where std::shared_ptr is available, but sadly AVR/Arduino isn’t one of those environments.

(And as @filmote said, a static pool of objects can be a big memory saving for Arduboy games.)

There’s no official recommendation.

Personally speaking I recommend MIT, Apache 2.0 or BSD 3-clause,
and I recommend against the GPL for various reasons.
There are other open source licences too, but those are the 4 most popular ones for Arduboy games.