Page 2 of 15

Re: HUMP - yet another set of helpers

Posted: Fri Aug 13, 2010 1:13 pm
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

Re: HUMP - yet another set of helpers

Posted: Fri Aug 13, 2010 1:36 pm
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.

Re: HUMP - yet another set of helpers

Posted: Tue Aug 17, 2010 8:05 pm
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

Re: HUMP - yet another set of helpers

Posted: Mon Sep 27, 2010 8:57 am
by bartoleo
Small request:
in gamestate - push & pop gamestates with events

Another request... compatibility with Love 0.7.0?

Re: HUMP - yet another set of helpers

Posted: Mon Sep 27, 2010 9:06 am
by nevon
bartoleo wrote:Another request... compatibility with Love 0.7.0?
It should be perfectly compatible with 0.7.0.

Re: HUMP - yet another set of helpers

Posted: Mon Sep 27, 2010 9:39 am
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?

Re: HUMP - yet another set of helpers

Posted: Mon Sep 27, 2010 9:43 am
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

Re: HUMP - yet another set of helpers

Posted: Mon Sep 27, 2010 10:07 am
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.

Re: HUMP - yet another set of helpers

Posted: Mon Sep 27, 2010 10:09 am
by bartoleo
yes...
Thank you for the quick reply

Re: HUMP - yet another set of helpers

Posted: Sun Oct 17, 2010 2:39 pm
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.