ippa/chingu

Pass a parameter to a gamestate?

Opened this issue · 1 comments

Hello, I am trying to pass a parameter to a gamestate and I can't find the way, and tried in the following ways:

switch_game_state(Play.new(parameter=100))
switch_game_state(Play, options={:parameter=>100})

but nothing. I have a simple class that inherits from Chingu::GameState, which has the method intialize(parameter).

Any help?

ippa commented

Are you sure you aren't doing something wrong? Gamestates are just ordinary classes which can take whatever arguments to new, which you then catch in initialize. If you haven't solved it by yourself yet I please put up your full code on github or pastie and reopen.

I guess you know there's a typo in your above code? "parameter=100"