0 votes

hello there,
i have a character that is an AnimatedSprite which has my animations in it. idle/walk/jump and duck. i have set the collisionShape rectangle to it. but when i go to my animation duck the collisionshape doesnt fit the animation. it fits perfectly for idle/walk/jump but when i duck the collisionshape doesnt duck ;) hope you understand my problem here... how can i change the collisionshape for that specific animation in my animatedSprite to avoid for example a bullet by ducking in the game?
any help would be appreciated

in Engine by (14 points)

1 Answer

0 votes

The part of you code where your character ducks, just add a code of line there to change the collision shape :

$CollisionShape2D.scale.x = Your value 
$CollisionShape2D.scale.y = Your Value

You can use the Inspector tab which is the window on your right hand side where you will see Transform option under which there will be Scale in x and y provided. Tweak the shape using those and once you get a shape that fits well with your character when he is ducking, use the above code to put the values of x and y.

by (359 points)

hey scavex, thanks alot for your fast reply and help !!. kool, i will try this out asap...

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories