Time for action — creating forces
If we just let the ball drop straight down, the game would become very boring and not all green pegs would be hit. We are therefore going to set up the ball launcher, peg, bucket movements, and forces. We'll also create some basic game structure events.
1. To start, create an
Always
event in theGame
group. The first action for this will be for theBucketCatch
object and is calledSet position
.2. Enter the X and Y of
Bucket.X
andBucket.Y - 73
(otherwise known as the distance between them, as we measured in the last topic).3. Add the action for rotating the ball launcher to the mouse within the angle range of
10
and170
degrees. Choose the action Set angle for theBallLauncher
object and enterClamp(Angle(BallLauncher.X, BallLauncher.Y, MouseX, MouseY), 10, 170)
as the text.4. Add an action for the
Physics
behavior of theBucket
object. Choose Set velocity and enterBucket.Value('Direction') * 3
as the X component and0
as the Y component. This will cause...