HUMP - yet another set of helpers

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Sslaxx
Citizen
Posts: 57
Joined: Sat Feb 14, 2009 8:54 pm
Location: Malvern, Worcs, UK
Contact:

Re: HUMP - yet another set of helpers

Post by Sslaxx »

Thanks for clearing that up. Hmmm, seems the way I've structured the code is going to need to be changed though, as fixing that now gives:
boot [string "Code/gamestate.lua"]:4: Gamestate not initialized. Use Gamestate.switch() stack traceback:
[string "boot.lua"]:833: in function 'error_printer'
[string "boot.lua"]:768: in function <[string "boot.lua"]:766>
[C]: in function 'error'
[string "Code/gamestate.lua"]:4: in function 'leave'
[string "Code/gamestate.lua"]:31: in function 'switch'
[string "main.lua"]:138: in main chunk
[C]: in function 'require'
[string "boot.lua"]:282: in function <[string "boot.lua"]:215>
[C]: in function 'xpcall'
[string "boot.lua"]:838: in main chunk
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: HUMP - yet another set of helpers

Post by vrld »

Whoops, my bad :oops: . This was caused because the initial error-throwing state also threw an error when leaving, which it does when switching to your initial state. This is hopefully fixed now.
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: HUMP - yet another set of helpers

Post by vrld »

I updated hump. The short:
  • vector has fast rotation by 90° and projection onto other vector (with some sketches in documentation)
  • added ringbuffer, a circular data structure
  • added scene/sequence management for intros/cutscenes/outros
The documentation is available here. The sections about the ringbuffer and sequence management are of particular interest:
http://vrld.github.com/hump/#ringbuffer.lua
http://vrld.github.com/hump/#sequence.lua

You can get the sourcecode from github: http://github.com/vrld/hump
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
bartoleo
Party member
Posts: 118
Joined: Wed Jul 14, 2010 10:57 am
Location: Savigliano

Re: HUMP - yet another set of helpers

Post by bartoleo »

Small request:
in gamestate - push & pop gamestates with events

Another request... compatibility with Love 0.7.0?
Bartoleo
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: HUMP - yet another set of helpers

Post by nevon »

bartoleo wrote:Another request... compatibility with Love 0.7.0?
It should be perfectly compatible with 0.7.0.
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: HUMP - yet another set of helpers

Post by vrld »

bartoleo wrote:in gamestate - push & pop gamestates with events
I'm not sure I can follow you on that one. Could you give an example of what you mean?
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
bartoleo
Party member
Posts: 118
Joined: Wed Jul 14, 2010 10:57 am
Location: Savigliano

Re: HUMP - yet another set of helpers

Post by bartoleo »

think about a game with specific states
like a jrpg like final fantasy game:
a gamestate could be the 'exploration' part
another one the combat
so
intro/menu->game->combat and then return to game
intro/menu switch to game
push game and go to combat
on leaving combat pop game as it was

or another one could be
game->menu/inventory system
Bartoleo
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: HUMP - yet another set of helpers

Post by vrld »

That's what the first parameter of Gamestate:enter is for:

Code: Select all

-- assuming menu 
menu = Gamestate.new()
function menu:enter(previous)
    self.previous = previous
end

function menu:update(dt)
    -- do stuff
    if timeToLeave then
        Gamestate.switch(self.previous)
    end
end
Note that if you do initialization stuff in self.previous:enter you have to skip it if returning from the menu, possibly like so:

Code: Select all

function game:enter(previous, more, args)
    if previous == menu then return end
    -- more stuff
end
If you want abstraction, you can build push/pop operations on top of that. But as I want hump to be simple and small, I wont implement this.
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
bartoleo
Party member
Posts: 118
Joined: Wed Jul 14, 2010 10:57 am
Location: Savigliano

Re: HUMP - yet another set of helpers

Post by bartoleo »

yes...
Thank you for the quick reply
Bartoleo
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: HUMP - yet another set of helpers

Post by vrld »

I added a new module: timer.lua. Despite it's name it does not only offer a timer (delayed function calls), but also a function which helps to create functions that change behavior depending on how much time has passed (e.g. fading the background, ...).

The documentation is available here: http://vrld.github.com/hump/
You can see and download the source-code on github: http://github.com/vrld/hump

Edit: Added "oscillators" in addition to interpolating function.
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
Post Reply

Who is online

Users browsing this forum: No registered users and 140 guests