Discuss Scratch

huberto_9
New Scratcher
1 post

Adding a Score to the Pong game

Please help me figure out how to add a score to the game pong, as I tried several ways to do it but all of them are unsuccessful. I would like help as this is a school project
wkelly42
Teacher
100+ posts

Adding a Score to the Pong game

How does the program decide if the player has missed the ball?
ShadowScizor
Scratcher
100+ posts

Adding a Score to the Pong game

have you tried variable?
change [point v] by (1)
17khoang1
Scratcher
12 posts

Adding a Score to the Pong game

below

Last edited by 17khoang1 (Jan. 31, 2015 07:14:05)

17khoang1
Scratcher
12 posts

Adding a Score to the Pong game

when green flag clicked
forever

end
if <touching [Paddle] ?> then
change [Score] by (1)

end


Put the bottom block together

Last edited by 17khoang1 (Jan. 31, 2015 07:15:46)

FMXmotocross12
Scratcher
8 posts

Adding a Score to the Pong game

17khoang1 wrote:

when green flag clicked
forever

end
if <touching [Paddle] ?> then
change [Score] by (1)

end


Put the bottom block together
But one thing is, what has to be in the “Forever” loop? In order for something to be done forever, you need something in the forever loop (unless Im mistaken) but through the thing that I know, you need something in the forever loop.
Crimson19
Scratcher
1000+ posts

Adding a Score to the Pong game

Here:

when green flag clicked
forever

if <whatever the condition is> then
change [score v] by (1)
end

end

Last edited by Crimson19 (Jan. 31, 2015 16:01:01)

17khoang1
Scratcher
12 posts

Adding a Score to the Pong game

FMXmotocross12 wrote:

17khoang1 wrote:

when green flag clicked
forever

end
if <touching [Paddle] ?> then
change [Score] by (1)

end


Put the bottom block together
But one thing is, what has to be in the “Forever” loop? In order for something to be done forever, you need something in the forever loop (unless Im mistaken) but through the thing that I know, you need something in the forever loop.


if you look at my the bottom of the script i made it said, “Put the bottom blocks together” so what i meant was it should look like this

when green flag clicked
forever

if <touching [Paddle] ?> then
change [Score] by (1)

end

end
RandomAnimator11
Scratcher
3 posts

Adding a Score to the Pong game

You can take a look at my project to see an example
https://scratch.mit.edu/projects/34137774/
ScratchCurator
Scratcher
15 posts

Adding a Score to the Pong game

You can use this block:
broadcast [v]
To let other sprites know they need to change the score.
And put this script into another sprite:
when I receive [ v]
change [ scorev] by (1)
Zekrom01
Scratcher
1000+ posts

Adding a Score to the Pong game

Use the variables feature:
(this is for the ball)
when green flag clicked
forever
if <touching [goal v] ?> then

broadcast [GOAL! v]
end
end




when I receive [GOAL! v]
change [left side score v] by (1)

Last edited by Zekrom01 (Aug. 11, 2015 13:00:33)

Apricot2005
Scratcher
21 posts

Adding a Score to the Pong game

Try adding a var code called Score, points, jelly or what ever you want

when green flag clicked
if <touching [ Paddlev] ?> then

change [Score v] by (0)
end
MrMinecraft1210
Scratcher
91 posts

Adding a Score to the Pong game

What about this!
when green flag clicked
forever

if <touching [Paddle v] ?> then
change [Points v] by (1)

end

end
VideoGamerCanInvent
Scratcher
1000+ posts

Adding a Score to the Pong game

Basically under the Ball code:

when green flag clicked
forever

if <touching [ paddle] ?> then

change [score] by (1)
end

end

Powered by DjangoBB