Discuss Scratch

FooliganXX
Scratcher
7 posts

How to increase difficulty (specifically speed) in Pong when a certain score is reached.

Hi. I've challenged my students to modify their Pong games so that when a certain score is reached, the difficulty increases. Specifically by increasing the speed. The way I did it is I created a variable for score and a variable for speed. The scripts (modified for clarity) read like this:

Variables: Speed, Score

Flag
Set Speed to Ten
Loop
Move Speed Steps
If On Edge Bounce

Flag
Set Points to 0
Loop
If Touching Paddle Sprite
Change Points by 1

Flag
When Points = 25
Change Speed by 10

What I would like to do is write a script where the speed increases by 10 every additional 25 points (50, 75, etc.) without writing it out all the way.

Any ideas?

Thanks,
Fooligan
jokebookservice1
Scratcher
1000+ posts

How to increase difficulty (specifically speed) in Pong when a certain score is reached.

when green flag clicked
forever

if <((points) mod (25)) = [0]> then

change [speed v] by (10)
wait until <not <((points) mod (25)) = [0]>>
end

end
Is that what you mean?
Gorge_Lucas
Scratcher
13 posts

How to increase difficulty (specifically speed) in Pong when a certain score is reached.

forever

change [ v] by (1)
wait (1) secs
if <(time) = [time that you want the game to get harder ]> then

move (the new speed you want) steps
end

end
jokebookservice1
Scratcher
1000+ posts

How to increase difficulty (specifically speed) in Pong when a certain score is reached.

Gorge_Lucas wrote:

forever

change [ v] by (1)
wait (1) secs
if <(time) = [time that you want the game to get harder ]> then

move (the new speed you want) steps
end

end
That is a good script, but the person who posted did not mention anything about time, only about points.
asivi
Scratcher
1000+ posts

How to increase difficulty (specifically speed) in Pong when a certain score is reached.

when green flag clicked
set [points v] to [0]
set [speed v] to [10]
forever
move (speed) steps
if on edge, bounce
if <touching [paddle v] ?> then
point in direction ((180) - (direction))
move (speed) steps
change [points v] by (1)
if <((points) mod (25)) = [0]> then
change [speed v] by (10)

end


end


end

Last edited by asivi (April 21, 2016 05:14:17)

FooliganXX
Scratcher
7 posts

How to increase difficulty (specifically speed) in Pong when a certain score is reached.

Thank you to everybody who offered help. The time idea was a good workaround but I really wanted to do it with points.
I never thought of the mod option. I had just looked at it but wasn't sure what good it was until I realized that making the dividend zero would be of great use.
I had to add one thing to asivi's script above.
After the If/Then Points Mode = 0, I had to change points by 1 in addition to changing steps (I used the move steps instead of speed).
I had to do this because the loop kept checking and the mod = zero for a while so the speed would increase really quickly. By adding an extra point I was able to get from 25 to 26 right away and then they would have to wait for 50 for the mod to equal zero again.

I call this a bonus point just so it seems like it was supposed to be there.

Thanks all!
asivi
Scratcher
1000+ posts

How to increase difficulty (specifically speed) in Pong when a certain score is reached.

FooliganXX wrote:

Thank you to everybody who offered help. The time idea was a good workaround but I really wanted to do it with points.
I never thought of the mod option. I had just looked at it but wasn't sure what good it was until I realized that making the dividend zero would be of great use.
I had to add one thing to asivi's script above.
After the If/Then Points Mode = 0, I had to change points by 1 in addition to changing steps (I used the move steps instead of speed).
I had to do this because the loop kept checking and the mod = zero for a while so the speed would increase really quickly.
By adding an extra point I was able to get from 25 to 26 right away and then they would have to wait for 50 for the mod to equal zero again.

I call this a bonus point just so it seems like it was supposed to be there.

Thanks all!
I doubt that.
Can you share the project?
FooliganXX
Scratcher
7 posts

How to increase difficulty (specifically speed) in Pong when a certain score is reached.

It is shared. It's called DogMuffin. It's in a studio I created called Chow-Miller Tutorial Examples.

Take out the “Change Points By 1” block I added in the bottom of the If/Then and tell me if you get the same results. My speed shot up by increments of 5 continuously until the dog shot by the muffin right away.

Thanks,
Ian
asivi
Scratcher
1000+ posts

How to increase difficulty (specifically speed) in Pong when a certain score is reached.

FooliganXX wrote:

It is shared. It's called DogMuffin. It's in a studio I created called Chow-Miller Tutorial Examples.

Take out the “Change Points By 1” block I added in the bottom of the If/Then and tell me if you get the same results. My speed shot up by increments of 5 continuously until the dog shot by the muffin right away.

Thanks,
Ian
how i'd supposed it isn't the script i've posted.

Powered by DjangoBB