Page 213 - Scratch Programming Playground
P. 213
You might be wondering why we didn’t reuse code from
previous games in which we used the change x by or change
y by block. In this program, holding down one of the WASD
keys adds to or subtracts from the x velocity and y velocity
variables. Then the code at the bottom of the script changes
the x and y position of the Spaceship sprite by using the values
in these variables. even after the player lets go of the key, the
variables still reflect the updated position, so the spaceship
continues to move.
ASTeroID BreAker . . . In SpACe! 187

