Showing posts with label Sprites position. Show all posts
Showing posts with label Sprites position. Show all posts

Tuesday, June 16, 2015

Pac-Man is Chasing my Planet!

My child's class was recently introduced to Cartesian coordinates in Math. And in our coding class, we have been practicing interactive programming for the last few weeks. So, I thought of putting together a very simple template that  combines both the concepts, that the kids could then remix...  Pac-Man is Chasing my Planet! was the result... took me less than 10 minutes to put together and the kids loved it.

We went through the Pac-Man template code as a group & discussed the use of the XY coordinates. I showed the kids how the XY coordinates displayed under the Scratch animations area change, as I move the cursor around on the screen. Our discussion then proceeded along the following lines:


  • If I wanted my sprite (the planet, in this case) to move anywhere the cursor moves, what values should I use for the sprite's X and Y coordinates? 
  • The above point was also a good place to talk about variables, and how the change of the cursor position is always reflected in the planet's position. 
  • Should I move the planet around for just a few times or all the time? What kind of a loop should I use here?
  • How can I make Pac-Man always follow the planet? Which loop should I use? 
  • What values should I use for Pac-Man's X and Y coordinates? 
  • Here, the kids quickly saw that without a small degree of separation between the coordinate values of the planet & Pac-Man, the two sprites overlap each other.
  • BTW, the "if-else" clause was purely optional, for those to wanted to add another level to their game. The majority went with just a "go to x() y()"
  • And finally, the interactive part of the game... I put in the requirement that there should "a key press" or "the green flag click" to make the game start, and something similar to end the game. 

In the next one hour, the children came up with multiple variations of the game, making their own sprites and designing various versions of tag... All in all, a very fun class for them and me to wrap up the school year.

Happy Summer!!

Saturday, April 11, 2015

A Food Chain: Made from Scratch

Here is a Scratch project that my 9-year-old put together, depicting a Food Chain in the Northern Temperate Forests. An avid lover of animals, this project combining learning in two areas, was a very fun one for him. I loved the fact that he could create a presentation about an ecosystem, while combining his learning with art, storytelling and programming. A good example of an interdisciplinary project...

This project took him a few weeks to create, including the time for the initial research about the ecosystem. We went through the project in small steps, designing the various stages... deciding on the characters in the food chain, the order in which they appear, special effects if any, etc. As you can see from the progression along the length of the project, more special effects started appearing as he learned more about creating animations.

Major learnings for my child were:
  • Using "show" and "hide" instructions to make characters appear and disappear in the story.
  • Timing -- using the wait statement and figuring out how long to wait, before each sprite makes its appearance on screen.
  • Animation: Creating multiple costumes for a sprite and alternating between them to create the effect of movement.
  • Changing the size of a sprite to create the visual effect of distance.
  • Creating and using different backdrops at various points to create the effect of multiple scenes.
  • Using XY coordinates to decide on positions of the sprite at various points of the presentation.







Note:

This project simulating a food chain, could potentially be a Grade 5 class project. Food chains are part of the Grade 5 syllabus; the description can be found here on the NGSS (Next Generation Science Standards) website. The students are expected to  "develop an understanding of the idea that plants get the materials they need for growth chiefly from air and water. Using models, students can describe the movement of matter among plants, animals, decomposers, and the environment and that energy in animals’ food was once energy from the sun".