Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ig.module(
- 'game.entities.Player'
- )
- .requires(
- 'impact.entity'
- )
- .defines(function() {
- EntityPlayer = ig.Entity.extend({
- size: {x: 150, y: 32},
- collides: ig.Entity.COLLIDES.FIXED,
- animSheet: ig.AnimationSheet('media/player.png', 150, 32),
- anim: ig.Animation,
- init: function(x, y, settings) {
- this.parent(x, y, settings);
- this.addAnim('anim', 0.1, [0]);
- },
- update: function() {
- if (ig.input.state('down')) {
- this.vel.y = 200;
- console.log("down");
- }
- if (ig.input.state('left')) {
- this.vel.x = -200;
- console.log("left");
- }
- if (ig.input.state('right')) {
- this.vel.x = 200;
- console.log("right");
- }
- if (ig.input.state('up')) {
- this.vel.y = -200;
- console.log("up");
- }
- if (ig.input.state('fire')) {
- console.log("fire");
- }
- if (ig.input.state('bomb')) {
- console.log("bomb");
- } else {
- console.log('none');
- }
- this.parent();
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment