Resizing AnimatedSprite2D Frames In Godot 4

Поділитися
Вставка
  • Опубліковано 10 січ 2025

КОМЕНТАРІ • 15

  • @wamiqurrehman093
    @wamiqurrehman093  2 дні тому

    🎮 Want to learn how to create multiplayer games? 🚀
    Check out my Udemy course: "Learn Multiplayer Game Development in Godot"!
    🌟 In this course, you’ll learn:
    ✅ Networking basics
    ✅ Real-time multiplayer mechanics
    ✅ Syncing player actions seamlessly
    👉 Enroll now: www.udemy.com/course/learn-multiplayer-game-development-in-godot/?referralCode=1270677B0DF0861982DB
    Take your game dev skills to the next level! 🎮💻

  • @jonathanoneil2010
    @jonathanoneil2010 8 днів тому

    Thank you for this. Definitely appreciate how much you pointed to the documentation; I wasn't aware there were buttons which would open the class doc directly in the editor's interface!
    Your instructions worked. Only caveat I see is the image distortion that occurs after multiple resizes. But this works for now.
    Thanks!

  • @timetorelaxfocus9642
    @timetorelaxfocus9642 2 місяці тому

    This is ok. FYI, the sprite and animation editor is built-in GDevelop.

  • @truenincillo805
    @truenincillo805 2 місяці тому

    extends AnimatedSprite2D
    func _ready() -> void:
    var animation_names: PackedStringArray
    animation_names = sprite_frames.get_animation_names()
    for animation_name in animation_names:
    var frame_count: int
    frame_count = sprite_frames.get_frame_count(animation_name)
    for frame_index in frame_count:
    var frame_texture: Texture2D
    var frame_duration: float
    frame_texture = sprite_frames.get_frame_texture(animation_name, frame_index)
    frame_duration = sprite_frames.get_frame_duration(animation_name, frame_index)
    var resized_frame_texture: Texture2D
    resized_frame_texture = frame_texture
    if frame_texture.get_size() != Vector2(64, 64):
    var frame_texture_image: Image
    frame_texture_image = frame_texture.get_image()
    frame_texture_image.resize(64, 64, Image.INTERPOLATE_NEAREST)
    resized_frame_texture = ImageTexture.create_from_image(frame_texture_image)
    sprite_frames.get_frame(animation_name, frame_index, resized_frame_texture, frame_duration)
    I have tried it for mobile version godot 4.3, it does not work, I want to scale the animatedSprite2d images🤔

    • @wamiqurrehman093
      @wamiqurrehman093  2 місяці тому

      Are you using Godot Editor on mobile or you are exporting to mobile?

    • @truenincillo805
      @truenincillo805 2 місяці тому

      @@wamiqurrehman093 usin in mobile godot

    • @truenincillo805
      @truenincillo805 2 місяці тому

      @@wamiqurrehman093 no found in mobile godot

    • @truenincillo805
      @truenincillo805 2 місяці тому

      ​@@wamiqurrehman093no found in mobile godot

    • @truenincillo805
      @truenincillo805 2 місяці тому

      @wamiqurrehman093
      I have put
      extends AnimatedSprite2D
      func _ready() -> void:
      scale.x = 8
      scale.y = 8
      The scale of all the sprites is changed, but I don't want all of them, like ago to be the ones I choose (for example, I want it to reduce the scale of ((player0 is 64x64)) I want it to reduce the scale