Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by manuelac

Trying to create a single Mage Entity, Weltmeister doesnt load and throws

Uncaught Unresolved (circular?) dependencies. Most likely there's a name/path mismatch for one of the listed modules:
weltmeister.weltmeister (requires: weltmeister.edit-entities)
weltmeister.edit-entities (requires: weltmeister.entities)
weltmeister.entities (requires: game.entities.mage)

Any idea what am I doing wrong? I am following the puck video! Thanks!

.requires {
'impact.entity'
}
ig.module {
'game.entities.mage'
}

.defines(function(){

EntityMage = ig.Entity.extend({

size: {x:48, y:48},
collides: ig.Entity.COLLIDES.FIXED,

animSheet: new ig.AnimationSheet( 'media/mage-1.png', 48, 48),

init: function(x, y, settings){
this.parent(x, y, settings);

this.addAnim( 'idle', 1, [0]);

this.vel.x = 0;
this.vel.y = 0;
},

update: function(){

if (ig.input.state('up')) {
this.vel.y = -100;
} else if (ig.input.state('down')) {
this.vel.y = 100;
} else {
this.vel.y = 0;
}

this.parent();
}
})

});

1 decade ago by lTyl

First, add ## in front of your code to enable syntax highlighting. This makes it much easier to read.

Second, you are using curly braces in your ig.module and .requires when it should be a bracket => ( ) and not { }.

Lastly, put your .requires AFTER your ig.module. So the final entity should look something like this:

ig.module (
    'game.entities.mage'
)

    .requires (
    'impact.entity'
)

.defines(function(){

    EntityMage = ig.Entity.extend({

        size: {x:48, y:48},
        collides: ig.Entity.COLLIDES.FIXED,

        animSheet: new ig.AnimationSheet( 'media/mage-1.png', 48, 48),

        init: function(x, y, settings){
            this.parent(x, y, settings);

            this.addAnim( 'idle', 1, [0]);

            this.vel.x = 0;
            this.vel.y = 0;
        },

        update: function(){

            if (ig.input.state('up')) {
                this.vel.y = -100;
            } else if (ig.input.state('down')) {
                this.vel.y = 100;
            } else {
                this.vel.y = 0;
            }

            this.parent();
        }
    })

});

1 decade ago by manuelac

Oh thank you very much for the response. It is working now! This is so good...
Page 1 of 1
« first « previous next › last »