Skip to content

Animations

acoox edited this page Apr 23, 2021 · 4 revisions

The game engine has a pre-made AnimationRenderComponent (code) which can be used to show animations on entities. This is a thin wrapper around libGDX's animation system, so it is recommended to read that before using animations.

Usage

Creating animations

Animations have to be created in libGDX's atlas format to be compatible with the animation component. You can generate an animation atlas from a series of still images, where each image represents a frame of animation. Some recommended tools that support this:

Adding animations to the game

Add an AnimationRenderComponent to the entity you want to render, then register each animation that's in the texture atlas. Start and stop an animation with startAnimation() and stopAnimation().

AnimationRenderComponent animator = new AnimationRenderComponent("player.atlas");
Entity player = new Entity().addComponent(animator);

// The animation name must match the name in the atlas
animator.addAnimation("walk", 0.1f);
animator.addAnimation("attack", 0.1f);
animator.addAnimation("jump", 0.1f);

// Now, we can start/stop the animation at any time
animator.startAnimation("walk");
animator.startAnimation("jump");
animator.stopAnimation();

Table of Contents

Home

Game

Game Home

Design Influences

Gameplay Features

Style

Story

Friendly Units
Map
City
Buildings
Unit Selections

Spell

Game User Testing: Theme of Unit Selection & Spell System

UI User Testing

Tutorial

Resource Stats Display

Loading Screen Bar

Health Bars
In Game menu
  • Feature
  • User Testing:In Game Menu

Landscape Tile Design

Landscape Tile Design Feedback

Weather Design

Weather Design Feedback

Camera Movement

Enemy design

Enemy Units

Enemy AI

How Animation Works

Map Flooding

Game Engine

Getting Started

Entities and Components

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Troubleshooting

MacOS Setup Guide

Clone this wiki locally