Discuss Scratch

EmmaGymnast
Scratcher
12 posts

Flappy Bird Basic Code

Lots of people have tried to make a flappy bird game, but have struggled with the code.
Here is a basic code that you can use- but make sure to give credit to me if you do use it.
For the bird:
when green flag clicked
go to x: (-100) y: (0)
repeat until <touching color [#a2124a] ?>
change y by (-3)
if <mouse down?> then
change y by (8.5)
end
end
broadcast [end]

So this is the basic code (if i did everything right). For the repeat until touching color, the color would be the ground.
Now add this code to the bird:
when I receive [end]
hide

This is all there is to it. If you try this code yourself and it doesn't work, just let me know.

Last edited by EmmaGymnast (Jan. 28, 2017 19:06:05)

nonethenones
Scratcher
100+ posts

Flappy Bird Basic Code

or just.
when I receive [start v]
set [gravity v] to [0]
forever
change y by (gravity)
if <key [space v] pressed?> then
set [gravity v] to [4]
else
change [gravity v] by (0)
end
end

when I receive [start v]
set [score v] to [0]
show
switch costume to [costume1 v]
wait (1) secs
forever
go to front
if <touching color [idk lol] ?> then
play sound [pop v] until done
broadcast [reset v] and wait
stop [all v]
end
end
CSLSamFic
Scratcher
6 posts

Flappy Bird Basic Code

how bout the poles?
deck26
Scratcher
1000+ posts

Flappy Bird Basic Code

Please don't post random help. The forum works best if we let those needing help post new topics and help by responding where we have something useful to add.

Great that you want to help but please do so in the correct way.
blocksrostudio
Scratcher
2 posts

Flappy Bird Basic Code

how do you move automaticly forward
deck26
Scratcher
1000+ posts

Flappy Bird Basic Code

blocksrostudio wrote:

how do you move automaticly forward
Please create your own new topic if you need help.
Panganay19
Scratcher
19 posts

Flappy Bird Basic Code

Wyan100
Scratcher
1000+ posts

Flappy Bird Basic Code

Panganay19 wrote:

well i created mine https://scratch.mit.edu/projects/420340346/

Please don't unnecessarily bump old topics
Vaibhs11
Scratcher
1000+ posts

Flappy Bird Basic Code

when I receive [game start v]
show
go to x: (-150) y: (0)
forever
if <(direction) < [180]> then
turn cw (turn) degrees
end
change y by (gravity)
if <key [space v] pressed?> then
set [turn v] to [0]
change [turn v] by (-1)
set [gravity v] to [0]
change [gravity v] by (1)
else
set [turn v] to [0]
change [turn v] by (1)
set [gravity v] to [0]
change [gravity v] by (-1)
end

end
nonethenones code fixed!!
Hope this helps
Vaibhs11
Scratcher
1000+ posts

Flappy Bird Basic Code

blocksrostudio wrote:

how do you move automaticly forward
The pipes need to move by x value.
flappy will be in the same x position.
Vibrato
Scratcher
1000+ posts

Flappy Bird Basic Code

Vaibhs11 wrote:

snip
please don't necropost. you have bumped someone needing help off of the front page!

Powered by DjangoBB