1 decade ago by henonchesser
So I'm working on a new project and I just need a second pair of eyes.
I'm creating an entity, very simple one for now. I can put it in maps but I can't see it. Nor does it respond to controls. I have a get entity function running in the main.js, so I know the entity is present. Maybe it's just a type or a good but I can't see it.
Using one plug in from this thread / Grid Walk
I'm creating an entity, very simple one for now. I can put it in maps but I can't see it. Nor does it respond to controls. I have a get entity function running in the main.js, so I know the entity is present. Maybe it's just a type or a good but I can't see it.
Using one plug in from this thread / Grid Walk
ig.module (
'game.entities.actor'
)
.requires (
'impact.entity',
'plugins.gridmovement'
)
.defines (function() {
EntityActor = ig.Entity.extend ( {
movement: null,
//LOCAL VARIABLES/////////////////////////////////////////////////////////
name: 'player1',
//Size, Bounds, Orientation
size: { x:24, y:24 },
offset: { x:0, y:0 },
flip: false,
zIndex:50,
gridSpeed: {x: 100, y:100},
animSheet: new ig.AnimationSheet( 'media/character.png', 24, 24 ),
init: function( x, y, settings) {
this.movement = new GridMovement(this);
this.addAnim( 'idle', 1, 1);
//defualt settings, overides anything before it
this.parent( x, y, settings);
}, //INITIALIZE
upate: function(x, y, settings){
this.currentAnim = this.anims.idle;
this.movement.update();
if (ig.input.state('left'))
this.movement.direction = GridMovement.moveType.LEFT;
else if (ig.input.state('right'))
this.movement.direction = GridMovement.moveType.RIGHT;
else if (ig.input.state('up'))
this.movement.direction = GridMovement.moveType.UP;
else if (ig.input.state('down'))
this.movement.direction = GridMovement.moveType.DOWN;
this.parent();
},
check: function(x,y,settings){
this.movement.collision();
},
draw: function(){
this.parent();
}
});
});
