1 decade ago by Oliver
Hi there, im pretty noob using impact so this is probably a easy quesiton...
Im trying to do a platform game, and want to make some elevators. The problem is that when i take the player entity on top of a elevator, the player CANT jump... he can move to the sides, but he CANT make a movement in Y axis until he gets away from the elevator.
this is my player entity:
and this is my elevator entity:
its driving me crazy, If someone has any idea of what could solve this problem i would really appreciate it.
Im trying to do a platform game, and want to make some elevators. The problem is that when i take the player entity on top of a elevator, the player CANT jump... he can move to the sides, but he CANT make a movement in Y axis until he gets away from the elevator.
this is my player entity:
ig.module( 'game.entities.jugador' ) .requires( 'impact.entity' ) .defines(function(){ EntityJugador = ig.Entity.extend({ type: ig.Entity.TYPE.A, collides: ig.Entity.COLLIDES.PASSIVE, checkAgainst: ig.Entity.TYPE.NONE, animSheet: new ig.AnimationSheet( 'media/jugador.png', 60, 100 ), size: {x: 60, y:100}, flip: false, maxVel: {x: 300, y: 800}, friction: {x: 1000, y: 0}, accelGround: 1000, accelAir: 1000, jump: 600, armaselec: 1, name: "jugador", init: function( x, y, settings ) { this.parent(x, y, settings); this.addAnim( 'idle', 1, [0] ); ig.game.jugador = this; armaselec = 1; }, update: function() { this.currentAnim = this.anims.idle; this.parent(); //mover el personaje var accel = this.standing ? this.accelGround : this.accelAir; if( ig.input.state('izquierda') ) { this.accel.x = -accel; this.flip = true; } else if( ig.input.state('derecha') ) { this.accel.x = accel; this.flip = false; } else { this.accel.x = 0; } if( this.standing && ig.input.pressed('saltar') ) { this.vel.y = -this.jump; } }, }); });
and this is my elevator entity:
ig.module( 'game.entities.plataforma' ) .requires( 'impact.entity' ) .defines(function(){ EntityPlataforma = ig.Entity.extend({ type: ig.Entity.TYPE.B, checkAgainst: ig.Entity.TYPE.NONE, collides: ig.Entity.COLLIDES.FIXED, animSheet: new ig.AnimationSheet( 'media/robotito.png', 20, 40 ), size: {x: 20, y: 40}, maxVel: {x: 100, y: 100}, flip: false, friction: {x: 150, y: 0}, speed: 80, gravityFactor: 0, init: function( x, y, settings ) { this.parent( x, y, settings ); this.addAnim( 'crawl', 1, [0] ); }, update: function() { this.parent(); }, }); });
its driving me crazy, If someone has any idea of what could solve this problem i would really appreciate it.