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

#1 2012-09-21 17:55:52

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

It works the first 15 times...

I was working on a pong game, and the script I have works about the first 20 times it falls, then I have to manually click the green flag (although I have something broadcasting the green flag)

The first script:

when gf clicked

go to x: (0) y: (0)
set [xv v] to [0]
set [yv v] to [0]
forever  

change [yv v] by (-0.3)
set [xv v] to ((xv) * (0.99))
change x by (xv)
if <touching [edge v]?> 

set [xv v] to ((-0.5) * (xv))
if <(x position) > [0]>

set x to (230)
else

set x to (-231)
end

end

change y by (yv)
if <(y position) < [-129]> 

set [ystoragevar v] to (y position)
set y to (-128)
if <touching [Paddle v]?>

point towards [Paddle v]
turn ccw (180) degrees
change [xv v] by ((8) * ( [sin v] of (direction)))
set [yv v] to ((8) * ( [cos v] of (direction)))
else

set y to (ystoragevar)
end

end

if <touching [edge v]?> 

broadcast [meh v]
stop script
end

end

And the second script (attempting the green flag workaround):

when I receive [meh v]

broadcast [scratch-startclicked v]
wait (0.3) secs
Can anyone help?


........................................................................................................................................................................................................................................

Offline

 

#2 2012-09-21 17:58:51

coinman
Scratcher
Registered: 2011-04-19
Posts: 500+

Re: It works the first 15 times...

scratch-start clicked does not work online so don't use it


Click the picture below to play my best game yet, Snowball Fight!
http://scratch.mit.edu/static/projects/coinman/3221194_sm.png

Offline

 

#3 2012-09-21 18:00:51

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Re: It works the first 15 times...

I know, it was just for testing. Got any idea whats wrong?


........................................................................................................................................................................................................................................

Offline

 

#4 2012-09-21 18:02:51

jamiewinter
Scratcher
Registered: 2012-08-19
Posts: 100+

Re: It works the first 15 times...

what are you actually trying to do


Check out my youtube channel http://www.youtube.com/user/axelregulator/featured

Offline

 

#5 2012-09-21 18:03:57

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Re: It works the first 15 times...

Make a pong game with gravity...


........................................................................................................................................................................................................................................

Offline

 

#6 2012-09-21 18:06:34

jamiewinter
Scratcher
Registered: 2012-08-19
Posts: 100+

Re: It works the first 15 times...

no not that just with this one script
what are you trying


Check out my youtube channel http://www.youtube.com/user/axelregulator/featured

Offline

 

#7 2012-09-21 18:17:14

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Re: It works the first 15 times...

jamiewinter wrote:

no not that just with this one script
what are you trying

The physics... It's kinda obvious if you actually look at the script...


........................................................................................................................................................................................................................................

Offline

 

#8 2012-09-21 18:19:05

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Re: It works the first 15 times...

Oops sorry for snapping  tongue . It's been a long day.


........................................................................................................................................................................................................................................

Offline

 

#9 2012-09-21 20:20:53

zubblewu
Scratcher
Registered: 2011-02-17
Posts: 1000+

Re: It works the first 15 times...

Hmm, it works in the flash player but not downloaded...


........................................................................................................................................................................................................................................

Offline

 

Board footer