Discuss Scratch

Patrickwitt2285
New Scratcher
4 posts

Pong AI

Hello I am making a Pong Game for my computer science game, and I need help with the AI. How do I make the AI follow the ball?
lederniersamourai
Scratcher
500+ posts

Pong AI

You can use the starter project made y the scratcher team to understand how pong works
http://scratch.mit.edu/projects/10128515/

In the aumatic plyer, you should put a forever with a set x to te value of the x of the ball
Then you have to weaken your automatic player with one of more artefacts:
1) add some small delay with wait 0.' secs or less
2) move the x position of the utomatic plyer with a random number around the x position of the ball

Last edited by lederniersamourai (Sept. 26, 2014 17:12:37)

stickfiregames
Scratcher
1000+ posts

Pong AI

This would be a simple way to make it move:
ifyposition-y positionofball>10thenchangeyby-2elseifyposition-y positionofball<-10thenchangeyby-2
MaxRG_The_Penguin
Scratcher
7 posts

Pong AI

stickfiregames wrote:

This would be a simple way to make it move:
ifyposition-y positionofball>10thenchangeyby-2elseifyposition-y positionofball<-10thenchangeyby-2
didnt work
223969
Scratcher
16 posts

Pong AI

if y position of ai less than y pos of ball than change y by 10
if y position of ai more than y pos of ball than change y by -10
Zizzle8383
Scratcher
100+ posts

Pong AI

Please dont necropost, this is from 2014 make your own topic if you need help.

Last edited by Zizzle8383 (July 2, 2019 01:22:42)

madtiger999
New Scratcher
1 post

Pong AI

stickfiregames wrote:

This would be a simple way to make it move:
ifyposition-y positionofball>10thenchangeyby-2elseifyposition-y positionofball<-10thenchangeyby-2
its trash
deck26
Scratcher
1000+ posts

Pong AI

madtiger999 wrote:

stickfiregames wrote:

This would be a simple way to make it move:
ifyposition-y positionofball>10thenchangeyby-2elseifyposition-y positionofball<-10thenchangeyby-2
its trash
Why are you commenting on a post from 2014 though? Please don't necropost.
marktestep
Scratcher
1 post

Pong AI


why are you responding to a response responding from a post from 2014
ProgramingBeginner
Scratcher
74 posts

Pong AI

marktestep wrote:

why are you responding to a response responding from a post from 2014
Because necroposting is not allowed!
N3rdyPineapple
New Scratcher
1 post

Pong AI

add a forever loop around the whole thing and it will work
Redcarred2_2
Scratcher
4 posts

Pong AI

It only sometimes works, but

StartforeverglideSpeedsecsYourBall

Then After that

StartofthechainforeversetxtoThecoordinateofthewayyoudontwanttomove

Last edited by Redcarred2_2 (Oct. 8, 2019 22:01:07)

kooldoofus
Scratcher
3 posts

Pong AI

whenclickedforevergotox:fooy:ypositionofball

This might be a bit late. Also this is my first post so I really don't know how to do this.
Hope this is helpful!

This is an example of this made by my friend. If there were no glitches, it would be impossible to score against AI. But it can be used for like a training in a game

Last edited by kooldoofus (Dec. 18, 2019 00:47:43)

FallingTower
Scratcher
2 posts

Pong AI

deck26 wrote:

madtiger999 wrote:

stickfiregames wrote:

This would be a simple way to make it move:
ifyposition-y positionofball>10thenchangeyby-2elseifyposition-y positionofball<-10thenchangeyby-2
its trash
Why are you commenting on a post from 2014 though? Please don't necropost.

Snazzy_P
Scratcher
1 post

Pong AI

scratchblockswhenclickedforeverwait0.09secssetyto y positionofBall/scratchblocks

Last edited by Snazzy_P (May 13, 2020 12:51:36)

CreatorBN
Scratcher
100+ posts

Pong AI

Snazzy_P wrote:

scratchblockswhenclickedforeverwait0.09secssetyto y positionofBall/scratchblocks
Don't necropost.
jacobitsme3
Scratcher
1 post

Pong AI

yey look at this conversation (this wont help ok)
sayyeyfor2secs

Last edited by jacobitsme3 (Sept. 9, 2020 19:56:37)

duhmp
New Scratcher
1 post

Pong AI

stickfiregames wrote:

This would be a simple way to make it move:
ifyposition-y positionofball>10thenchangeyby-2elseifyposition-y positionofball<-10thenchangeyby2
there put a forever around it and your good to go it was two negatives one should have been positive

diamondwolfy011
Scratcher
4 posts

Pong AI

hello there
diamondwolfy011
Scratcher
4 posts

Pong AI

duhmp wrote:

stickfiregames wrote:

This would be a simple way to make it move:
ifyposition-y positionofball>10thenchangeyby-2elseifyposition-y positionofball<-10thenchangeyby2
there put a forever around it and your good to go it was two negatives one should have been positive

Powered by DjangoBB