My first game part

Basically, I just wrote out a programme in C++ to calculate the amount of health lost by an attack, with or without armour, and to display the remaining level if the player character isn’t killed in the attack.

Okay, it’s not much and it requires the command line to work, but it’s a start! Here’s the pseudocode for if anyone is interested.

main loop:

define the variables health, armour and damage;

ask the user to enter the health before the attack, then display it;
repeat for armour and damage;

health after = health before - (damage - armour);

if health <= 0, display a "game over" message
else display the remaining health points

While I think this is more suited to an RPG-style game such as Oblivion or a turn-based strategy game like Alpha Centauri or Battle for Wesnoth, I suspect something along these lines is happening inside most games, with the particular details varying from one game to another.


Tags: , ,

About Philip

I'm a physics graduate, sci-fi writer, budding game designer, and amateur human.

Any comments?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: