Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » increased the sprite's speed according to certain score
- je10249
-
4 posts
increased the sprite's speed according to certain score
I'm creating a game, but I'm kinda confused on how to change the speed whenever a player's score reach to 10 enemy's speed will increased and also when the speed reaches to 15 and the player touches it enemies then its game over
thank you.
thank you.
- AlfaDragon
-
100+ posts
increased the sprite's speed according to certain score
Maybe try increasing the amount to steps each one takes per arrow pressed down (I think that made sense lol) Try something like this:
(20 is the score is = to 10 when it starts:
when green flag clicked
forever
if <(score) = [10]> then
if <key [right v] pressed?> then
move (20) steps
end
end
end
(20 is the score is = to 10 when it starts:
when green flag clicked
if <key [right v] pressed?> then
move (10) steps
end
Last edited by AlfaDragon (March 16, 2018 04:03:04)
- je10249
-
4 posts
increased the sprite's speed according to certain score
thank you, I'll try something like this since Im creating a space shooter game
- CoolGamesAndThings
-
100+ posts
increased the sprite's speed according to certain score
when green flag clickedThat should make it so the speed increases every 10 score.
move (round ((score) / (10))) steps
- -ShadowOfTheFuture-
-
1000+ posts
increased the sprite's speed according to certain score
You could do something like this:
when green flag clicked
forever
move ((10) + (score)) steps
end
- je10249
-
4 posts
increased the sprite's speed according to certain score
neither of them works im sorry
- deck26
-
1000+ posts
increased the sprite's speed according to certain score
Please give more details of waht you want - what will the speed be initially? after score reaches 10? after it reaches 20? Is it a simple linear relationship or something more complicated?
It's not difficult but if you can't see ways of adapting either of the above examples to suit your needs we need more detail.
It's not difficult but if you can't see ways of adapting either of the above examples to suit your needs we need more detail.
- je10249
-
4 posts
increased the sprite's speed according to certain score
I want it like every time a score reaches to 10 the speed increased to 2 so like the first score is 10 then the speed will increase to 2 then add up another 10 to the score it will be 20 then the speed increases to another 2
thank you
thank you
- deck26
-
1000+ posts
increased the sprite's speed according to certain score
I want it like every time a score reaches to 10 the speed increased to 2 so like the first score is 10 then the speed will increase to 2 then add up another 10 to the score it will be 20 then the speed increases to another 2
thank you
set [speed v] to [2] // initial valueIf score might jump more than 1 at a time it might never equal the nextstep so instead use ‘wait until (not (score < nextstep))’ or set nextstep to 9 initially and ‘wait until (score > nextstep)’.
set [nextstep v] to [10]
forever
wait until ((score) = (nextstep))
change [nextstep v] by [10]
change [speed v] by [2]
end
- -ShadowOfTheFuture-
-
1000+ posts
increased the sprite's speed according to certain score
I want it like every time a score reaches to 10 the speed increased to 2 so like the first score is 10 then the speed will increase to 2 then add up another 10 to the score it will be 20 then the speed increases to another 2
thank you
Would this work?
move ((ORIGINAL SPEED) + (([floor v] of ((score) / (10))) * (2))) steps
- best-games-ever
-
500+ posts
increased the sprite's speed according to certain score
when green flag clicked
if <(score) = [10]> then
move (20) steps
end
(not ten steps so it goes faster)
- deck26
-
1000+ posts
increased the sprite's speed according to certain score
Probably but you're then doing the calculation every time you move which is inefficient.I want it like every time a score reaches to 10 the speed increased to 2 so like the first score is 10 then the speed will increase to 2 then add up another 10 to the score it will be 20 then the speed increases to another 2
thank you
Would this work?move ((ORIGINAL SPEED) + (([floor v] of ((score) / (10))) * (2))) steps
- W1Atchisonbryan
-
1 post
increased the sprite's speed according to certain score
This does not work also where are the blocks you guys are using?
- deck26
-
1000+ posts
increased the sprite's speed according to certain score
All the blocks are standard blocks and the colour coding should help you find them. This does not work also where are the blocks you guys are using?
Please try to avoid posting on old topics. It just brings them back to the top page knocking someone else currently needing help off the page.
- Discussion Forums
- » Help with Scripts
-
» increased the sprite's speed according to certain score