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 ForceiMck

Here is my code:


ig.module(
'game.entities.player'
)
.requires(
'impact.entity'
)
.defines(function() {

EntityPlayerSet = ig.Entity.extend({

size: {x:16, y:16},

collides: ig.Entity.COLLIDES.ACTIVE,

animSheet: new ig.AnimationSheet('media/ply.png'),

init: function(x,y,settings) {

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

},

update: function() {

if(ig.input.state('up')) {
this.vel.y = 100;
}
if(ig.input.state('down')) {
this.vel.y = -100;
}
if(ig.input.state('left')) {
this.vel.x = -100;
}
if(ig.input.state('right')) {
this.vel.x = 100;
}
this.parent();
}

});

});






Here is the error im getting:

SCRIPT5007: Unable to get value of the property 'length': object is null or undefined
game.js, line 49 character 19

1 decade ago by ForceiMck

Nevermind my problem was something with the map.

Now my problem is I cannot get the player to appear. It's entity exists on the map, although it wont appear. Here is my code:

ig.module(
'game.entities.player'
)
.requires(
'impact.entity'
)
.defines(function() {

EntityPlayer = ig.Entity.extend({

size: {x:16, y:16},

collides: ig.Entity.COLLIDES.ACTIVE,

animSheet: new ig.AnimationSheet('media/ply.png'),

init: function(x,y,settings) {

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

},

update: function() {

if(ig.input.state('up')) {
this.vel.y = 100;
}
if(ig.input.state('down')) {
this.vel.y = -100;
}
if(ig.input.state('left')) {
this.vel.x = -100;
}
if(ig.input.state('right')) {
this.vel.x = 100;
}
this.parent();
}

});

});

1 decade ago by Joncom

For the future, it will be much easier to help you and read your code if you enclose JavaScript with these tags ##

Looks something like this:

var example = function() {
    var code = 'much easier to read this way';
    return true;
}
Page 1 of 1
« first « previous next › last »