@gc128 said:
1. Might not be related, but I need a way to center the animation frames, since it seems I can't do it natively in the AnimatedSprite Frames Editor.
To the best of my knowledge, AnimatedSprite assumes all of your sprites have the same center/origin position. You can change the center/origin position by changing the values in the offset
property, and you can change the positioning to use the top left of the sprite by unchecking the centered
property.
If each sprite has a different center/origin point, you may need to use another node (like a Sprite
node and a AnimationPlayer
) or you may need to change the origin/center point of the sprites in a image manipulation program like Gimp, Paint.net, or Photoshop.
- The animation code uses the regular Sprite, however I am using the AnimatedSprite, which I'm pretty sure has different code for, so it won't immediatelly work.
Sprite
can use animations with a sprite sheet (a bunch of sprites placed in a grid, where each grid element is a single frame of animation). These animations are set up with Vframes
, Hframes
and Frame
. Then either in code or using an AnimationPlayer
node, you change the number in Frame
every few seconds so it animates.
(I have not used AnimatedSprite
before, so this is mostly theoretical)
AnimatedSprite
uses a collection of images and changes the image file in the underlying Sprite
node so the AnimatedSprite
is animated.
With AnimatedSprite
, you would instead set up each animation you want and it's various frames in the AnimatedSprite
node. Then, instead of switching the Frame
property like you would with a Sprite
node, you'd instead call play("animation_name_here")
if/when you want to change animations.
- I also need a way to switch hitboxes/collision when ducking or jumping/spin attacking (they seem to share the same collision).
Make two collision boxes. For all of the collision boxes but the default collision box, set the Disabled
property to true
. Then, when you need to change collision boxes, just set the Disabled
property to true
on the collision box you do not want to use, and set the Disabled
property to false
on the collision box you want to use.
(For example, if you have two collision boxes, one for standing and one for ducking, you'd set the Disabled
property on the ducking collision box to true
when standing. Then, when you want to duck, you'd set the Disabled
property on the standing collision box to true
, and the Disabled
property on the ducking collision box to false
.)
- I'm trying to use the Sonic Physics Guide, and because of the way the walking is set up, the constants given won't work currently. However, I've tried to convert the example code given in the Guide, but I can't get anywhere around to working
(the abs function appears to not like floats)
I have no idea. I have not seen the Sonic Physics Guide before, so I cannot say whether I think the constants given in the guide will work or not. As for the example code, I would not be able to say without looking at it. If this answer from the Godot Q&A is anything to by, I'd say it's abs
is supposed to work with floats.
So, I'm not sure what to do next.
I would suggest reading/watching some Godot tutorials! It's a great way to learn how to use Godot, and should help get you familiarized with the engine! If you have any questions, feel free to ask them here on the forums :smile: