You inherit a farm from your grandparents, but have to clean it up a bit before you can use it. You must...
Your grandparents beloved cow they gave to you.
But in the night, She runs away!
Can you save your beloved cow before its too late??
Let's see! How to play:
Controls:
These are the game controls. Each action Corresponds with a letter on the keyboard. For instance, if you'd like to cut down a tree, you press "A" to use your axe.
How I made this:
This game is composed of many different parts, such as animation, object sensing, and checking conditionals. Here is a quick summary of how I did it all!
Animation:
Animation helps a game look more realistic. For instance, instead of a single image sliding across the screen when a character walks, animation makes the legs move, and it's a lot easier than it seems.
First, You must upload all the images you need into your code. These are all the images I needed to make my character walk in all different directions.
Here is the code that makes the sprite "walk".
At the top, it checks if the left arrow key is being pressed.
When it is, the code checks the time, and every 100 milliseconds, the images switches to the next image in the progression.
At the bottom in the "else" statement, the timer resets to 0, and it starts all over again.
The code is the same for walking in all other directions,
That's the basics of animation!
Object Sensing:
In order for the character to interact with other objects int eh game, it needs to know when it's touching that object. For instance, you don't want your character entering the house at random times. This is one way to make sure the character interacts how you want them to while playing:
This is showing the player leaving the house, and the code deciding which different " world" they will end up in.
For instance, if the players cut down the trees before entering the house, we don't want the trees to be there when they leave the house again.
This part of the code checks what world the player is in (in this case the house) and where the player is in that world. If the player is between 520 pixel across and 550 pixels across, the player will "interact" with the space.
This shows what happens if the player interacts with the space. It changes what world the user is in, and send it back out to the field.
Checking Conditionals:
This same block of code from earlier also shows us checking conditionals, and how they impact what happens in out game.
These are "if / else" statements. What they check is if a certain condition is true, then one outcome will happen, and if not, a different outcome will happen.
Here you see the code checking if the grass was cut, and the trees were cut down. In all different combinations, a different outcome occurs. For instance, if neither the grass nor the trees were cut, it send you to a world which still contains both, but if you cut down the grass and the trees, it sends you to a world that has neither.
And those are three main components I used to make my game!
Thank you for reading to the end, I hope you learned something, and go out and make your own video game.
Have fun!