Implementing the player AI in unity
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..
Get Mecha City Fighter
Mecha City Fighter
Steel Clash: Mech Madness!
Status | In development |
Author | Misterm |
Languages | English |
More posts
- Improving graphicsJul 30, 2023
- Improving Mecha Graphics and menuJul 30, 2023
- New AI LogicsJul 23, 2023
- Evolving Gameplay - A Sneak Peek Into Our Ambitious Game Development!Jul 22, 2023
- Post Jam Update releaseJul 20, 2023
- UpdateJul 20, 2023
- Released Mecha City FighterJul 19, 2023
Comments
Log in with itch.io to leave a comment.
Great article! I like your concept and how well you translated each part of it into Unity. This is really good stuff and a testament of your abilities to master such tough tasks.
Thanks!!