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

#1 2010-06-25 22:10:01

explosivedude
Scratcher
Registered: 2010-06-22
Posts: 64

how do i make the computer play one paddle in pong?

im making a pong game and i am trying to figure out how to make the second paddle be played by the computer but i cant figure it out can you help me?

Offline

 

#2 2010-06-25 22:13:42

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: how do i make the computer play one paddle in pong?

Code:

When Green Flag Clicked
forever
if <(x position) > ([x position] of [ball])>
  change x by (-2)
else
  change x by (2)
end

Assuming your paddles are on the top and bottom of the screen, that should work. Otherwise, change all "x positions" to "y position."

Offline

 

#3 2010-06-25 22:27:48

explosivedude
Scratcher
Registered: 2010-06-22
Posts: 64

Re: how do i make the computer play one paddle in pong?

can u put that in blocks please?

Offline

 

#4 2010-06-27 18:31:56

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: how do i make the computer play one paddle in pong?

mine does that...

Loco's Pong


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

Board footer