Alright, so today I spent some time messing around with Scratch, wanted to see if I could whip up a quick golf game. Just something simple, you know?

Getting Started – The Basics
First thing, I opened up Scratch. Needed a place to play, so I went looking for a background. Found a decent green-looking backdrop in the library, good enough. Could’ve drawn one, but this was faster.
Then, the ball. Easy peasy. Grabbed the circle sprite, colored it white. Made it smaller, looked like a golf ball. Placed it somewhere on the green to start.
Next up, the hole. Another circle sprite, colored black, made it a bit bigger than the ball. Put it somewhere else on the green.
Making it Work – The Fun Part
Okay, how to hit the ball? I figured using the mouse would feel most natural. My idea was: click the ball, drag the mouse pointer away from the direction you want to hit, and the distance you drag sets the power. Seemed like a classic golf game mechanic.
So, I started coding that bit. Needed a `when this sprite clicked` block. Inside that, I needed to figure out the angle and power based on where the mouse pointer ended up when you let go. Used some variables to store the mouse’s starting position (on the ball) and ending position (where you release). A bit of math there to get the angle (pointing away from the mouse release point) and the distance (for power).

Making the ball move was the core thing. Once I had the angle and power calculated after releasing the mouse button, I needed the ball to actually go. I didn’t just use a `glide` block because I wanted it to slow down realistically. Instead, I used a loop (`repeat until`). Inside the loop, the ball would `move` a number of steps based on the ‘power’ variable.
Then came the friction part. The ball couldn’t just roll forever. So, inside that movement loop, I made the ‘power’ variable decrease slightly with each step. Like `change power by -0.1` or something similar. This made the ball slow down and eventually stop. Had to tweak that value a bit to make it feel right.
Finishing Touches
Winning! The ball needs to go into the hole. I used a `touching [hole sprite]?` condition inside the movement loop. If the ball touched the hole sprite, I made it stop, maybe display a “Nice Shot!” message using a `say` block, and then stop that script.
Needed to keep score too. Created a variable called `strokes`. Every time I started the aiming process (`when this sprite clicked`), I added 1 to the `strokes` variable. Simple enough.
Also added a check to make sure you couldn’t click and hit the ball again while it was still rolling from the previous shot. Used another variable, maybe called `isMoving`, set it to true when the ball starts moving and false when it stops. Only allow clicking if `isMoving` is false.

Finally, made sure the ball always started in the same spot when the green flag was clicked using a `go to x: y:` block.
End Result
So yeah, after a bit of fiddling, got a basic, playable golf hole working in Scratch. Click, drag, release, and watch the ball roll (and hopefully go in the hole!). It’s not fancy, no multiple levels or crazy physics, but it works. Fun little exercise for the afternoon.