Conditional Logic - Simple Game Moves Manual?

Hello Fellow Educators and All,

I keep running into the same classroom project needs of rearranging conditions and variables to create new situations students want for simple games (no OOP or fancy stuff) - just the basics. I was wondering if there is a set of sheets or a manual of common conditions for very basic video game needs?

For example:

  • types of character movements
  • character hops
  • simple collisions
  • hit boxes

All this stuff is new to me but familiar to my students as video game consumers. We are learning alot in class through experimentation but I am looking for further resources. I own just about every book on Processing available but I am looking for something much simpler and specific:
Conditional work-outs with an eye to simple video game designs.

Grateful for any suggestions. Thanks in advance!

1 Like

I can’t really tell you about any good sheets on this, but if i got you right, you are looking for often used systems in video games like health bars and similar, right?
If this is what you are looking for, i’ll post a list of everything i can think of right now. If you need a better explanation on some of them, or some coding examples, i’ll try my best. Just tell me :wink: . If this is not what you are looking for… well, someone might need it :sweat_smile: .
So here is a list :

HP/SP/MP Bar : They represent the amount of times certain actions are executable, like being hit by the enemy would reduce your HP and when it is at 0, the game will usually finish, or you will have to reload the game from a savepoint. Similar with HP, SP and MP represent Stamina and Magic Power, though they generally have many similarities. Special Actions cost energy, and will reduce the bar, until it reaches 0. When the energy needed for an action is higher than the energy left, the action is not executed. This can be done using a simple if statement like :

void run() { 
  allowExecution = spBar > energyCost ? true : false;
  if (allowExecution) {
    speed *= 2;

And this explanation turned out to be longer than i expected, so i’ll just cover the basics and ask you to tell me on what you need explanation.

  • Status (things like the Strenght. You might need a certain amount of it to get through some passage, or similar. In most games the Stats are HP, Attack, Defense, and less often also MP, Magic Attack, Magic Defense, and also SP)
  • Saving/Loading
  • Running (increasing speed of the charakter by pressing Shift for example)
  • Interaction with the environment : Collision (either Physical collision, or through ray tracing, to see what is in front of the charakter), Collecting (pick up things like food, gold, weapons, power ups, and so on) Destructables (things like destroying objects blocking paths to pass through, or to collect things hidden inside them), Drops (counterpart to Collecting. Making objects drop things (items) once they are destroyed). Placing (There has been an increase in games with this functionality lately, so i’ll add it. Counterpart to Destructables. Objects inside the Inventory (comes later) can be placed in the Gameworld and may also be created by the player with collected materials.)
  • Inventory (most games have this feature. It’s a place where the collected items can be stored for later usage).
  • LoadingScreens (Often neglected since it’s not part of gaming, it is part of the behind the scenes of games. Should be loading, but since i already had it with saving, i called it this way, to avoid confusion. The part of the game in which it loads all neccessary things, to avoid lags during runtime, or even bugs that could cause problems later on.)
  • Graphics (should be fairly obvious, but is still a big part of gaming. Without graphics, there wouldn’t be much to do with games)
  • Sound (not as important as graphics, but contributes a lot to the feeling of the game)
  • Levels (the player can collect experience and once reaching a certain threshhold, he increases in level and can unlock new things, depending on the game)
  • Stages (would be called levels in most games, but since the word already refers to the level of the player, i just used stage instead, which is also valid. Refers to the part/world/time/chapter the player is currently located in. There are many games that use stages, and i can’t find the right way to explain it, so i hope it is selfexplanatory enough)
  • Multiplayer, but that probably is higher level :sweat_smile:

This is an awesome list @Lexyth! I will need some time digest and unpack with my students. I am very interested in finding specific and simple examples of “interaction with the environment”. My crunching and estimating of the appropriate conditional check to make simple examples for my student to do the things you listed above in quite inferior.

Oh and also scores and achievements.

Some people have tried writing different game frameworks for Processing, but it sounds like you might want to simplify things to a few simple concepts. So, rather than try to implement the full apparatus of a complex game (stages, scoring, etc.) focus on a few powerful concepts that teach core logic.

The number one most requested game concept I see on the forum is collision detection – a ball hits a paddle, a player avatar bumps a wall or a platform, a particle hits a target, etc.

You can add small amounts of logic to a collision detection example to turn it into a simple game.

There is a single extensively annotated example, CircleCollision:

There are several great collision detection tutorials in Processing that walk through examples:

  1. Collision Detection (Jeff Thompson)
  2. Collision Detection (Kevin Workman)

What age / level are your students? Many of these examples require basic algebra and/or geometry to understand.

The second most common issue that I see is a state machine for example, transitioning between the states, play, won / lost, and play. Or the states begin, stage 1, stage 2, end. Teach students to define their game as a series of states, draw based on the current state, then react to events by changing the state (ball goes in goal, state changes from play to won – if state is won, spacebar changes state to play).


Hi Jeremy!

I teach 12th graders and these tips are really helpful!!! Thank you!!!

1 Like