Monday, January 18, 2016

January Game - What I Have Done So Far


This is the first game that I'll be working on this year. It has no name at the moment, other than the uncreative project working title, "January Game".

I decided to keep it a small windowed game where two players, using the same keyboard, have a set amount of time to change their positions (by pressing the keys represented by the signs) before the gunman fires.

The gunman's goal is to shoot the other guy, and the other guy (whom I have named in my programming as the coward for some reason) is trying his best to avoid that fate.

I hope that it creates a sort of game of chicken in the last few seconds of the timer, where players are trying to gauge each other's intentions and deciding whether or not they should move at the last second.
In Game Maker, a popular method of adding rules to the system is to make a spriteless object that can be placed invisibly into the level. Here you can see that it sets up some variables in the Create event (in a Create event, the code in here is only submitted to the game one time per loading of that object. The Step event, on the other hand, will be submitted and re-submitted to the game a set number of times per second. The Create event is where you will be putting things you only want to be established once and the Step event is where you want things that will be changing).

In the Step event, you can see that I have conditions (known as "if statements") that determine what happens when you press four buttons. For example, when the 'Q' key is pressed, it sets one variable to true and another to false. Lower on the page it checks to see if one variable is true and if it is, to move the object 'oGunner' to a position thirty pixels down from the top of the room.
Here you can see the code for the clock hand. I decided to dump this code into here because the hand of the clock is a trigger for many events; when it starts moving, the game has started, and when it stops moving, the game ends.

You can see that it checks for when the variable Ticking is true. If so, than the angle of the clock hand begins rotating by negative one degrees, thirty times per second (which is the game's framerate).

Once the clock hand's angle is less than or equal to three-hundred and sixty (a full circle), then the game ends, a white screen object I made earlier enters the room and (in the white screen's own code) fades out. Before the white screen fades out, it replaces the coward's sprite with another, depending on the outcome of the duel.

No comments:

Post a Comment