Graphics are important part of any video game. In this lesson we’re going to learn how to do some basic sprite tasks that will give you more control over how a sprite behaves on screen. You will definitely use what you learn today in your own games.
Part A – Common Sprite and Image Options
Watch the video: 06-01-A
Watch the video: 06-01-A2
Done File: L06-01-AB-Done.gmk
Challenge 1 – Using Sprite Index
Add on to this project: 06-01-AB-Done.gmk.
Add the up and down direction to the player with the appropriate animated sprites.
Add a chest object into the room. When the player touches the chest object, it should change to an open chest sprite. If the player touches the chest again, it should change to a closed chest again. Now here’s the problem: if the player stands on top of the chest, the chest will rapidly open and close and you won’t even be able to see the changing sprites take place. Solution: Use an alarm on the chest so that it can only be opened/closed every 3 seconds. This is a nice challenge that reviews alarms! Check the solution file or video if this one stumps you.
Challenge 1 Solution
Watch the Video: 06-01-X1Solution
Donefile: L06-01-X1-Done.gmk
Challenge 2 – Growing Health
Modify the health object so that it grows bigger quickly until it is twice its normal size. Then it returns to it’s original size and the pattern repeats forever.
Now try to modify this even more! Make it so that this effect doesn’t start happening until the user clicks the health pack. So before the user clicks the health pack, it just sits there with one size. Then after clicked it starts to do size change effect on the sprite over and over. Hint: an extra variable and and an if statement will help.
Challenge 2 Solution
Solution Video: 06-01-X2Solution
Solution File: L06-01-X2-Done.gmk