Example code for a Side Scrolling Beatem Up Game

I’m wondering if someone could give me a sample code that makes a sidescrolling
2D beatem up game complete with heroes bad, guys, enemy health bars and hero lives.
Much appreciated!

I also am asking for code to make the health bars of heroes too

You’re literally asking for someone else to code you a game. That’s your job as the coder. If you have a problem with a small piece of code you can’t figure out, or need feedback or ideas for your game, we can help. We can’t code an entire game for you.

@skythecoder This is not what I was asking you. You misunderstood me. I was not
asking you to do my work for me. I am not looking for shortcuts. I am still willing to work for getting what I want. I was only asking a small piece of it not the code for the entire game. I apoligize for making a general statement. The purpose of getting this code was not to make a product to sell but only for my personal enjoyment and practice.
Both for playing it and observing and taking mental notes of how the code works by looking for any of the basics I have been practicing in the tutorials. It will be a long time before I can make my own games. I understand and I accept that fact. This is just for fun and practice.

Okay, then… How about taking a look at my game 10Life (2)? It’s a shoot-'em-up game with scrolling sides. :stuck_out_tongue: Installer.

Also, I was basing some of what I said off of “I also am asking for code to make the health bars of heroes too.” (Saying you’re asking for code combined with previously asking for a sample game led to me thinking you were asking for an entire game coded by someone else.)

No of course not. I am sorry I was not clear. Any work that is made public will be my work and my work alone. If anyone’s code is included in any of my works where ever it is found I will always give that person the full credit they deserve for their work. Anytime I ask for code it is always for the purpose of providing myself a teaching tool and a guideline to study. Thanks also for giving me your example. When I get better at this I will send you some of my codes too. This is a great forum :)>-

Hey @skythecoder this may sound like a odd question but what is Jist? And what
is it’s purpose for using it for Codea? This is the first time I have heard of it.

@strotherdw- the problem with any demo game that does everything you asked, is that the code has to be pretty long and will be fairly complex, and will probably do six things differently from what you want.

The nearest I can think of is Foggy Bummer, here.
which is side scrolling but doesn’t have jumping or bad guys.

You are probably best off breaking the game into lots of pieces. You’ve already identified a few of them, but there are plenty more (these are just my guesses, I am no expert on side scrolling games)

  • what is the background?
  • is it a platform game?
  • do you move the hero or the background?
  • how does the user scroll, jump, fire etc?
  • what weapons does the hero use? what projectiles?
  • what kind of bad guys do you want?
  • are there pickups?
  • how should the scoring and health work?
  • are you going to use physics to handle the running and jumping?
    …and many more.

There is a really good article here on this sort of game
And another

So how do you start?

I suggest you look at the step by step projects on the wiki link above. While none of them are platformers, they show how you can build a game, piece by piece. And that is a lot of fun. And the final game will probably look a lot different to what you originally thought.

If, however, this is too hard and you’d like most of the work done for you (I’m not being rude in saying this, not all of us want to reinvent the wheel!), an app called GamePress makes it easy to build sidescrollers without any code.

@ignaz thank you for the links and your input. I realize putting together such a game is complex and I don’t expect myself to make one anytime soon. What I am doing is studying bits and pieces of everything and figuring out how they are related to and apply to Lua and the online tutorials hoping in a few months perhaps a little longer I will be able to understand how things work. In the meantime I should keep doing the tutorials and not be afraid to ask about anything I get stuck on while learning and just enjoy the ride.

Yeah, don’t be in a rush, just enjoy the journey. Programming is hard, and it takes some time to get the hang of it.

@Strotherdw from all my experience, I can tell you once the basics of the game are down, its a fun delightful process :).