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

#1 2010-10-22 14:23:29

car1977
Scratcher
Registered: 2010-10-17
Posts: 20

Sooo Cccoonnnnfffuussseed

OK. Im making a pong game and there's one playerand two player. On one player I want it so the CPU follows the ball but only moves the Y position. HEEELLLPPPP

Last edited by illusionist (2010-10-22 18:38:54)

Offline

 

#2 2010-10-22 14:48:17

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Sooo Cccoonnnnfffuussseed

next time, please don't put sooooooooooooooooooo cccccccoooooonnnn... just put so confused. anyways, for the computer, put
forever
|if #ofpeopleplaying=1
||go to [x: x position, y: y position of ball]
---------

look at this: My Pong Project

Offline

 

#3 2010-10-22 16:47:38

GraemeK
Scratcher
Registered: 2010-06-14
Posts: 73

Re: Sooo Cccoonnnnfffuussseed

OR...

http://scratchr.webs.com/images/yball.gif
_________________________
See my project Paddleball v2

Last edited by GraemeK (2010-10-22 16:57:17)


http://internetometer.com/image/13865.png

Offline

 

#4 2010-10-22 16:55:58

martianshark
Scratcher
Registered: 2008-03-24
Posts: 1000+

Re: Sooo Cccoonnnnfffuussseed

aka:

<when green flag clicked>
<forever>
<set y to(  ([Y position] of [ball])
<end>


http://img.geocaching.com/stats/img.aspx?txt=martianshark&amp;uid=e6cdc2c8-2476-4abd-9994-27f857396579&amp;bg=1

Offline

 

#5 2010-10-22 17:02:39

GraemeK
Scratcher
Registered: 2010-06-14
Posts: 73

Re: Sooo Cccoonnnnfffuussseed

martianshark wrote:

aka:

<when green flag clicked>
<forever>
<set y to(  ([Y position] of [ball])
<end>

Basically, what I said only messier.
(No offence, I'm talking about the BB code blocks


http://internetometer.com/image/13865.png

Offline

 

#6 2010-10-22 18:36:27

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: Sooo Cccoonnnnfffuussseed

ummm... guys, who wants to play pong vs. an unbeatable AI? that's no fun.
try this.
[blocks]
<if><( y of ball <>> y of CPU )>
<change y by( 3)
<end>
[/blocks]
and the opposite for if ball < CPU
hope this helps!  smile


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#7 2010-10-22 18:50:35

HD123
Scratcher
Registered: 2009-12-05
Posts: 500+

Re: Sooo Cccoonnnnfffuussseed

16Skittles wrote:

ummm... guys, who wants to play pong vs. an unbeatable AI? that's no fun.
try this.
[blocks]
<if><( y of ball <>> y of CPU )>
<change y by( 3)
<end>
[/blocks]
and the opposite for if ball < CPU
hope this helps!  smile

The full script would look like this:

http://imageupload.org/dm-1512877878156.png

Last edited by HD123 (2010-10-22 18:50:58)


~~HD123~~
Treat others as you want to be treated. |  big_smile  | http://i.imgur.com/OaNrY.gif | http://blocks.scratchr.org/libstatus.php?user=HD123&amp;online=http://lemonfanatic.webs.com/ONLINE.png&amp;offline=http://lemonfanatic.webs.com/OFFLINE.png

Offline

 

#8 2010-10-22 18:52:04

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: Sooo Cccoonnnnfffuussseed

yup! that looks about right!
the problem with the first scripts is that it is physicaly impossible to score a single point.


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#9 2010-10-22 19:12:23

HD123
Scratcher
Registered: 2009-12-05
Posts: 500+

Re: Sooo Cccoonnnnfffuussseed

Or you could do this:
http://imageupload.org/?di=412877891089

Last edited by HD123 (2010-10-22 19:14:20)


~~HD123~~
Treat others as you want to be treated. |  big_smile  | http://i.imgur.com/OaNrY.gif | http://blocks.scratchr.org/libstatus.php?user=HD123&amp;online=http://lemonfanatic.webs.com/ONLINE.png&amp;offline=http://lemonfanatic.webs.com/OFFLINE.png

Offline

 

#10 2010-10-22 19:59:43

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Sooo Cccoonnnnfffuussseed

if you do what i did, do http://scratchr.webs.com/images/yball.gif (graemek's) but do it every second so it'll be possible to defeat.

Last edited by kayybee (2010-10-22 20:00:04)

Offline

 

Board footer