< Return to Video

Coding Challenge #31: Flappy Bird

  • 0:00 - 0:06
    Hello and welcome to a coding rainbow
    coding challenge. Today's coding challenge
  • 0:06 - 0:13
    I'm going to attempt to make a flappy
    bird clone which I admit it is kind of
  • 0:13 - 0:15
    like a bit of a cliché probably at this point
    don't know how many people have made
  • 0:15 - 0:21
    flappy bird clone tutorial whatever's on
    in the world but it was requested I
  • 0:21 - 0:24
    think it will be fu,n I'm going to give
    it a try, I'm going to do it in
  • 0:24 - 0:26
    JavaScript I'm going to try to do it
    fast
  • 0:26 - 0:31
    but with time to explain and time to
    relax and just enjoy myself and
  • 0:31 - 0:33
    hopefully you might enjoy watching this. So umm
  • 0:33 - 0:37
    if you're not familiar with flappy bird
    then I would say pause this video and go
  • 0:37 - 0:40
    familiarize yourself with it.
    I actually don't think I've ever
  • 0:40 - 0:43
    actually played it before but I am
    somewhat familiar with the gameplay
  • 0:43 - 0:47
    we'll see how well I do, I've got a live
    chat going on and you guys can tell me
  • 0:47 - 0:48
    how I'm doing
  • 0:48 - 0:51
    if you're watching this is a YouTube
    archive you won't be able to follow
  • 0:51 - 0:52
    along live but that's fine.
  • 0:52 - 0:56
    Ok so I'm using p5.js which is a
    JavaScript framework has a function setup
  • 0:56 - 1:00
    it has a function draw and so the only
    thing I've got so far in the browser is
  • 1:00 - 1:01
    just a canvas
  • 1:01 - 1:05
    that's 400 x 600 pixels and a black
    background on that canvas
  • 1:05 - 1:08
    so the first thing that I want to do I
    actually have a separate javascript file
  • 1:08 - 1:13
    called bird.js and I'm actually
    going to make this a constructor
  • 1:13 - 1:18
    function and the bird.. all the bird
    really needs is a y-value, right? The bird
  • 1:18 - 1:21
    moves up and down
    and it stays in one spot
  • 1:21 - 1:25
    so I'm going to give this.. bird.. I'm going
    to start the bird off in the center of
  • 1:25 - 1:30
    the window and I'm going to write also a
    function called show where I draw the
  • 1:30 - 1:35
    bird and again I'm gonna.. my design is
    going to be very poor so it's going to
  • 1:35 - 1:39
    be up to you to take my code which will
    be linked in this description and make
  • 1:39 - 1:43
    something more beautiful and interesting
    and reef off with this so I'm just going to
  • 1:43 - 1:48
    say let's make a white circle and you
    what let's get this bird and x-position
  • 1:48 - 1:51
    as well even though it will be fixed but
    let's just try
  • 1:51 - 1:58
    25 for right now and I'm gonna never
    forget the.. ♫this dot♫ you always need
  • 1:58 - 2:07
    this dot in JavaScript. So let's make this
    bird a circle and let's say in the
  • 2:07 - 2:08
    main program now
  • 2:08 - 2:18
    var bird and we're going to say bird
    equals new bird and bird.show(), so we
  • 2:18 - 2:21
    should have something a little bit more
    interesting now there it is
  • 2:21 - 2:25
    bird.. width/2 you know would probably
    makes more sense if I want the bird to
  • 2:25 - 2:27
    be in the middle to be height/2
  • 2:27 - 2:33
    so let's fix that. I'm gonna say height/2,
    I think the bird could be a little bit
  • 2:33 - 2:36
    bigger and the bird could be a little
    bit more in on the screen
  • 2:36 - 2:40
    so there we go this is the beginning of
    flappy bird now what happens to the bird
  • 2:40 - 2:42
    without you doing anything?
  • 2:42 - 2:46
    the bird falls down. So oops oops wrong window
  • 2:46 - 2:52
    so I'm going to go here and I'm going to
    say this.update equals function and it
  • 2:52 - 2:56
    would be good to have some sort of
    variable called gravity and gravity
  • 2:56 - 3:01
    being the force that's pushing that bird
    down and let's say that the gravity
  • 3:01 - 3:03
    here is going to be one
  • 3:03 - 3:07
    I also need a velocity, right? I need a
    velocity so gravity is the force that's
  • 3:07 - 3:10
    causing the velocity of the bird to
    increase so I'm gonna say
  • 3:10 - 3:18
    this.velocity equals 0 and now I'm going to
    say this.y changes by this.velocity
  • 3:18 - 3:26
    and this.velocity changes by
    this.gravity
  • 3:26 - 3:30
    ok so now we have a function that's
    going to push that bird down so I'm
  • 3:30 - 3:34
    gonna go over here and I'm going to say
    also bird.update();
  • 3:34 - 3:38
    there we go bye bird it flew down. Now
  • 3:38 - 3:42
    we should probably do something where the
    bird stops when it gets to the
  • 3:42 - 3:43
    bottom of the window
  • 3:43 - 3:47
    that makes sense so I'm gonna go back to
    the bird and I'm gonna say.. I'll just do this
  • 3:47 - 3:51
    in the update function, I could write a
    separate.. and I'm gonna say if this.y
  • 3:51 - 3:53
    is greater than height then
  • 3:53 - 3:59
    then I'm just gonna keep the bird
    on the screen I'm going to say this.y
  • 3:59 - 4:06
    equals height and I'm also going to set
    that velocity to zero so we can see here
  • 4:06 - 4:09
    that bird stops. I don't know if that's
    actually what happens in flappy bird but
  • 4:09 - 4:11
    I just kind of want to do that anyway
  • 4:11 - 4:15
    and you know what I'm going to do that
    also for the top of the window because
  • 4:15 - 4:18
    ultimately I'm going to be able to push
    the bird up
  • 4:19 - 4:23
    so let's do that for less than zero,
    now of course...
  • 4:23 - 4:27
    oh ok so now what.. How does the game work?
  • 4:27 - 4:30
    I think it's a mobile game right you
    could tap your mobile device.. this is my
  • 4:30 - 4:31
    mobile device
  • 4:31 - 4:37
    so I mean as a tap I'm going to just
    use the spacebar on my keyboard so in p5.js
  • 4:37 - 4:42
    I can write a function called
    keypPessed and I can check to see if the
  • 4:42 - 4:45
    key is the space bar
  • 4:45 - 4:49
    and let me just make sure this is working
    I'm just going to console log something
  • 4:49 - 4:53
    right now so I'm going to run this and you
    can see each time I press the spacebar
  • 4:54 - 4:58
    it says here in the console, it prints out,
    SPACE. So that works
  • 4:58 - 5:04
    so what do I want to do I want to cause a
    force to cause that bird to go up so I'm
  • 5:04 - 5:09
    going to say bird.up and so what's
    going to happen with this bird.up
  • 5:09 - 5:11
    function?
  • 5:11 - 5:19
    What do I want to do.. I want instead of
    the velocity being pushed down by
  • 5:19 - 5:20
    gravity
  • 5:20 - 5:25
    I want to say this.velocity minus
    equals, I want it to go up or I could say
  • 5:25 - 5:27
    plus equals but some minus amount
  • 5:27 - 5:32
    now what if I just said minus this.gravity?
    Let's try that for a second just to see
  • 5:32 - 5:33
    what happens
  • 5:33 - 5:39
    Come on! Wait oh you know what's a little bit
    annoying, I have to.. oh I took off that
  • 5:39 - 5:41
    console.log(), hold on.
  • 5:41 - 5:46
    Let's say minus equals this.gravity
    times 10 so nothing's working here and I
  • 5:46 - 5:51
    have a kind of a sneaking suspicion that
    I've done something totally wrong
  • 5:51 - 5:55
    bird.up let's make sure this
    is happening.
  • 5:59 - 6:04
    I'm gonna say print line this.velocity
  • 6:08 - 6:13
    ok so you can see that's working so
    let's try to tune.. I think there's sort
  • 6:13 - 6:15
    of an issue here we've got to sort of
    tune the numbers
  • 6:15 - 6:20
    so let's make the gravity just for right
    now a lot less strong so it's not going
  • 6:20 - 6:21
    so fast
  • 6:21 - 6:26
    now you can see though that this isn't
    really doing very much
  • 6:26 - 6:30
    let's make a this.up force
  • 6:30 - 6:37
    let's call this lift and we'll say it's
    negative 10
  • 6:37 - 6:43
    so I'm going to say this.velocity
    plus equals this.lift; not left lift.
  • 6:43 - 6:48
    There we go, so you can see there's a
    sort of an element of tuning those
  • 6:48 - 6:49
    numbers
  • 6:49 - 6:52
    so now it doesn't really feel like it's
    falling fast enough but me pushing the
  • 6:52 - 6:55
    spacebar is kind of working out.
  • 6:55 - 6:59
    What happens if I hold down the spacebar?
    so that's good ok so that lift is too
  • 6:59 - 7:05
    much. Let's make the gravity 0.6 and
    let's keep the lift there but now I'm
  • 7:05 - 7:08
    going to need to make the lift a little
    bit stronger.
  • 7:08 - 7:11
    There we go, so this..
  • 7:11 - 7:15
    so now I have, I sort of have the game
    going and lift is a little bit too strong
  • 7:15 - 7:18
    let's make it less strong
  • 7:23 - 7:27
    so this you know, something something
    that I could do is actually limit the
  • 7:27 - 7:33
    top speed or also like give
    it some.. something that I could also do
  • 7:33 - 7:37
    is add some like air resistance in
    general which I could say something like
  • 7:37 - 7:45
    this.velocity times equals 0.9
    so that actually like helps with things
  • 7:45 - 7:49
    quite a bit because it's just there's
    some sort of like a limit to what the
  • 7:49 - 7:53
    speed is so now I've got something that
    is a bit more kind of like reasonable to
  • 7:53 - 7:58
    play here. So you could spend your time
    tuning this even more but I think just
  • 7:58 - 8:01
    like keeping the velocity keeping some
    like air resistance by always shrinking
  • 8:01 - 8:03
    the velocity a little bit
  • 8:03 - 8:07
    tuning how much the lift is versus the
    gravity those types of things you can
  • 8:07 - 8:08
    kind of play around with.
  • 8:08 - 8:12
    Ok, so now we have the basic game
    mechanic here which is just a falling
  • 8:12 - 8:14
    circle and each time I press the
    spacebar
  • 8:14 - 8:18
    I can kind of like have it lift up a
    little bit. Now what do we need to add? We
  • 8:18 - 8:23
    need to add those pipe things that kind
    of come from the right of the screen,
  • 8:24 - 8:27
    I'm only at eight minutes by the way
    which is pretty good; the pipes things
  • 8:27 - 8:30
    that come from the right of the screen
    and you have to steer your way through.
  • 8:30 - 8:34
    Let's see if we can do this. So let's
    think about this, I'm going to also
  • 8:34 - 8:38
    create a pipe object with a constructor
    function and let's think about what
  • 8:38 - 8:40
    does a pipe need?
  • 8:40 - 8:44
    So a pipe needs, I would say it's going
    to extend from the top to somewhere in
  • 8:44 - 8:47
    the middle of the screen and then
    somewhere further down to the bottom so
  • 8:47 - 8:52
    I need, I'm going to say like a value
    called top which is going to be some
  • 8:52 - 8:57
    random amount between the top of the
    screen and the middle of the screen and
  • 8:57 - 9:01
    let's say this.bottom is some random
    amount also between the middle of the
  • 9:01 - 9:06
    screen in the bottom of the screen and
    the pipe also needs an x-position
  • 9:06 - 9:13
    which is always going to start at the
    edge of the screen and then let's
  • 9:13 - 9:16
    write a function called show where I
    draw the pipe
  • 9:16 - 9:24
    as a white.. fill white and I draw a
    rectangle at this.x, 0 all the
  • 9:24 - 9:28
    way with a width of like, let's say the
    width is 20 and let's actually make that
  • 9:28 - 9:34
    a variable and this..
  • 9:34 - 9:40
    a width and also the height then is this.top
    and then I need another rectangle
  • 9:40 - 9:44
    which starts from the bottom
  • 9:45 - 9:53
    minus how tall it is and let's make.. minus
    this.bottom and its height is this.bottom.
  • 9:54 - 9:59
    Okay in case this isn't
    making sense to you
  • 9:59 - 10:03
    that's actually.. let's actually do a
    quick diagram here. What I'm trying to do
  • 10:03 - 10:05
    is create something that looks like this
  • 10:05 - 10:13
    so I need two random numbers this length
    is what I'm calling top, this length is
  • 10:13 - 10:17
    what I'm calling bottom and then this
    length.. this width is what I'm calling w.
  • 10:17 - 10:22
    So I first draw a rectangle from here
    with this width with a height of top and
  • 10:22 - 10:25
    then I draw a rectangle from here which
    is height
  • 10:25 - 10:29
    minus bottom which is this point with this
    width and then the height of that
  • 10:29 - 10:30
    rectangle is bottom.
  • 10:30 - 10:34
    So this is what I'm getting and if these
    values are random I'll sometimes get stuff
  • 10:34 - 10:35
    that looks like this
  • 10:35 - 10:38
    etc. Now I could be more
    thoughtful like right now the way that
  • 10:38 - 10:40
    I'm doing it
  • 10:40 - 10:44
    there's.. this.. you could never get
    something that looks like this. So it
  • 10:44 - 10:48
    probably would make a.. I could probably
    do something different where I pick like
  • 10:48 - 10:52
    a random empty amount of space and then
    I pick a random starting point for that
  • 10:52 - 10:54
    empty amount of space. That might be
    interesting to do, we can make that as an
  • 10:54 - 10:59
    improvement later but let's just stick
    with what I have right now which I think
  • 10:59 - 10:59
    is good enough
  • 10:59 - 11:04
    ok am back over here and let's just see
    now I need a function like this.update
  • 11:04 - 11:12
    and all I want to do in this.update is
    say this.x minus equals some speed
  • 11:12 - 11:19
    this.speed. So let's say this.speed
    is always going to be 5. I'm gonna just..
  • 11:19 - 11:23
    so all of these are always going to
    move to the left. So let's look now here
  • 11:23 - 11:29
    in sketch I'm going to create an array
    called pipes and what I'm going to do is
  • 11:29 - 11:30
    say
  • 11:30 - 11:36
    pipes.push a new pipe; and then in draw
  • 11:36 - 11:43
    I'm going to say for all of the pipes in
    the array
  • 11:44 - 11:47
    yeah I also have a problem with this,
    somebody in the chat is saying, where I could
  • 11:47 - 11:50
    technically have a pipe with no space in
    it. So all that stuff can be corrected
  • 11:50 - 11:54
    later and I want to say show and I want
    to say update.
  • 11:55 - 12:00
    So let's run this now and see. There we
    go, that's moving quite fast.
  • 12:01 - 12:06
    So let's go back to the pipe and let's
    just make the speed 1. So we could see
  • 12:06 - 12:09
    aah look we basically have
    flappy bird already
  • 12:09 - 12:12
    it's so easy to play so it's moving
    kind of slow now but of course I only
  • 12:12 - 12:14
    have one. So let's think about this,
  • 12:14 - 12:20
    what.. couple of things that I want to do;
    one is I want to I want to say something
  • 12:20 - 12:26
    like if frameCount, I want to have a
    pipe every like so often, modulus 40
  • 12:26 - 12:30
    equals zero which means every 40 frames,
    the modulus operator being the remainder
  • 12:30 - 12:35
    of division. So anytime a number is
    divisible by 40 with a remainder of 0 is
  • 12:35 - 12:38
    0 40 80 120 160 etc
  • 12:38 - 12:44
    let's add a new pipe and
    let's see how this looks
  • 12:44 - 12:52
    that's a lot of.. that's a lot of.. every
    40 frames is quite a view. Look at this, oh
  • 12:52 - 12:54
    I'm pretty good at this
  • 12:54 - 12:57
    ♪ta da da da♪ I need some like
    music to play along with this. Okay so
  • 12:57 - 13:00
    that's no good obviously. Lets umm
  • 13:00 - 13:05
    let's make the pipes move a little bit
    faster, twice as fast, and let's uh let's
  • 13:05 - 13:12
    say every hundred frames. So obviously
    you can see uh how the speed of the
  • 13:12 - 13:15
    pipes, how frequent they are and we can
    see basically I have the game right now.
  • 13:15 - 13:19
    I've made a very easy version of the
    game to play
  • 13:19 - 13:25
    it's not very hard but one thing that I
    haven't done is figure out when I need
  • 13:25 - 13:28
    to actually., you know this, i'm doing a
    great job here so let's actually add
  • 13:28 - 13:33
    something that shows us when the circle
    hits the pipe or doesn't hit the pipe so
  • 13:33 - 13:37
    and also by the way I should be getting
    rid of the pipes at some point so one
  • 13:37 - 13:40
    thing I should do is I should I should
    say
  • 13:40 - 13:51
    if pipes index I is finished and I can
    actually just say x is less than zero..
  • 13:51 - 13:54
    you know what I'm going to write a
    function. I'll write a function called
  • 13:54 - 13:57
    offscreen so if the pipe is off the
    screen
  • 13:57 - 14:01
    I want to say pipes.splice(i, 1)
  • 14:01 - 14:05
    so splice is a function that deletes an
    element from the array. So I want to know
  • 14:05 - 14:07
    if the pipe went off the screen, get rid
    of it
  • 14:07 - 14:11
    I don't need it anymore. Now of course
    there's a little bit of an issue here
  • 14:11 - 14:15
    which is one is there's no such thing as
    a function called offscreen that's a
  • 14:15 - 14:16
    function I have to write.
  • 14:16 - 14:19
    There's another issue here which is that
    when I'm deleting stuff out of the array
  • 14:19 - 14:22
    I really should go through the array
    backwards and I've covered that in other
  • 14:22 - 14:27
    videos but basically the array slides..
    the elements slide back and if I'm going
  • 14:27 - 14:31
    forwards, the elements slide back while am going
    forward I could end up skipping things.
  • 14:31 - 14:38
    So I'm just going to switch my loop to
    saying greater than or equal to 0 and
  • 14:38 - 14:43
    i minus minus, and then
    I'm gonna.. if I run this, right?
  • 14:43 - 14:46
    no function named offscreen so I have
    to go into the pipe and I have to write
  • 14:46 - 14:51
    a function called this.offscreen is a
    function and this is very simple, I can
  • 14:51 - 14:57
    just say if this.x is less than
    negative w, right? because I want it to be
  • 14:57 - 14:59
    all the way off
  • 14:59 - 15:05
    so it's width has to be all the way off;
    return true else return false and now I know
  • 15:05 - 15:08
    all of you watching this video are
    going to complain to me and just say, "But
  • 15:08 - 15:13
    couldn't you just say return this.x is
    less than negative w because that
  • 15:13 - 15:14
    evaluates to true or false."
  • 15:14 - 15:18
    Yes, I could do that but you know what
    sometimes I like to write my code this
  • 15:18 - 15:22
    way. I like it to be long-winded, multiple
    line, I love the way that curly brackets
  • 15:22 - 15:26
    just nest themselves so beautifully, I love
    to say a return true return false
  • 15:26 - 15:30
    you can write your code a different way
    but yeah and now I sort of feel like I
  • 15:30 - 15:32
    should change it but I'm not going to
  • 15:32 - 15:37
    I'll do it later. Okay, so coming back
    let's see now we should see.. oops w is not
  • 15:37 - 15:37
    defined
  • 15:37 - 15:41
    so I have to say ♪this dot this dot♫
  • 15:42 - 15:48
    I always forget the this dot. Ok,
    now we should see.. now I can't really
  • 15:48 - 15:52
    tell if this is working, I can only
    assume this is working but if I do
  • 15:52 - 15:54
    something where I say like this
  • 15:54 - 16:00
    oh pipes.length, if I look at the
    length of that array it's two and it's
  • 16:00 - 16:00
    always two.
  • 16:00 - 16:05
    So even though I'm adding more and more
    they're getting deleted, ok, so we can be
  • 16:05 - 16:07
    pretty sure that that's working.
  • 16:07 - 16:12
    Ok now let's see, now we've got to do the
    exciting part here .. I mean this whole
  • 16:12 - 16:18
    thing hopefully is somewhat exciting but
    we've really got to get the gameplay
  • 16:18 - 16:19
    mechanic where you..
  • 16:19 - 16:22
    it's going to give you some visual
    feedback if you hit one of those pipes.
  • 16:22 - 16:26
    So let's think about how we might write
    this, ultimately here's where I have
  • 16:26 - 16:29
    this single bird that says bird.update
    bird.show
  • 16:29 - 16:33
    and I'm also looping through all the
    pipes so one thing I could do, I don't
  • 16:33 - 16:37
    really need to do it this way but I'm
    gonna I'm gonna move this loop first
  • 16:37 - 16:45
    just so the bird comes after and I'm
    going to say here I'm going to say if
  • 16:45 - 16:51
    pipes index i hits the bird
  • 16:53 - 17:01
    then do something. I'm just going to say
    console.log("HIT"); so I need to have a
  • 17:01 - 17:06
    function that determines if a pipe has
    hit the bird
  • 17:06 - 17:09
    so if looking at this bit of code you
    can see here what do I need to write?
  • 17:09 - 17:13
    I need to write a function called hits
    and that function is going to be part of
  • 17:13 - 17:17
    the pipe object and its going to receive
    a bird object as an argument
  • 17:18 - 17:21
    so I'm gonna go to the pipe object and I'm
    going to write, I'm just going to write
  • 17:21 - 17:23
    the function up there.. here, this.hits
  • 17:23 - 17:29
    I called it hits equals function bird and
    now I just need to check. What do I need
  • 17:29 - 17:30
    to check?
  • 17:30 - 17:38
    I need to check if bird.y is less than
    the top and bird.. or
  • 17:40 - 17:44
    or bird.y is greater than height
  • 17:44 - 17:50
    minus this.bottom. So if the bird is ever..
  • 17:50 - 17:55
    if I come back here to my whiteboard if
    the bird is ever, right?
  • 17:56 - 18:04
    less than top or greater than height minus
    bottom here then it's kind of it's
  • 18:04 - 18:05
    hitting that.. it's hitting that pipe.
  • 18:05 - 18:09
    So let's come back over here. Did I get
    that right is greater than height.. okay, so
  • 18:09 - 18:14
    then I want to say return true
    although this isn't good enough, right?
  • 18:14 - 18:19
    It's also got to be within the actual
    x-position
  • 18:19 - 18:24
    so we should also say and I uh I could I
    mean I could be much better about how I
  • 18:24 - 18:27
    construct this but I'm gonna
    put it inside here
  • 18:27 - 18:33
    so let's just say it's within that stuff
    also lets now check if bird.x
  • 18:33 - 18:46
    it's x-position is greater than this.x
    and bird.x is less than this.x
  • 18:46 - 18:48
    plus this.w
  • 18:48 - 18:51
    so I'm also just checking if it's in
    between the actual x-position of the
  • 18:51 - 18:52
    pipe
  • 18:52 - 18:57
    so if all of that is true I'm going to return
    true. You know am just working it out we
  • 18:57 - 19:01
    could.. I could.. this double if statement
    is kind of an awful way to write this
  • 19:01 - 19:03
    and I could probably be more clever and I
    could write a separate function that
  • 19:03 - 19:07
    just tests intersection between a circle
    and a rectangle but right now this will
  • 19:07 - 19:10
    be good enough for us right now and I
    look forward to hearing your
  • 19:10 - 19:12
    improvements and suggestions in the
    comments
  • 19:12 - 19:16
    so let's just see here if.. whoops,
  • 19:16 - 19:19
    right now I'm not seeing anything. Hit hit ahaa
  • 19:19 - 19:24
    so this is basically working, you can see
    that anytime,
  • 19:25 - 19:27
    this is gonna be hard; so
    let's actually give ourselves some
  • 19:27 - 19:29
    visual feedback
  • 19:29 - 19:35
    if this is the case, let's write a
    variable called highlight set it equal
  • 19:35 - 19:36
    to false
  • 19:36 - 19:42
    let's also say this.highlight equals
    true and then under fill.. under show I'm going
  • 19:42 - 19:45
    to say if this.highlight
  • 19:46 - 19:49
    I'm going to say fill(2..), I'm gonna make
    it red
  • 19:49 - 19:56
    so let's just see if this gives us some
    nice visual feedback. Oh you know what I
  • 19:56 - 20:01
    never said highlight equal to false so
    watch it hits it
  • 20:01 - 20:06
    so you know that's fine but I might want
    to actually also say
  • 20:07 - 20:16
    this.highlight equals false, hope it's
    not hitting it, so now here we go
  • 20:17 - 20:20
    it hits it you can see. So now I could add
    things like score
  • 20:20 - 20:23
    I could be more careful about like I'm
    really only checking the center
  • 20:24 - 20:27
    go go go
  • 20:27 - 20:35
    tada dada dada.. this is way too easy to
    play, oop, there we go. Okay so you get the
  • 20:35 - 20:39
    idea so I i think that I've kind of
    completed this and there's a lot of
  • 20:39 - 20:43
    improvements that would want to make to
    this in terms of being more thoughtful
  • 20:43 - 20:47
    about checking that intersection to be a
    bit more precise good enough though..
  • 20:47 - 20:47
    be a bit..
  • 20:47 - 20:53
    I could do a better job of picking the,
    the way that.. oh here's a difficult one;
  • 20:54 - 20:58
    a better job of how I pick the top and
    bottom heights of these rectangles
  • 20:59 - 21:03
    I could add score, right? You start with
    a score maybe as time goes on your
  • 21:03 - 21:06
    score goes up every time you hit a pipe
    the score goes down, all those things.
  • 21:06 - 21:12
    I would say umm ask me your questions in
    the comments, suggest, make versions of
  • 21:12 - 21:17
    this and tweet me your exciting,
    doesn't you know.. you could make a nice bird
  • 21:17 - 21:21
    design you can reimagine this entire
    game to not be a bird and pipes but to be
  • 21:21 - 21:24
    you know a flower and rainbows I don't
    know how that would work
  • 21:25 - 21:28
    so ummm
  • 21:28 - 21:32
    tweet me and share with me all of
    your interesting variations on this and
  • 21:32 - 21:36
    I'll maybe come back and do some Q&A
    video where I follow up on some of your
  • 21:36 - 21:39
    questions and make some improvements to
    this flappy bird challenge. Okay, thanks
  • 21:39 - 21:43
    for watching and I will see you in a
    future coding challenge.
  • 21:43 - 21:43
    Goodbye.
Title:
Coding Challenge #31: Flappy Bird
Description:

more » « less
Video Language:
English
Duration:
21:45

English subtitles

Revisions