Second and third picture are from movingdog and fourth picture is from spritesheet animation
Find a spritesheet that contains images about character moving in four different directions. For example, it can look similar to the following (of course, you can also use the below cxample spritesheet if you like) 2. (20 points) Based on movingDog.zip and spriteSheetAnimation.pde (in Blackboard, Course Content Example Programs), Write a Processing program to create an animation that can move the animated character with key pressings in the game window. The character images are those read from the spritesheet 3. (30 points) Different directions should have different animations For example, if we use the above shown spritesheet, when you press the left key, you will only see the animation created from the four images in the second row Simlarly, pressing the up key will show a character moving up. Note when you release the key, the animation should stop. Hint: in sprit spritesheet.get (x, Y. W.H),where x is a horiaontal stride of the character's width, and y is a vertical stride of the character's height. So, when draw) is itcrated, we can pick up every small character image from the whole spriteshoet with a horizontal stride andlor a vertical stride (vertical stride only takes place when we finish one row of character images and switch to the next row). In this assignment, if you press an armow key, say. LEFT, you only pick up every small character image from the 2nd row with horizontal strides, ie. you can use the following pde, we get sprite images using-P Image ?prite- if (keyCodeLEFT&&keyPreasedtruel I sprite spritesheet.get (xH, ,) You can write similar statements for moving in the other three directions. 4. (30 points) Carefully design the screen layout and add text to your game window, When the character reaches the boundary of the game world, ie. one of the four walls, he will stop and your game will display the text such as "Stop". When he leaves the boundary, the text will change to something else such as "This is the game world . (20 points) When the character reaches the boundary, he will shrink half in both x and y directions (ie. become 1/4 of its original size). Due to scaling, you may notice that he also changes his position. Try to make the character stay at the same position before and after scaling, It's ok if there may still have a small horizontal difference, because the character images are not tightly packed in the spritesheet (for example, in the above spritesheet a character sprite keeps a distance to his left and right neighbors). We don't want the character's position to have big difference in vertical before and after scaling Find a spritesheet that contains images about character moving in four different directions. For example, it can look similar to the following (of course, you can also use the below cxample spritesheet if you like) 2. (20 points) Based on movingDog.zip and spriteSheetAnimation.pde (in Blackboard, Course Content Example Programs), Write a Processing program to create an animation that can move the animated character with key pressings in the game window. The character images are those read from the spritesheet 3. (30 points) Different directions should have different animations For example, if we use the above shown spritesheet, when you press the left key, you will only see the animation created from the four images in the second row Simlarly, pressing the up key will show a character moving up. Note when you release the key, the animation should stop. Hint: in sprit spritesheet.get (x, Y. W.H),where x is a horiaontal stride of the character's width, and y is a vertical stride of the character's height. So, when draw) is itcrated, we can pick up every small character image from the whole spriteshoet with a horizontal stride andlor a vertical stride (vertical stride only takes place when we finish one row of character images and switch to the next row). In this assignment, if you press an armow key, say. LEFT, you only pick up every small character image from the 2nd row with horizontal strides, ie. you can use the following pde, we get sprite images using-P Image ?prite- if (keyCodeLEFT&&keyPreasedtruel I sprite spritesheet.get (xH, ,) You can write similar statements for moving in the other three directions. 4. (30 points) Carefully design the screen layout and add text to your game window, When the character reaches the boundary of the game world, ie. one of the four walls, he will stop and your game will display the text such as "Stop". When he leaves the boundary, the text will change to something else such as "This is the game world . (20 points) When the character reaches the boundary, he will shrink half in both x and y directions (ie. become 1/4 of its original size). Due to scaling, you may notice that he also changes his position. Try to make the character stay at the same position before and after scaling, It's ok if there may still have a small horizontal difference, because the character images are not tightly packed in the spritesheet (for example, in the above spritesheet a character sprite keeps a distance to his left and right neighbors). We don't want the character's position to have big difference in vertical before and after scaling