By Bart Huylebroeck, CoderDojo boot camp coach
Scratch won't Move?
If you want to move your cat to the left with the arrow keys, this is a commonly made mistake:
Sounds logical, right? If the key is pressed, move in the right direction... So why doesn't it work?
Be sure to add a "forever" loop:
Because ...The "if" block checks the right arrow key only once, at the very moment the green flag is clicked. What you really want, is for the script to check the arrow repeatedly. Maybe even ... "forever" ;-)
Projectiles won't Kill Enemy Sprites?
Don't ...In a shooter game, you often work with bullet sprites that hit enemy sprites. Sometimes when they hit each other, you may see one disappear but the other survives.
Do ...Add a pause before deleting a clone. This also gives you the opportunity to show a different costume, indicating that the projectile explodes or the enemy dies.
Because ...Sometimes, a projectile disappears before the enemy realizes it's been hit (or vice versa). If you pause a little bit (.1 second should be plenty) before deleting the clone, that will give the other sprite the opportunity to realize it's been hit as well. Changing the costume is a bonus, but from a gameplay perspective it's important to make the game see more responsive.
Center of your sprite
Sprite not moving to where you want it to?
Maybe it's rotating around a weird spot?
Click on the "costumes" tab so you see the drawing of your sprite.
Next, find the little grey cross in your drawing. That's where Scratch thinks the middle is.
Let's move it. Find the button in the top right with the cross on. If you click it, a giant crosshair will appear on your drawing.
Click the crosshair on a more sensible spot in your sprite. The drawing will move a little bit, but you'll notice the gray cross is now better placed. And my super-duper ninja now makes proper saltos!
Method 1: Pause
Pauzes are simple and work well for 2 partners, and if you keep the duration of the text bubbles constant. This might become a headache soon if you want three people talking, or if some of the text bubbles should appear for a longer time, because adding all the numbers becomes more difficult.
Method 2: Messages
Method 3: Variable
But that's a lot of blocks, isn't it?
Method 4: The Director
There is a mistake in one of the codes? Who can find it?
Damn you Maarten, for checking my code and finding a bug ;-)ReplyDelete