collinhover / impactplusplus

Impact++ is a collection of additions to ImpactJS with full featured physics, dynamic lighting, UI, abilities, and more.
http://collinhover.github.com/impactplusplus
MIT License
276 stars 58 forks source link

'stop' and 'once' parameters specified in EntityExtended.animSettings are ignored #30

Closed racingcow closed 11 years ago

racingcow commented 11 years ago

The stop or once parameters in animSettings are being ignored on an entities that extend ig.EntityExtended.

In the following entity, for example, the defaultAnim animation will repeat instead of playing once and then stopping.

ig.module(
        'game.entities.myentity'
    )
    .requires(
        'plusplus.core.config',
        'plusplus.core.entity',
        'plusplus.core.animation'
    )
    .defines(function () {

        var _c = ig.CONFIG;

        ig.MyEntity = ig.global.MyEntity = ig.EntityExtended.extend({            
            animSheet: new ig.AnimationSheet(_c.PATH_TO_MEDIA + 'myentity.png', 32, 32),
            animSettings: {                
                defaultAnim: {
                    frameTime: 0.1,
                    sequence: [0,1,2,1,0],                
                    once: true
                }
            }
        });
    });

I added a pull request https://github.com/collinhover/impactplusplus/pull/29. It should resolve this issue.

collinhover commented 11 years ago

Thanks for finding this issue! I've actually added a reverse option to animations, and it had the same issue you pointed out. I found a few other related fixes as I was working with your changes, so I've merged your fixes into this last commit. Seems to be working as expected... give the latest version of the dev branch a try and if it doesn't fix the problem please reopen this issue.

racingcow commented 11 years ago

I pulled the dev branch, and it is working great. Thanks, @collinhover .