The batting game in Scratch
batting game
Batting games sound simple. A ball comes at you, you swing at the right moment, done. But open up the projects collected here and the range inside is wild.
The first thing you notice is the pitch variety. Fastball, slider, forkball, knuckle curve — 13 types, 17 types, no problem. Under the hood, some projects store speed, movement and break as variables and calculate where a “glide to x: y:” block should land. Others just nudge x and y a little at a time and let that read as a curveball. Same pitch name, completely different build.
The hitting side is where it gets good. Some projects check whether the ball touched the bat and call it a day. Others feed distance from the sweet spot, swing timing and the gap from the strike zone into one formula that decides how far the ball flies. One reads the color under the batted ball to tell grass from dirt from outfield wall and swaps the landing sound to match, with all nine fielders chasing it down and throwing to a base. Another is an 81-sprite recreation of all 30 MLB teams.
Here to play? Start with the ones that have level select and custom modes. Here to build? The hit detection and distance formulas are worth reading line by line. Here for sounds? A couple of these have libraries you can borrow.
#01 Spi-Batting A Updated
- 176
- 179
- 38,611
- ©
- 2023.8.17
Looks like you just slide the bat with your mouse, but the moment you connect the math gets wild. Distance from the sweet spot, the pitch's weight, how early or late you swung, and how far the ball sat from the strike zone all get crunched together into the hit distance, while the vertical gap sets the launch angle, so weak grounders and gorgeous arcs both come out naturally. There are 13 pitch types, and once you connect the fielders chase it down and throw based on their own defensive ratings, errors included. You can pick click-to-swing or hold-and-release, and even turn your own custom pitcher into a text code to share with friends.
#02 That platypus MLB baseball has turned into an endless batting game.
- 36
- 37
- 2,236
- ©
- 2023.9.22