Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » score counter & gravity of flappy bird
- shafanr
-
Scratcher
1 post
score counter & gravity of flappy bird
im tryna make a flappy bird clone as one of my first projects and im struggling to get the score counter right without just manually doing "if score = x OR if score > x then; switch costume to " x being multiples of 10, and the ratios of gravity to how high it can jump and the speed of the pipes for making rising difficulties all different. Anyone have any tips or solutions?
edit: heres the link https://scratch.mit.edu/projects/900131962/
the score counter is in “score1” “score11” and “score111” all for 1 2 and 3 digits of numbers
the difficulty is in the “difficulty” sprite
variables;
jump velocity is how high the bird jumps
gravity is well, gravity
and difficulty first is what the user inputs “easy” “medium” or “hard” then it changes the diff var into its respective numbers as in the game
right now easy is a beatable ratio, im not sure about medium and hard
if you want to remix and show me what to fix within the remix, feel free
thanks!
edit: heres the link https://scratch.mit.edu/projects/900131962/
the score counter is in “score1” “score11” and “score111” all for 1 2 and 3 digits of numbers
the difficulty is in the “difficulty” sprite
variables;
jump velocity is how high the bird jumps
gravity is well, gravity
and difficulty first is what the user inputs “easy” “medium” or “hard” then it changes the diff var into its respective numbers as in the game
right now easy is a beatable ratio, im not sure about medium and hard
if you want to remix and show me what to fix within the remix, feel free
thanks!
Last edited by shafanr (June 11, 2024 12:41:15)
- Catscratcher07
-
Scratcher
1000+ posts
score counter & gravity of flappy bird
for the first problem this should help.
for the second problem, it just comes down to trial and error.
for the second problem, it just comes down to trial and error.
- shafanr
-
Scratcher
1 post
score counter & gravity of flappy bird
Thank you so much! I was really stumped on this, I never really thought or looked at the rest of the operator (<- edit) blocks. But Im confused on how the score1 code works, what does letter(length(of:score)) of:score) do? does it take the letter of the amount of digits? like if theres 2 digits itll take the 2nd number and 3 digits is 3rd and so on so forth? And you can delete the remix you made if youd like.
Last edited by shafanr (June 12, 2024 00:37:31)
- youormeletsbringit
-
Scratcher
74 posts
score counter & gravity of flappy bird
im tryna make a flappy bird clone as one of my first projects and im struggling to get the score counter right without just manually doing "if score = x OR if score > x then; switch costume to " x being multiples of 10, and the ratios of gravity to how high it can jump and the speed of the pipes for making rising difficulties all different. Anyone have any tips or solutions?
edit: heres the link https://scratch.mit.edu/projects/900131962/
the score counter is in “score1” “score11” and “score111” all for 1 2 and 3 digits of numbers
the difficulty is in the “difficulty” sprite
variables;
jump velocity is how high the bird jumps
gravity is well, gravity
and difficulty first is what the user inputs “easy” “medium” or “hard” then it changes the diff var into its respective numbers as in the game
right now easy is a beatable ratio, im not sure about medium and hard
if you want to remix and show me what to fix within the remix, feel free
thanks!
for my flappy bird game, I made it to when the pipe clone goes past the bird the score goes up. works perfect
- youormeletsbringit
-
Scratcher
74 posts
score counter & gravity of flappy bird
ah nevermind, you want the costume to show the score, even for numbers higher than 9. I see someone has helped, but i'll still show you my method.
You want to rename the costumes for each corresponding number, numbered 1 to 9 and 0 being last.
You want to rename the costumes for each corresponding number, numbered 1 to 9 and 0 being last.
when green flag clicked
hide
set [digits v] to [1]
set [Space v] to [24]
delete this clone
when I receive [Start v] // Or green flag, whenever the game actually starts.
repeat (10)
create clone of [myself v]
change [digits v] by (1)
end
when I start as a clone
show
forever
go to [front v] layer :: looks
if <(score) > [19]> then
set [Space v] to [28]
end
go to x: ((((digits) * (Space)) - (((length of (score)) * (Space)) / (2))) - (10)) y: (0)
if <(length of (score)) < (digits)> then
hide
else
show
switch costume to (letter (digits) of (score))
end
end
- Catscratcher07
-
Scratcher
1000+ posts
score counter & gravity of flappy bird
Thank you so much! I was really stumped on this, I never really thought or looked at the rest of the operator (<- edit) blocks. But Im confused on how the score1 code works, what does letter(length(of:score)) of:score) do? does it take the letter of the amount of digits? like if theres 2 digits itll take the 2nd number and 3 digits is 3rd and so on so forth? And you can delete the remix you made if youd like.yes, that is exactly what it does.
- Discussion Forums
- » Help with Scripts
-
» score counter & gravity of flappy bird


