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 jch02140

When I tried to add an enemy type entity, the weltmeister editor and the game failed to load. They only load when I remove the entity js file that I created... I am not sure what is wrong in my code since I am still new to this engine...

Here is the js code for the entity:

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

.requires(
	'impact.entity',
	'plugins.box2d.entity'
)

.define(function(){

    EntityEnemy = ig.Box2DEntity.extend({
        size: {x: 18, y: 21},
        offset: {x: 4, y: 2},
        name: 'ghoul',
        health: 100,
        type.ig.Entity.TYPE.B,
        animSheet: new ig.AnimationSheet( 'media/ghoul.png', 18, 21),
        
        init: function( x, y settings){
            this.parent( x, y settings);
            // Add the animations
            this.addAnim( 'walk', 1, [0,1]);
        }
    })
});

1 decade ago by jGuille

I think the entity should be called EntityGhoul, not EntityEnemy.
That, or the line 'game.entities.ghoul' is wrong.

1 decade ago by jch02140

Hi jGuille,

I have changed the EntityEnemy to EntityGhoul but i am still having trouble loading the editor or the game...

1 decade ago by jch02140

Edit:

I have check the samples from the download area and the 'game.entities.ghoul' should be correct based on the filename... Here is the updated code:

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

.requires(
	'impact.entity',
	'plugins.box2d.entity'
)

.defines(function(){

    EntityGhoul = ig.Box2DEntity.extend({
        size: {x: 18, y: 21},
        offset: {x: 4, y: 2},
        name: 'ghoul',
        health: 100,
        type.ig.Entity.TYPE.B,
        animSheet: new ig.AnimationSheet( 'media/ghoul.png', 18, 21),
        
        init: function( x, y, settings){
            this.parent( x, y, settings);
            // Add the animations
            this.addAnim( 'walk', 1, [0,1]);
        }
    })
});

1 decade ago by Joncom

type.ig.Entity.TYPE.B,

..should be:
type: ig.Entity.TYPE.B,
Page 1 of 1
« first « previous next › last »