Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

PadroxDev

6
Posts
2
Following
A member registered Oct 25, 2021 · View creator page →

Creator of

Recent community posts

hey thank you very much ! 

I lack of time :_(

I'll rate your game, thanks for your coment !

Hey!

Your game is amazing, I love it!

I had so much fun playing it, it is so addictive . In addition the game is really polished: The sound effects and the vibrations, and just the feeling of the game is amazing!

You've done a really great job in only one week!

Well done!

I used the Unity Engine as well as CSharp programming language for all the programmes!

(1 edit)

Yeah I ran out of time, I had to concede some ideas, including sound ;(

Thanks for the reply!

Hey!

Thank you very much for the reply!

I have two constants: TargetDistance and RetreatDistance.

Then I calculate the direction from the AI to the Target (so the player). I also takes the magnitude of this vector to get the distance between them.

Then if the distance is greater than the TargetDistance I move the AI to the Direction * MoveSpeed, in the other case where the distance is lower than the RetreatDistance, I move the AI in the opposite direction (-direction * MoveSpeed).

Feel free to normalize the direction before moving, but I decided to keep its magnitude as it is to give it this high mobility and unpredictability.

In the final case where ( RetreatDistance < Distance < TargetDistance) I multiplied the Direction with a SinWave effect using (current Time *  SinWaysSpeed) * SideWaysAmplitude) and moved the ai in the new direction.

After this piece of code, I added a Raycast from the AI to it's normalized Direction with a parameter "RaycastRange" to detect the border.

If it hit the border I moved the AI to the Border's normal direction * MoveSpeed

Finally in my shoot method, I just added a Raycast shooting from the Ai to the target with the both Border and Player layer masks.

For this raycast I added a parameter to describe the range of the AI.

If it doesn't hit anything or the first hit element's tag is "Border", I return out of the function to prevent the AI to shoot.


I think that's it!

Don't hesitate if you have any questions, I'll be pleased to answer.

Have a nice day!