This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-01-03 06:03:46

ttmario
Scratcher
Registered: 2009-09-30
Posts: 9

How to make a C.P.U player in Pong

can anybody help? sad

Offline

 

#2 2010-01-03 09:45:34

hamsandwitch678
Scratcher
Registered: 2008-10-15
Posts: 100+

Re: How to make a C.P.U player in Pong

Well, if you want to make him a perfect, unbeatable CPU, Just say: 

When Flag Clicked
Forever
Set Y to Y position of ball


If he needs to be beatable, try this:

When Flag Clicked
Forever
If
Y of ball is > y position
Change Y by 1 (Or whatever you want him to change by.)
Else
Change Y by -1  (Or whatever you want him to change by.)

Hope that helps!   smile


You won't get in a jam when you add a little ham because when you add meat, your life will be sweet.                     .

Offline

 

#3 2010-01-03 14:17:14

carnack
Scratcher
Registered: 2009-06-30
Posts: 100+

Re: How to make a C.P.U player in Pong

Theres also the impossible.
When flagged clicked
forever
Change Y by (Variable)

When Flag clicked
repeat until (Variable)=(Some number lower than 240/-240)
Change (Variable) by Pick random 1 to 3.  smile


http://i853.photobucket.com/albums/ab95/7x9/Carnack.png
Carnack The Bug

Offline

 

#4 2010-01-07 08:18:20

ttmario
Scratcher
Registered: 2009-09-30
Posts: 9

Re: How to make a C.P.U player in Pong

Thanks! You guys helped me alot:)

Offline

 

Board footer