Flappy löve (Works on android! (theoretically))

Show off your games, demos and other (playable) creations.
User avatar
veethree
Inner party member
Posts: 877
Joined: Sat Dec 10, 2011 7:18 pm

Flappy löve (Works on android! (theoretically))

Post by veethree »

This was going to happen eventually and you all know it. A flappy bird clone.

It's pretty minimal at the moment, But i think it plays nicely. You just have an infinite game loop, Press any key to start, And the player starts falling, press up, W or space to "flap". If/when you crash into one of the pipe things, You die and the game starts over.

Note that it uses a shader and a canvas. If your machine doesn't support those, Too bad. (If you really want to play this and don't support shaders/canvases, You can edit the code yourself, all the shader stuff happens in game:draw in game.lua)

Enough text, Here's screenshots: (Outdated)
Image
You'll be seeing this alot
Image

In case you couldn't tell the design is based off the old forum banner.

I do not recommend looking through the code. Might give you a headache. I wasn't exactly thinking straight while coding this. (if you know what i mean)

Latest version available on github.
flappy.love
Up to date (Also theoretically works on android)
(228.64 KiB) Downloaded 209 times
Attachments
Flappy love.love
Initial release (OUTDATED AS FUCK)
(256.87 KiB) Downloaded 167 times
Last edited by veethree on Sat Feb 22, 2014 7:27 pm, edited 8 times in total.
User avatar
Doctory
Party member
Posts: 441
Joined: Fri Dec 27, 2013 4:53 pm

Re: Flappy löve

Post by Doctory »

I was just about to do this :ultrahappy:
Nice game.
Zarty55
Citizen
Posts: 79
Joined: Thu Jul 25, 2013 2:36 am

Re: Flappy löve

Post by Zarty55 »

Nice game.

Saw 2 bugs. When you lose and hit space bar the gravity won't work, obstacles don't spawn and score is being counted ;)
The background has a small gap that keeps blinking when the screen moves.
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Flappy löve

Post by josefnpat »

Can you FOSS this, so I can offer pull requests to make this an android game? ;)
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
User avatar
veethree
Inner party member
Posts: 877
Joined: Sat Dec 10, 2011 7:18 pm

Re: Flappy löve

Post by veethree »

josefnpat wrote:Can you FOSS this, so I can offer pull requests to make this an android game? ;)
Sure! What's FOSS?
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Flappy löve

Post by josefnpat »

Talked to veethree, he's pushed code to github!

https://github.com/v3p/flappy_love
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
User avatar
veethree
Inner party member
Posts: 877
Joined: Sat Dec 10, 2011 7:18 pm

Re: Flappy löve

Post by veethree »

Zarty55 wrote:Nice game.

Saw 2 bugs. When you lose and hit space bar the gravity won't work, obstacles don't spawn and score is being counted ;)
The background has a small gap that keeps blinking when the screen moves.
You have to press a key (any) to start the game. And i fixed the score being counted, Latest version on github. (link in the OP)
User avatar
Reef
Prole
Posts: 33
Joined: Sun Mar 04, 2012 10:19 pm

Re: Flappy löve (Works on android! (theoretically))

Post by Reef »

This is great! I've been playing around with your code a bit, and in the process of adapting it I've run into a little problem. I don't know if I'm better off asking in the help forum but my code is mostly based on yours so, I figured I'd just ask here.

For collision testing and debugging purposes I was trying to make the player change color while overlapping one of the walls but it doesn't seem to be working. I can make change the color upon collision, but then it doesn't revert to the original color when it is not colliding. Would you (or anyone else) mind taking a look? This is from main.lua

Code: Select all

-- collision, loop through walls
  for i,v in ipairs(wall.array) do
    for _,s in ipairs(v) do
      if checkCollision(player.x, player.y, player.size, player.size, s.x, s.y, s.width, s.height) then
        player.collision = true
      else
        player.collision = false
      end
    end    
  end
If I remove the else condition , the player will change color but not change back. With this else condition nothing happens.
Attachments
Flap.love
(1.84 KiB) Downloaded 80 times
User avatar
veethree
Inner party member
Posts: 877
Joined: Sat Dec 10, 2011 7:18 pm

Re: Flappy löve (Works on android! (theoretically))

Post by veethree »

Reef wrote:---
Couldn't tell you why, But that logic doesn't usually work. Try something like this:

Code: Select all

  player.collision = false
  for i,v in ipairs(wall.array) do
    for _,s in ipairs(v) do
      if checkCollision(player.x, player.y, player.size, player.size, s.x, s.y, s.width, s.height) then
        player.collision = true
      end
    end    
  end
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: Flappy löve (Works on android! (theoretically))

Post by Germanunkol »

@Reef, after finding a collision, you set the collision boolean, but then continue looping through the other values. So if there's any other value in the table where it doesn't collide, then the boolean is set back to false.

You could use a break command in the for loops, to jump out of the loops after the player.collision is set to true. Unless you need to call checkCollision on all tiles (even when you already know that it collided with one), then veethree's way is the best way to go.
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests