1 decade ago by Vertig0
Hi there,
I'm having a problem with my character crouching.
Here is my code:
And the part of crouch is here:
I try with input.pressed too, but doesn't work.
When i press "crouch" (down key) the character go down through the floor.
For example:
| <--- Player
_|_ <--- Floor
But afer pess crouch:
_|_
|
I'm thinking that i have to modify the animsheet, but i don't know how to do that. All the option i think give me an error.
Hope someone can help me.
Thknz!
I'm having a problem with my character crouching.
Here is my code:
EntityPlayer = ig.Entity.extend({ size: {x: 20, y:49}, maxVel: {x: 100, y: 200}, friction: {x: 600, y: 0}, type: ig.Entity.TYPE.A, // Player friendly group checkAgainst: ig.Entity.TYPE.NONE, collides: ig.Entity.COLLIDES.PASSIVE, animSheet: new ig.AnimationSheet( 'media/ss.PNG', 20, 49), flip: false, accelGround: 600, accelAir: 200, jump: 300, health: 10, flip: false, crouch:49/2, stand:49, crouched:false, jumping: false, //Continue...
And the part of crouch is here:
if(ig.input.state('crouch')) { this.size.y = this.crouch; }
I try with input.pressed too, but doesn't work.
When i press "crouch" (down key) the character go down through the floor.
For example:
| <--- Player
_|_ <--- Floor
But afer pess crouch:
_|_
|
I'm thinking that i have to modify the animsheet, but i don't know how to do that. All the option i think give me an error.
Hope someone can help me.
Thknz!