#81. Step by step
When the green flag is clicked, this script runs. What is the cat's **x** position at the end?
when green flag clicked go to x: (-65) y: (0) point in direction (90) move (6) steps move (16) steps
import math # The sprite's (cat's) position, direction and size x_pos = 0 y_pos = 0 direction = 90 # When the green flag is clicked x_pos, y_pos = -65, 0 direction = 90 x_pos += 6 * math.sin(math.radians(direction)) y_pos += 6 * math.cos(math.radians(direction)) x_pos += 16 * math.sin(math.radians(direction)) y_pos += 16 * math.cos(math.radians(direction))
// The sprite's (cat's) position, direction and size let x_pos = 0, y_pos = 0, direction = 90; // When the green flag is clicked x_pos = -65; y_pos = 0; direction = 90; x_pos += 6 * Math.sin(direction * Math.PI / 180); y_pos += 6 * Math.cos(direction * Math.PI / 180); x_pos += 16 * Math.sin(direction * Math.PI / 180); y_pos += 16 * Math.cos(direction * Math.PI / 180);
💡 Not sure? Build it in Scratch and try it out.