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

#1 2011-10-16 09:00:20

Hammerzzz
New Scratcher
Registered: 2011-10-15
Posts: 3

Trouble with pong

Whenever I start up the game, the Paddle races up the screen.


Code:

When I receive "Game Start"
--------------------------------------
show
--------------------------------------
go to x: 202 y: 15
-------------------------------------
set Y velocity to 0
-------------------------------------
Forever
-------------------------------------
change y by Y Velocity
-------------------------------------
Set Y velocity to Y velocity * 0.5
-------------------------------------
if on edge bounce
-------------------------------------
If key Up Arrow pressed?
Chance Y Velocity by 3
-------------------------------------
If key down arrow pressed?
Change Y velocity by -3
-------------------------------------

Offline

 

#2 2011-10-16 09:16:57

Hammerzzz
New Scratcher
Registered: 2011-10-15
Posts: 3

Re: Trouble with pong

bump

Offline

 

#3 2011-10-16 09:29:29

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Trouble with pong

Your numbers are waaaaaaaaaay too high.  Even with the *.5 I think.  Try something more like
When I receive "Game Start"
--------------------------------------
show
--------------------------------------
go to x: 202 y: 15
-------------------------------------
set Y velocity to 0
-------------------------------------
Forever
-------------------------------------
change y by Y Velocity
-------------------------------------
Set Y velocity to Y velocity * 0.9
-------------------------------------
if on edge bounce   <----------------This won't do anything...it's only for direction
-------------------------------------
If key Up Arrow pressed?
Chance Y Velocity by .5
-------------------------------------
If key down arrow pressed?
Change Y velocity by -.5
-------------------------------------


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#4 2011-10-16 09:33:38

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Trouble with pong

It would help if you uploaded it so we could see it.  I just copied your script and it worked fine for me.  I'd guess something in another sprite or a different script (if there is one) for the paddle, that script looks fine.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#5 2011-10-16 14:05:51

Hammerzzz
New Scratcher
Registered: 2011-10-15
Posts: 3

Re: Trouble with pong

http://scratch.mit.edu/projects/Hammerzzz/2086625
Here it is.

Offline

 

#6 2011-10-16 15:57:19

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: Trouble with pong

Your script in the ball sprite is the culprit.  It is changing the Y velocity variable by 3.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

Board footer