itch.io is community of indie game creators and players

Devlogs

Implementing the player AI in unity

Mecha City Fighter
A browser game made in HTML5

I started to create a Unity component that trigger the Player action

This is the Idea of areas to cover around the player and which action he has to take depending of what triggers in the different areas.

In unity I created GameObjects with a component RuleCollision that has a Box Collider 2D, when something that is in the list of tags hits the collider it will make a random number and will pickup one of the actions. 

Here is a screenshot of my Component, the actions are linked to the player

To link the actions I used the   UnityEvent  that can be Invoked.

List of all the player actions (than the I A can trigger, but can also be used by the player in player mode)

How I invoke the action 

To select the action I calcule a random value , then I go thought all the actions and trigger the right action with Invoke.

I have a timer (speedchange) that stop for some time to trigger the action, if not the  player will move like crazy.. 

Download Mecha City Fighter
Read comments (2)