Skip to content

Boss enemies animation

ShiyanSu edited this page Oct 18, 2021 · 11 revisions

Purpose

The purpose of boss enemies is to enhance the enemy interactivity with the player character. The dynamic enemies also improve the game visual presentation and make the play feels more engaging in the game, which increases the fun of the game. Different animation effects on the different enemies will not make the player feel bored and repetitive and thus improves the game user retention.

Design

Each enemy's animation effect consists of 6 to 8 frames and it is designed on Adobe Illustrator frame by frame. Each enemy has a unique animation pattern as follows:

  • Blue octopus: In order to shoot bullets at the player, Mr Octopus has to extend tentacles to load bullets. The animation indicates how Mr Octopus spread his tentacles to start the attack mode. soldier

  • Yellow box: Funny Yellow Box is as cute as its appearance looks. Instead of having an aggressive action, it waves to the player but it still shoots the player to ensure its personal safety. monster

  • Spider queen: As the evilest enemy in the game, it turns its eye colour and magic feet to red. This signal animation present the danger signal to remind the player to not come closer. alien_boss_animation

  • Green bee: Its animation indicates how it extends the sting and flaps its wings. bird

  • Sleepy squid: As you can tell from its name, sleepy squid is sleepy all the time. Thus, the animation shows how it closes its eyelid and start yawning.

squid

Implementation

Key components

  • alienMonster.atlas alienBoss.atlas alienSoldier.atlas alienWasp.atlas alienSquid.atlas This file sets up different animation effects for boss enemies.
  • ObstacleAnimationController This class is used to listens to events relevant to the both enemy and obstacle state and plays the animation when one of the events is triggered.
  • EnemyFactory Implement the animation effect for enemies within each function that creates the enemy entity.

Usage

  1. Write the .atlas file of the animation for the enemy based on the animation image. For example, when we want to create the animation effects for the alien soldier enemy, we firstly need to create and modify the alienSoldier.atlas. The float corresponds to the animation event in the game and the index number indicates the animation play order for the alien soldier.
alien_soldier_animation.png
size: 2048, 256
format: RGBA8888
filter: Nearest, Nearest
repeat: none
float
  rotate: false
  xy: 2, 2
  size: 230, 190
  orig: 230, 190
  offset: 0, 0
  index: 2
float
  rotate: false
  xy: 234, 2
  size: 230, 190
  orig: 230, 190
  offset: 0, 0
  index: 7
float
  rotate: false
  xy: 466, 2
  size: 230, 190
  orig: 230, 190
  offset: 0, 0
  index: 4
float
  rotate: false
  xy: 698, 2
  size: 230, 190
  orig: 230, 190
  offset: 0, 0
  index: 1
float
  rotate: false
  xy: 930, 2
  size: 230, 190
  orig: 230, 190
  offset: 0, 0
  index: 6
  1. Add the animation when creating the enemy entity in the EnemyFactory class. For example, when we want to create the animation for the alien soldier enemy, there are three aspects that have to be considered and implemented. Firstly, create the WanderTask for the entity:
AITaskComponent aiComponent =
                new AITaskComponent()
                        .addTask(new AttackTask(target, 3, 10, 10f))
                        .addTask(new WanderTask(new Vector2(0f, 0f), 0f));

Then, create the AnimationRenderComponent to the entity, and the passing asset when initialising the component should be the AlienSoldier.atlas:

AnimationRenderComponent animator =
                new AnimationRenderComponent(
                        ServiceLocator.getResourceService()
                                .getAsset("images/alienSoldier.atlas", TextureAtlas.class));
        animator.addAnimation("float", 0.2f, Animation.PlayMode.LOOP);

Finally, add the AITaskComponent, the AnimationRenderComponent and the AnimationController to the entity:

Entity alienSoldier =
                new Entity()
                 .addComponent(aiComponent);
alienSoldier.addComponent(animator)
                .addComponent(new ObstacleAnimationController());

Table of Contents

Home

Introduction

Main Menu

Main Game Screen

Gameplay

Player Movement

Character Animations

Enemy Monster Design and Animations

Game basic functionalities

User Testing

GitHub Wiki Tutorial

Game Engine

Getting Started

Documentation

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