Canvas examples on animation basics and beyond
Time to take a new project with my canvas examples series of posts and focus on making quick hyper casual style games. So this post will be on an simple idea for a project that I am just going to call into the black. The basic idea is to just have a display object that is moving threw space and the game is just about seeing how far one can get until they get board and move on to something else.
It seems like it is a good idea to do something to find out how long it will take for a player to play threw one of my idle games. I say this because when I play one of my own games, or write some code to automate that process it seems that I sometimes end up playing threw the game way to fast. I would want to have games designed in a way in which people would keep coming back rather than just play threw the game and then stop playing. So an idea for this project came to mind where I just divide a distance by a distance per second rate to get the amount of time it will take to go that distance. I can then do things to increase the speed and wherefore reduce the amount of time it will take to move that distance.
1 - The utils module for to the black
For the utils module in this canvas example I have a mathematical modulo method, and a bounding box method for collesion detection. This is also a module where I will park any and all methods that I might use in more than one module, or that I might copy over to another canvas example.
|
|
2 - object pools for power ups and anything else that might come up.
I made another canvas example a while back in which I worked out a simple object pool library. Here I just copied and pasted that module in as a part of what I will be using for this project.
|
|
3 - The game.js file
The game module of this example returns a public API with the usual create and update methods that are used to both create and update a game state model for this as is the case with many other canvas examples of mine thus far.
|
|
4 - The draw.js file
Now that I have the game module worked out I will now want a draw module where I place all my code that will draw the state of a game object to a canvas element.
|
|
5 - The main.js file
Now I just want to make use of everything I put together in a main.js file.
|
|
6 - conclusion
I was able to get the basic idea in mind that i had working with this one fairly quickly, but there would still be a great deal more work to do in order to get this to start to feel like an actual game of some kind. I just wanted a project centered around estimating the amount of tie it would take for an object to move a given distance, and to make that distance a very large number. I did not have much in mind beyond that other than to just have a project where I am working out some code that has to do with topic that seems to come to mind whenever i start working on idle game prototypes.