This blog is designed to promote mechatronics (often associated with robotics) to kids. My target age is 8 and up. The idea is to cover basic programming, electronics and 3D design/modeling required for kids to learn about and build simple (low cost) robots.
Tuesday, 25 August 2015
Week10
Want to post a comment ? - click on the "Week10" link Text above and a comment box will appear at the bottom of the screen
Tuesday, 11 August 2015
Week 9 (11 Aug)
This week we discussed scrolling games. Such games are particularly important for platform based games which many students are familiar with. We had a demonstration of a great "potato" run game and then discussed the basics of scrolling in Scratch. The key concepts are:
1) a backgound is not used, instead a whole screen is used as a sprite that can be moved
2) the player is basically stationary, but that the screen sprite moves to the left or right
3) multiple scren sprites can be used to may a very long scrolling game, but you need to be carful to match the items and color of each screen sprite used
The basic process is demonstarted below that was shown to the stduents this week. Students were actively involved with many starting , and some completing a basic game in under an hour. We even had someone scrooling up and down !!!. Keep going and let me know what your create . Please post comments.
Scrolling game concepts. See Figure 1,2 and 3 for an outline to creat a basic scrolling game. I have used the Cat and changed the costume to make him look like he is moving , but only when the arrow keys are pressed. Create a ScrollX variable. This is used to set the current location of the screen sprite. Change the ScrollX variable by a NEGACTIVE number when moving to the right and a POSITIVE number when moving to the left
Figure 2 shows the Screen Sprite and the blocks required in this sprite. By setting the x-position of the screen sprite to ScrollX, the Screen Sprite moves in the OPPOSITE direction to the direction the arrow key is pressed !! This gives the illusion that the cat is moving.
Figure 3 shows the 2nd Screen Sprite (Sprite3) and the blocks required in this sprite. In this code 480 is added to the ScrollX value. Note the 480=2*240, which is the entire with of the screen. So when the ScrollX value reaches say -490 (because you pushed the right array key many times), the Sprite3 is now centered at x=-490 + 480 = -10. This is on the screen and very near the enter, so the 2nd Screen Sprite (Sprite3) is now in the center of the screen. We can keep repeating this by adding more screens. I will think of an easy way to explain how these screen can be looped around to may the game appear to be infinite and get back to you. An example of this Scrolling example is shown as an animation in Figure 4
1) a backgound is not used, instead a whole screen is used as a sprite that can be moved
2) the player is basically stationary, but that the screen sprite moves to the left or right
3) multiple scren sprites can be used to may a very long scrolling game, but you need to be carful to match the items and color of each screen sprite used
The basic process is demonstarted below that was shown to the stduents this week. Students were actively involved with many starting , and some completing a basic game in under an hour. We even had someone scrooling up and down !!!. Keep going and let me know what your create . Please post comments.
Scrolling game concepts. See Figure 1,2 and 3 for an outline to creat a basic scrolling game. I have used the Cat and changed the costume to make him look like he is moving , but only when the arrow keys are pressed. Create a ScrollX variable. This is used to set the current location of the screen sprite. Change the ScrollX variable by a NEGACTIVE number when moving to the right and a POSITIVE number when moving to the left
Figure 1: Sprite 1 (The cat or other object moving through the scene). The blocks are shown to the right. |
Figure 2 shows the Screen Sprite and the blocks required in this sprite. By setting the x-position of the screen sprite to ScrollX, the Screen Sprite moves in the OPPOSITE direction to the direction the arrow key is pressed !! This gives the illusion that the cat is moving.
Figure 2. Left most Screen Sprite (Sprite4) and the blocks required in this sprite. |
Week 8 (4 Aug)
This week we discussed logic statements in Scratch and in particular AND lofic. This is illustrated in Figure 1.
We can use this kind of logic to determine if two events are true. I asked the students this week to try to use an AND statement in their code. An example application might be an game where you need to find specific items to completed specific tasks. These items can be collected by a player and these items are sometimes called pick-ups. This is particularly important when creating role-playing games (RPG). For example, see the list shown in Figure 2a.
Figure 1. A possible use of the AND logic in Scratch. AND logic table is shown. Both A AND B must be true for the combined statement to be true and the block within the If statement run. |
Subscribe to:
Posts (Atom)