Here’s what I ended up creating, it’s just a blue box that moves from left to right and loops. Nothing crazy but to me there’s a lot of work that went into it. I’ve created a repository to consolidate files and learning [here](). I will supplement my learning with tutorial style posts.
Brain dump of some of the things I’ve worked with.
It’s possible to assign functions to variables. I keep forgettting this.
If a variable is used without first being declared, it is a global variable.
In my own words (forgive the crappy explanation), a game consists of a few core parts:
- Game ‘objects’ that exist and interact with each other + other sources such as user input.
- Game logic and Game logic Calculation
- A draw function to update the visual aspects of the game
- A loop to tie everything together and run continuously.
So, Game objects will be created and interact with each other + other sources. There is game logic that will be calculated based on the state and behavior of the game objects and their relation to other sources of input. Based on those calculations, the next visual frame is drawn. A loop repeats this.
To be more clear, we can think about how Pacman works. When the user presses the key to move up, the game engine takes note of that and draws Pacman in a position higher than he was in the previous frame. If he makes contact with a dot, the game engine takes note of it and removes the dot, updating points as necessary. When Pacman dies by making contact with a ghost, the game notices that and proceeds to show a game over message. Additionally, the game may start when you press/initiate start. In the case of an arcade machine, the game engine will not start the game unless there are credits that are generated by the player inserting tokens. As you can see, there’s a good amount of logic that goes into the game. The engine’s job is to keep track of all game logic + display the next appropriate frame.
Side-side projects: Rails refresher, Ghost theme editing, Nginx rerouting, adding disqus + analytics as a commenting platform to this blog.
Amazon Web Services is rewarding people who complete one out of two courses on enterpreneurship $1000 in credit. Whoohoo! Source.