1 decade ago by Patrick_Ascher
Hello to everyone,
iam pretty new in impact and also my skills in JS are ok but not perfect. So i learning impact since 5 hours and now i have my first 3 questions.
Player Collisions:
in the short demo game i have a RPG player. The size of it is 32*48.
Is it possible to make the size of the COLLISION just 24px of the height? so that only the legs are collides? I saw that it is possible to resize it but only from the top to the bottom.
So it looks ok when i am in front of the water bucket.
But it looks wrong when i am standing in front of the tree.
Also a screenshot from the player with the full size and the half size.
Image: // Initialize your game here; bind keys etc. ig.input.bind(ig.KEY.UP_ARROW, 'up'); ig.input.bind(ig.KEY.DOWN_ARROW, 'down'); ig.input.bind(ig.KEY.LEFT_ARROW, 'left'); ig.input.bind(ig.KEY.RIGHT_ARROW, 'right');
Here is my player config:
so if you try to move: UP (release it) and the press realy quick LEFT or RIGHT after it and hold it, the Player is moving to the LEFT UPPER corner.
The same problem with multiple Keys LEFT+(UP/DONW) or RIGHT+(UP/DOWN) ... its not working if you press UP + (RIGHT/LEFT) or DOWN + (RIGHT/LEFT)
So its a little bit bugy when i am moving... becouse if press RIGHT+UP und release UP its also moving in the TOP RIGHT corner.
you can try it on my demo game.
LINK: DEMO
_______________________________________
And my last question: is there any method that i can check if ANY KEY is pressed in the INTRO? at the moment i bind it to UP.
Thanks,
Patrick
iam pretty new in impact and also my skills in JS are ok but not perfect. So i learning impact since 5 hours and now i have my first 3 questions.
Player Collisions:
in the short demo game i have a RPG player. The size of it is 32*48.
Is it possible to make the size of the COLLISION just 24px of the height? so that only the legs are collides? I saw that it is possible to resize it but only from the top to the bottom.
So it looks ok when i am in front of the water bucket.
But it looks wrong when i am standing in front of the tree.
Also a screenshot from the player with the full size and the half size.
Image: // Initialize your game here; bind keys etc. ig.input.bind(ig.KEY.UP_ARROW, 'up'); ig.input.bind(ig.KEY.DOWN_ARROW, 'down'); ig.input.bind(ig.KEY.LEFT_ARROW, 'left'); ig.input.bind(ig.KEY.RIGHT_ARROW, 'right');
Here is my player config:
init: function( x, y, settings ) { // Add animations for the animation sheet this.addAnim( 'down', 0.1, [0,1,2]); this.addAnim( 'left', 0.1, [3,4,5] ); this.addAnim( 'right', 0.1, [6,7,8] ); this.addAnim( 'up', 0.1, [9,10,11] ); // Call the parent constructor this.parent( x, y, settings ); }, update: function() { if( ig.input.state('up') ) { this.currentAnim = this.anims.up; this.vel.y = -100; } else if( ig.input.state('down') ) { this.currentAnim = this.anims.down; this.vel.y = 100; }else if( ig.input.state('right') ) { this.currentAnim = this.anims.right; this.vel.x = 100; } else { this.currentAnim.rewind(); this.vel.y = 0 this.vel.x = 0 } this.parent(); },
so if you try to move: UP (release it) and the press realy quick LEFT or RIGHT after it and hold it, the Player is moving to the LEFT UPPER corner.
The same problem with multiple Keys LEFT+(UP/DONW) or RIGHT+(UP/DOWN) ... its not working if you press UP + (RIGHT/LEFT) or DOWN + (RIGHT/LEFT)
So its a little bit bugy when i am moving... becouse if press RIGHT+UP und release UP its also moving in the TOP RIGHT corner.
you can try it on my demo game.
LINK: DEMO
_______________________________________
And my last question: is there any method that i can check if ANY KEY is pressed in the INTRO? at the moment i bind it to UP.
Thanks,
Patrick