Skip to content

Instantly share code, notes, and snippets.

@Samstiles
Created July 28, 2015 03:22
Show Gist options
  • Select an option

  • Save Samstiles/dafd9e7b9958a768c02b to your computer and use it in GitHub Desktop.

Select an option

Save Samstiles/dafd9e7b9958a768c02b to your computer and use it in GitHub Desktop.
ig.module(
'game.entities.player'
).requires(
'impact.entity'
).defines(function () {
EntityPlayer = ig.Entity.extend({
size: { x: 9, y: 15 },
checkAgainst: ig.Entity.TYPE.B,
animSheet: new ig.AnimationSheet('assets/placeholder.png', 9, 15),
maxVel: { x: 100, y: 100 },
speed: 100,
scale: 1,
jumping: false,
currentJumpingFrame: 0,
forwardSlashing: false,
backSlashing: false,
downSlashing: false,
gravityFactor: 0.5,
upSlashing: false,
_wmScalable: true,
bounciness: 0.1,
jump: function () {
this.vel.y = -50;
},
update: function () {
this.parent();
if (ig.input.pressed('jump') && this.standing === true) {
this.jump();
};
this.vel.x = ig.input.pressed('moveRight') ? 25 : ig.input.pressed('moveLeft') ? -25 : 0;
},
init: function (x, y, settings) {
this.parent(x, y, settings);
this.addAnim('idle', 0.1, [0]);
this.addAnim('jumping', 0.1, [1])
},
handleMovementTrace: function (res) {
this.parent(res);
},
check: function (other) {}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment