Gluttony (formerly The Five Second Game)

Show off your games, demos and other (playable) creations.
User avatar
MarekkPie
Inner party member
Posts: 587
Joined: Wed Dec 28, 2011 4:48 pm
Contact:

Gluttony (formerly The Five Second Game)

Post by MarekkPie »

Gluttony

The object is to eat as many good pieces of food as you can before the timer expires. Here are the game rules:

Good food (green)
  • Worth 10 points;
  • Increases your countdown clock by one second;
  • Increases your radius by 1.
Bad food (red)
  • Subtracts 5 points;
  • Decreases your countdown clock by 0.2 seconds;
It's simple, but I think it's pretty fun. Since you get fatter each time you eat a good food item, it becomes more and more difficult to avoid the bad food items the more good food you've eaten.

Changelist:
Version 0.2
  • Added a simple, event based menu system;
  • Added a simple tutorial that is played on initial launch;
[/i]

To do:
  • Change art to something more appealing;
  • Add local high score tracking;
  • Add sound;
Attachments
Gluttony_0.2.love
Uploaded 1/2/2011
(7.98 KiB) Downloaded 214 times
Last edited by MarekkPie on Mon Jan 02, 2012 6:39 pm, edited 3 times in total.
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: The Five Second Game

Post by Tesselode »

I think the problem is that you're calling tween in the update loop. You only need to call it once.

Edit: also, you might want to add a way to restart the game. Also, you might want to increase the number of sides the circle has as its radius gets bigger so it doesn't look ugly.
User avatar
MarekkPie
Inner party member
Posts: 587
Joined: Wed Dec 28, 2011 4:48 pm
Contact:

Re: The Five Second Game

Post by MarekkPie »

Tesselode wrote:I think the problem is that you're calling tween in the update loop. You only need to call it once.

Edit: also, you might want to add a way to restart the game. Also, you might want to increase the number of sides the circle has as its radius gets bigger so it doesn't look ugly.
Thanks. Just woke up, so I'll test that out.

I'm working on a menu and a simple tutorial screen, but right now just press F2 to restart. Forgot to mention that in the original post.

EDIT: Whoops, just noticed F2 doesn't reset the player size. I'll update the .love in a second.
User avatar
MarekkPie
Inner party member
Posts: 587
Joined: Wed Dec 28, 2011 4:48 pm
Contact:

Re: The Five Second Game

Post by MarekkPie »

So, I'm working on giving the game a menu screen. The way I plan to do it is have separate love callbacks for the two game states: menu state, and play state. However, as I was not really thinking about this last night, I failed to initially define a namespace for the play state, as it was the only state at that point.

I know Lua doesn't natively support namespaces in the traditional sense, so my understanding is that people simply wrap a table around their code and call it a namespace. My only issue is that I'm not sure it will work with my current set up. Here is my dilemma:

Code: Select all

namespace = {
	x = 0
	y = 0
	
	function A(n) return n end	-- Is the key for this 'A' or '1'?
	function B() return A(0) end
	
	x = function B()			-- Will I be able to call B() while still inside namespace?
}

namespace.x = namespace.B()		-- Or will I have to be outside of the declaration before I can do any calls?
I would like to be able wrap the love callbacks in the namespace as well, so that from menu, when the player pushes "PLAY," I can just call the play state's love.load().

Any help would be appreciated. Even if it is a "you're doing it wrong, here is a better way."
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: The Five Second Game

Post by Tesselode »

You could just use hump.gamestate.

http://love2d.org/wiki/hump
User avatar
MarekkPie
Inner party member
Posts: 587
Joined: Wed Dec 28, 2011 4:48 pm
Contact:

Re: The Five Second Game

Post by MarekkPie »

Thanks for the idea.

It seems that I'd still need to rewrite a ton of code in order to get that to work properly. Was hoping for a much simpler solution, but that might not be possible.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: The Five Second Game

Post by kikito »

Hi,

Did you resolve your problem with tween, or do you still need help there?

Code: Select all

gamestates
Change the love.* functions from the inside, not from the outside. It's much easier this way:

Code: Select all

function love.update(dt)
  gameState.update(dt)
end

function love.draw()
  gameState.draw()
end
And then:

Code: Select all

Play = {
  update = function(dt)
  end,
  draw = function()
  end
}

function love.load()
  gameState = Play
end
You can't do that with love.load since there must be only one call to love.load(). But you can add load() functions to the states and call them when you change the state:

Code: Select all

Menu = {
  load = function()
    -- load stuff here
  end,
  unload = function()
    -- unload stuff here
  end
}

function gotoState(newState)
  if type(gameState.unload)=="function" then gameState.unload() end
  gameState = newState
  if type(gameState.load)=="function" then gameState.load() end
end

function love.load()
  gotoState(Menu) -- always use gotoState to change gameState. Never change gameState directly
end
By the way, this might be a good moment to split the game in several files, if you haven't already.
When I write def I mean function.
User avatar
MarekkPie
Inner party member
Posts: 587
Joined: Wed Dec 28, 2011 4:48 pm
Contact:

Re: The Five Second Game

Post by MarekkPie »

Thanks kikito.

I am still having some trouble with tween, but I am rewriting from the ground up to accommodate for game states, so I am not at the point to start thinking about them again.

I ended up doing something very similar to what you suggested for game states. That also happens to be similar to how PiL talks about namespaces (or packages).

http://www.lua.org/pil/15.1.html

I am also taking the opportunity to try out all the random features within LOVE I can with the rewrite, so I am looking at the using the framebuffer. In the tutorial thread on the Framebuffer wiki page, they used love.graphics.draw() exclusively. Can I use other love.graphics functions to draw onto the framebuffer? I don't want to build any art at the moment, so I am using the primitives supplied by love.graphics (circle, rectangle, print). Can I draw those onto the framebuffer? I tried both implementations fb:renderTo(function()) and love.graphics.setRenderTarget(fb) and they both give me a black screen.

Here is the updated version of the five second game. I renamed it to Gluttony because I thought it fit better.
Attachments
Gluttony.love
(4.03 KiB) Downloaded 160 times
User avatar
Ryne
Party member
Posts: 444
Joined: Fri Jan 29, 2010 11:10 am

Re: The Five Second Game

Post by Ryne »

fun game, I was kinda bored earlier so I created some quick graphics.

hope you don't mind, you can feel free to use these if you like.

Image

Image

Image

Image



* that white circle is the selector


** resources, can be resized if need be.

http://d.pr/fi4R
Last edited by Ryne on Mon Jan 02, 2012 3:51 am, edited 1 time in total.
@rynesaur
User avatar
MarekkPie
Inner party member
Posts: 587
Joined: Wed Dec 28, 2011 4:48 pm
Contact:

Re: The Five Second Game

Post by MarekkPie »

That's awesome, Ryne. Thanks a bunch.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest