Hi, thanks for reading my post, here is the thing i need :
I want to make only one ennemy in my 2d plateformer game, and it’s a boar.
Here is the actions i want it to do :
-
Base state : Idle, the boar stays still until the player touch the collider like 5 “blocks” before it to trigger it.
-
Triggered state : When the collider is touched, a small animation (it just raise his head up) starts and after that, the boar starts to charge the player.
-
Charging state : It plays just after the small triggered anim. The boar runs to the left .Its movements are linear, the boar just goes right ahead, and if is on edge on a collision or touch an object (an element or the player), it just goes into the inverse direction, without another animation.
Finally, When it is starting to charge to the left, if it isn’t visible from screen, it should disapear. It can’t respawn too.
Well, sorry about my bad english guys, hope you can help me !
Ho and i forgot (sorry), if it hits the player, it starts the player hit animation and the boar just goes in the other direction, that’s all. I would like to have 2 health bars : one for the player and one for her bag (don’t ask me why :x), and so the boar inflicts 1 point of damages on the player and bag health (3 is the max amount of life / bag).
There’s a lot here. You should break down the problem and solve each piece one by one.
- First, just try to get a trigger collider working and print a log statement when the player gets close. Simple!
- Next, set up an animation for picking up the boar’s head. Just make it happen Don’t worry about triggering the animation with the collider yet.
- Last, get the charging behavior working. Again, don’t try to hook it up to the animation or the trigger yet. Just get it working independently in a world with just the boar and a platform (and maybe a player to test the colliding with player functionality)
Get all of those working well on their own, then start thinking about combining them. Feel free to come back here when you run into trouble with any of the pieces.
Thank you so much for your quick reply ! I am just finishing my collisions and i am trying it
I will tell you if it works