ScratchData LogoScratchData
Back to Brontosplachna's profile

Steering toward a point, 3 different ways

BRBrontosplachna•Created May 4, 2021
Steering toward a point, 3 different ways
15
11
126 views
View on Scratch

Instructions

The cars will go to the mouse pointer as best they can given the current turning radius. The cars never stop, so you can leave the mouse pointer anywhere and the cars will circle it. Steering is useful for sprites that have momentum, for orbiting planets, for drawing smooth curves, etc.

Description

The cars are coded three different ways. The green car is led around by an invisible sprite, so green has the least code and no math. The blue car does its calculations using angles and directions. So, the code has to avoid problems with the arctangent function and with adding angles. But the blue car behaves the most reasonably. The red car used vector math, including vector normalization. Vector math is often needed for games that are %100 pen or otherwise can't use many Scratch commands.

Project Details

Project ID525420053
CreatedMay 4, 2021
Last ModifiedMay 6, 2021
SharedMay 6, 2021
Visibilityvisible
CommentsAllowed