Cowboy VS Zombies WIP

I’ve been browsing these forums since I bought Codea a few month ago. Since I did not really had knowledge in programming before, these forums and many of the examples presented here helped me a lot.

One of the projects I really like to get finished is COWBOY VS ZOMBIES! (working title). But see for yourself:

So, if anyone is interested in how I did one or another thing in there, let me know and I’ll try to explain or post some code, maybe as a standalone function to be efficient.

Because i really want to keep it neat and tidy I try to keep some simple guidelines on which some of the more experienced coders could give me advice:

  • make (nearly) all graphics meshes. Sheets for animations and if an object has several “states” (like the barricades). This one pretty much works.

  • organization in classes and tabs. Not sure how far one should go dividing stuff in classes or just make one class and apply certain properties ( example: with different kinds of zombies, make each kind a class or just one Zombie class with properties depending on what kind of zombie it is?)

Is it possible to have several classes defined in one tab? Then I would make a base class for zombies and put all the zombie-type classes in one tab. Just dont want to get flooded with tabs in codea…

Any suggestions for the game itself are also very welcome!

FANTASTIC! A few things:

  1. It kept on annoying me how every 4 frames for the zombie his shadow was transparent in some areas.
  2. Yes, you can have multiple classes in one tab, you can even define classes in the main tab. All you need is myClass = class() and the other functions. A tab is just making code neater, nothing else.
  3. Good job with organization and your principles. Meshes are the way forward.
  4. Ever heard of a base class? Define the basic zombie class, and make a subclass with all its base class’s properties. e.g. angryZombie = class(Zombie)
  5. Maybe animate the bullets, its cool to see bullets fly from a gun.


Looks like a great project, @VanDread.

If you’re looking to use meshes instead of sprites, take a look at @toadkick’s batching class:

thanks for the comments!


  1. Yes, the graphics are all temporary placeholders for now. Planning to have a gritty comic-like look in the end.
  2. and 4. Thats very good news!
    I actually started to work with base classes with the placable walls. So a placeable, by the zombies recognized item is the base class, but that it is a barricade with all its properties is the sub class.
  3. Thought about that. But I’m not really into that kind of slow flying bullets. Of course there will be a shooting animation for the cowboy, but I’d also like to have the hit graphically represented on the zombie instead of the numbers i have now.

I took a look at that but as I currently make my sheets by hand, I build an easy template where I just have to put in the sheet-source image and the number of frames. then i can call the frames with a currentFrame variable for animation or states (like the barricades or the gun cylinder).
Works currently with one row of frames.
If someone is interested, I could try to make an “plug and play” set of functions and post them here for easy implementation.