CSD Unit 3 Lesson 11 Conditionals


#1

I am having a difficult time understanding this activity. Both scale and visible are introduced with very little explanation. Rather then worrying about 2 newly introduced codes; I sought to have students change the size of the balloon by incrementing sprite.x and sprite.y as we had just practiced that with the growing apple example. I’m thinking that if I want to change x and y at the same time I can only accomplish this using scale.
Another thing I don’t understand is establishing the “Watcher” and having it look for the condition of scale. Can someone help?
Diane Neville


#2

I’ll give it a shot. scale gives you a convenient way to change the size of the sprite. mySprite.scale = 1; would create a sprite that is the same as the sprite’s defined size. Anything less than 1 makes it smaller (mySprite.scale = .5; would make the sprite half size. Anything greater than 1 increases the size of the sprite. (mySprite.scale = 2;) draws the sprite at twice the size.

.visible gives you a way to “hide” the sprite. By default, your sprites will be visible, but if you want to hide the sprite called myBall, you would include a block that says “myBall.visible = false;” Theoretically, this would be used to hide your sprite based on some kind of condition … or just the opposite … you could start the animation with your sprite being invisible and then after some pre-defined condition, you could make it visible by using a block: mySprite.visible = true;

The Watcher is a “debugging tool” used to watch a variable change over time. If you tell it to watch “mySprite.scale” it will continually update the console display with the size of mySprite. This allows you to “peek behind the scenes” at your variable to make sure it is behaving as you expect it.

Hope this helps a little …

Mike


#3

I think this is a great explanation!