Discuss Scratch

PawtucketSox
Scratcher
13 posts

Pitcher and Batter

I am currently making a baseball game and I need to know how to have a pitcher choose pitches, locate the pitches, etc.

I also need the batter to move where to hit, etc.
mstone326
Scratcher
1000+ posts

Pitcher and Batter

You could use the arrow keys as the old baseball games used to do. Up and pitch is changeup, down and pitch is fastball, just pitch is an inbetween speed. Then use the left and right arrows to move the ball in flight home.

The batter could hit based on where contact was. If the ball is hit in front of home plate have it go to the pull side if the hitter, if it is in a middle of home the ball could go gap to gap, then if the ball is behind home plate then the ball should head to the opposite field side.

Here is one of the first games I made years ago. The code is terrible but the game works.
https://scratch.mit.edu/projects/49166150/

Basically here is the batter map (all right hand hitters). We have weak pull, strong pull, strong gap to gap, strong opposite, weak opposite.

(swing and miss)
wp
sp
gtg (this is the top of home plate)
so
wo
(swing and miss)




Last edited by mstone326 (Oct. 27, 2019 14:55:11)

PawtucketSox
Scratcher
13 posts

Pitcher and Batter

Ok.


What about if I'm batting and the pitcher is a CPU?
mstone326
Scratcher
1000+ posts

Pitcher and Batter

Create a variable to decide what pitch type they are going to throw. Then have them throw that pitch. For instance.

Pitch type = curveball
repeat until touching edge or bat
move pitch speed steps
turn 2 degrees (or whatever works)
Zacho24
Scratcher
4 posts

Pitcher and Batter

how do I have the ball get hit when I swing?

322121124e
Scratcher
1 post

Pitcher and Batter

how do i make a batter run when the ball is hit

Powered by DjangoBB