playif / play_phaser

A Dart port for Phaser 2D game engine.
MIT License
71 stars 13 forks source link

Question - Getting error when trying to return from a function (via a Completer) once a sound stops. Why? #32

Open TheIceMageX50 opened 9 years ago

TheIceMageX50 commented 9 years ago

I have a function like this that plays a sound and I want it to return only once the sound stops so I am trying to use a Completer.

  Future<bool> playAttackSound(AttackType type)
  {
    Sound s;
    Completer comp = new Completer();

    switch (type) {
    //init s based on type 
    ...
    }
    s.onStop.addOnce((Sound foo) => comp.complete(true));
    s.play();
    return comp.future;
  }
}

But...when I run my game once the sound plays I get these errors.

Closure call with mismatched arguments: function 'call'

NoSuchMethodError: incorrect number of arguments passed to method named 'call'
Receiver: Closure: (Sound) => dynamic
Tried calling: call(Instance of 'Sound', "")
Found: call(foo)

What's going on here?

derrick56007 commented 9 years ago

Seems like a bug to me

TheIceMageX50 commented 9 years ago

And judging by their seeming (Github) inactivity I guess @playif is somewhat busy one way or another at the moment, huh?

mbenatti commented 9 years ago

@TheIceMageX50 its true, i thinking, what do you think to create a team to do a other updated port of phaser ? how is able?

TheIceMageX50 commented 9 years ago

I wouldn't really be able to commit much time to such things at least for another few weeks but I wouldn't mind trying to help sometime. I'd kind of like to wait and see if @playif comes back around sometime soon though. If any of us could figure out what's going on with some bugs (like this one) we could always make pull requests on this repo.