Discuss Scratch

djgamer98
Scratcher
12 posts

need halp

AI script for pong? thanks.
Thepuzzlegame
Scratcher
1000+ posts

need halp

Here's a very basic version. Put this script into the enemy paddle:
when green flag clicked
forever

set y to ([y position v] of [ball v])
end

hi!
carrot2pufferfish
Scratcher
10 posts

need halp

If you want to acually have a chance of winning instead going for as long as you can, use this script:
when green flag clicked
forever

change y by ((([y position v] of [ball v]) - (y position)) / (20))
end

when [ rocks eaten v] > (10)
broadcast [break all teeth v]
Blueinkproductions
Scratcher
1000+ posts

need halp

You should look at the remixes for this project.

Generation 2: the first time you see this copy and paste it on top of your sig in the scratch forums and increase generation by 1. Social experiment.
____                  _____  _______              
| \ | | | | | |\ | | /
|___/ | | | |__ | | \ | |/
| \ | | | | | | \ | |\
| | | | | | | | \ | | \
|___/ L____ \___/ |_____ ___|___ | \| | \
PRODUCTIONS





















































Here's a hint: support = support.

<shameless self promotion>follow me! follow me! follow me! love my stuff! love my stuff! love my stuff! follow me! love my stuff! remix my stuff! follow me! follow me! </shameless self promotion>
djgamer98
Scratcher
12 posts

need halp

thanks everyone im doing the project now
MegaApuTurkUltra
Scratcher
1000+ posts

need halp

Making the AI perfect won't work because you will never win. Making it lag behind the ball won't work because it's too predictable. Instead, you need to code in some random “mistakes”.
forever
if <(pick random (1) to (10))>(difficulty)>
make mistake and go somewhere random
else
lag slightly behind ball. Maybe a random amount
end
end
Also next time try using a helpful title. “Need halp” doesn't cut it. Try "need help with ai script for pong"

$(".box-head")[0].textContent = "committing AT crimes since $whenever"

Powered by DjangoBB