Discuss Scratch

Yoshiii999
Scratcher
51 posts

"Forever" block not working with code inside

My browser / operating system: Windows NT 10.0, Chrome 80.0.3987.162, No Flash version detected


Hi! My browser is Microsoft edge chromium version 80.0.361.109 (official build) (64-bit). My operating system is Windows 10 version 1909. When I was designing a version of pong, (pong is an arcade game, and you can play it by going to Bing search and typing “pong”) and every time I try my code, (with the code in a forever block), it does my instructions once. 1 time. Every time I try it.
when green flag clicked
forever
play sound [sewing machine v]
won't work
end

define won't work
say [won't work]

Last edited by Yoshiii999 (April 12, 2020 19:10:08)

Minescratcher367
Scratcher
100+ posts

"Forever" block not working with code inside

Do you have any stop blocks, like these?
stop [ v]


when green flag clicked :: control
do nothing :: list
Yoshiii999
Scratcher
51 posts

"Forever" block not working with code inside

No. Have you played pong? My problem is that the forever loops aren't working.
Yoshiii999
Scratcher
51 posts

"Forever" block not working with code inside

It does it once.
when green flag clicked
forever
set y to (mouse y)
if <touching [ball v] ?> then
broadcast [Bounce v]

end
end
Yoshiii999
Scratcher
51 posts

"Forever" block not working with code inside

MathSnail
Scratcher
71 posts

"Forever" block not working with code inside

Maybe try the “play sound until done” block instead?
Yoshiii999
Scratcher
51 posts

"Forever" block not working with code inside

I was showing the blocks on top on purpose.
Yoshiii999
Scratcher
51 posts

"Forever" block not working with code inside

Not in my actual code. Check it at my link above.
yoyoyoyeah
Scratcher
2 posts

"Forever" block not working with code inside

Math snail is right when I was playing the project when I looked at the code and did that it worked.
when green flag clicked



when green flag clicked
forever
play sound [Sewing Machaine] until done
end
Yoshiii999
Scratcher
51 posts

"Forever" block not working with code inside

I told you! Go to my link in my other comments. If you can't find it, go here:https://scratch.mit.edu/projects/383296577/editor/ Here is a preview of my actual code:
when green flag clicked
forever

set y to (mouse y)
if <touching [Ball v] ?> then
broadcast [Bounce2 v]

end

Last edited by Yoshiii999 (April 7, 2020 16:41:37)

Yoshiii999
Scratcher
51 posts

"Forever" block not working with code inside

For the non-computer.
Yoshiii999
Scratcher
51 posts

"Forever" block not working with code inside

It never works! Below is a preview of my first draft for the computer. It does it once!
when green flag clicked
set [Random position v] to [0]
forever
change [Random position v] by (pick random (-100) to (1))
end
when green flag clicked
set y to (Random position)
forever
if <touching [Ball v] ?> then
broadcast [Bounce v]

end
end
Yoshiii999
Scratcher
51 posts

"Forever" block not working with code inside

And then I fixed it so that it got more time, but then the ball kept stopping the game. Then I fixed that, but my code is for the computer is making stay where it is the last time and now the project does nothing.



when green flag clicked
forever
change [Random position v] by (pick random (1) to (100))

end

when green flag clicked
set Y to (-50)
forever
change y by (random position)
if <touching [ ball v]> then
broadcast [bounce v]
end
end
Yoshiii999
Scratcher
51 posts

"Forever" block not working with code inside

The ball's code:


when green flag clicked
go to x [-5 v] y [-8 v]
point towards [paddle2 v]
repeat until << (x position) > [-168]> or <(x position) > [-153]>
move (5) steps
if on edge, bounce
end
stop [all v]

when I receive [Bounce v]
point towards [paddle v]

when I receive [Bounce2 v]
point towards [paddle2 v]
Yoshiii999
Scratcher
51 posts

"Forever" block not working with code inside

Now my code doesn't work. At all. Proof that the code isn't being highlighted.



when green flag clicked
forever
say [will not work! v]
broadcast [won't work help now! v]
end

when I receive [won't work; help now! v]
fix problem

define fix problem
say [I fixed it! v]

I wish there was something that could stop Pong FROM GLITCHING!



<p> Please help please help please help </p>

Last edited by Yoshiii999 (April 7, 2020 21:16:37)

Yoshiii999
Scratcher
51 posts

"Forever" block not working with code inside

And now on another project the question became “why are these projects not working?” I told something to specifically do something, and it doesn't do it.


when green flag clicked
help user: Yoshiii999.

define help user: Yoshiii999.
Play sound [I will help you. v]
say [I will help you]

Last edited by Yoshiii999 (April 15, 2020 22:24:31)

Yoshiii999
Scratcher
51 posts

"Forever" block not working with code inside

I have everything fixed in pong, except for the computer.

Little-Finger
Scratcher
4 posts

"Forever" block not working with code inside

Yoshiii999 wrote:

My browser / operating system: Windows NT 10.0, Chrome 80.0.3987.162, No Flash version detected


Hi! My browser is Microsoft edge chromium version 80.0.361.109 (official build) (64-bit). My operating system is Windows 10 version 1909. When I was designing a version of pong, (pong is an arcade game, and you can play it by going to Bing search and typing “pong”) and every time I try my code, (with the code in a forever block), it does my instructions once. 1 time. Every time I try it.
when green flag clicked
forever
play sound [sewing machine v]
end
(won't work)

define won't work
say [won't work]
I had the same glitch once but it didn't repeat once, it didn't repeat
donotforgetmycode
Scratcher
100+ posts

"Forever" block not working with code inside

I just tried your project and it works perfectly

;

Last eaten by Evil_Kumquat (tomorrow)
Yoshiii999
Scratcher
51 posts

"Forever" block not working with code inside

Maybe a “stop all” block makes it glitch? My project got because of that.

Powered by DjangoBB

Standard | Mobile