[aquaria] button state at map switch

Mathias Panzenböck grosser.meister.morti at gmx.net
Sat Jun 19 13:26:21 EDT 2010


I'm not sure if this is the right way to do it but I implemented it by adding a new bool field 
wasCharging to the Game class. This is set in Game::removeState to avatar>isCharging() (if avatar != 
NULL) and at the end of Game::applyState I call avatar->startCharging(0) if wasCharging is true.

This way the charging amount is not remembered but charging restarts at scene switch. However, now 
it is possible to enter a scene switch while holding the charge button and releasing it during the 
scene switch animation which will cause charging to be started in the new scene even though the 
charge button is released. I think this is less annoying but it still isn't quite right.

It would be better if I would query if the "right mouse button" (might be another key) is down in 
applyState and then call avatar->rmbd(), but I haven't found out how to query if that's the case 
(haven't searched that long). I also tried this instead of if(wasChanged) { avatar->startCharging(0);}:
	if (core->getKeyState(ACTION_PRIMARY)) {
		avatar->action(ACTION_PRIMARY, 1);
	}
	
	if (core->getKeyState(ACTION_SECONDARY)) {
		avatar->action(ACTION_SECONDARY, 1);
	}
But it did not work.

Also I don't know if this is ok in any case, e.g. if there are scene changes where it is assumed by 
other parts of the game logic that the charging is canceled.

Here you can pull my changes, if you think they are ok:
http://bitbucket.org/panzi/aquaria

The changeset is:
http://bitbucket.org/panzi/aquaria/changeset/4f2aa8d12b82

	-panzi

On 06/17/2010 04:27 AM, Andrew Church wrote:
>> I think it would be ok when the button state would be queried when a new map is entered and if the
>> fire button is held a new charge up happens. I might have some time next week (starting Tuesday) to
>> look into it. Any hints on where (in which classes) I should start looking would be appreciated. :)
>
> Well, all Naija handling is in Aquaria/Avatar.cpp; charging in particular
> looks to be handled by Avatar::startCharge().  Probably what you'd want
> to do is query the current charge state before switching scenes (I'm not
> too familiar with that logic yet, but maybe take a look at
> Game::transitionToScene() as a starting point), then restore the charge
> state when the new Avatar instance is created in the new scene.
>
>> OT: I finally got to the place where you meet Li. I already needed to look at a game guide twice to
>> get this far. :/
>
> Patience, patience. (:  A lot of times, the solution to a puzzle is the
> one thing you think "nah, it couldn't be that", so try everything.
> I can confirm that it's completable without touching a FAQ, so good luck!
>
>    --Andrew Church
>      achurch at achurch.org
>      http://achurch.org/


More information about the aquaria mailing list