Coder Social home page Coder Social logo

autoanimationcreatordemo's Introduction

AutoAnimationCreatorDEMO

Automatically generates animations in Godot for 2D sprites

This project shows you how to implement an automated animation creation system for your 2D games in Godot.

Please feel free to download, use, and modify this project, but please do not redistribute it as your own, because I worked hard on this and you're probably a cool person who doesn't take credit for other peoples' work, right? Sweet!

For this sytem to work as-is, you must:

1.Create a spritesheet for your animation.

  • All sprites in this spritesheet should be the same dimensions, which means that you should probably pad your artwork in some empty pixels so that there's room for your chracters to move without changing the size of the sprite itself.
    • For example: sprites in the hastily thrown together sample sprites here are all 96 x 96 pixels, but the circle and square are only 64x64 pixels. There's a 16 pixel transparent border around them at all times.
  • The frames should go left to right for a single direction of the animation, and the full animation for the given direction should be on the same line.
    • For example: All of the frames for your RunSouth animation should be in the first row of your spritesheet.
  • The order of animations should be, from top to bottom: South, Southeast, East, Northeast, North, Northwest, West, Southwest
    • This is the order they are added and assigned to the blend tree in the current code. You can modify this in the create_character_animations() function if you want to.

2.Fill in the Godot Sheet with the file name.

  • Ensure that the CHARACTER_SPRITESHEETS_PATH points to the directory where you store your assets.
  • The name of the character (which should match the exported charater_name variable on OverworldCharacter.gd) goes into the row label.
  • The name of the animation goes into the column label.
  • The file name of the animation goes into the approrpiate cell in the table.
    • For example: Default's Run cycle file name is DefaultRun.png, so I paste that into the Run column in the Default row.

3.If your sprites look strange or you get errors, check the following:

  • Ensure that the CHARACTER_SPRITESHEETS_PATH points to the directory where you store your assets.
  • Ensure that the DEFAULT_CHARACTER_SPRITE_SIZE matches your sprite size (inlcuding the added transparent pixels).
  • Ensure that CHARACTER_ANIMATIONS_LIBRARY's value matches the name of your Godot Sheet.
  1. EXTRAS:
  • If you want to add new tracks to the aniamtions, you would do so in the create_character_animations() function before the character.animPlayer.add_animation() call.
    • Define a track variable with the var track_name := anim_to_add.add_track() format.
    • Use that variable in a anim_to_add.track_set_path(track_name, path) call to set the pat for the track to use (i.e. what property to change, like rotation, size, etc.)
    • Use anim_to_add_.track_set_key(track_path, timestamp, value) to set up a keyframe at timestamp seconds (a float) with value parameters.

If you still have problems or you have questions about this, you can reach out to me in the comment section where I posted this on Reddit. I'm happy to help if I can.

autoanimationcreatordemo's People

Contributors

thedoorworlds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.