Practice 0: Add an Input Tag

Goal

  • Use Input Tag to allow the penguin performing other attacks.


Task

You might have noticed this: there exists two attack objects in the move set prefab.

Attack 2 and Attack 1 are almost identical, but only Attack 1 is triggered when you left click your mouse.

The reason is simple: Attack 2 does not have an Input Tag. No matter what button you clicked, it will never be triggered.

So now let's try to add an Input Tag to this State.

Input - lightAttack

Select light attack Input Tag from inspector.

Now run the game. You should find the penguin attacking with a new animation when you left click / press west button.


Question

Now one action state is overriding another. We don't really want that. We want the two action states form a combo that are triggered with a fixed order. When you left click twice, you should always see the penguin performing Attack1 first, then Attack2.

Why do they override each other like this?

In MoveSet, the actions are checked in a fixed order, from top to down.

In this case, Attack 2 compares its Input Tag with tags in Tag Container first, and successfully grabs the Light Attack tag from it. When checking Attack 1, there is no Light Attack tag anymore and it will not be triggered.

In short, they have different priority so Attack 2 will always be triggered before Attack 1. By dragging Attack 1 above Attack 2, you can find now it is Attack 1 which is triggered every time.

In the next steps, we will explain how to accomplish that.

Last updated