- Home /
How do i make chaser in 2D enless runner?
Hello there, I'm new at programming and C# .This is my first project, so i ran into some problems. I wanted to make my spider chase the player, but what ever script i write, it either runs past the player and player doesnt die or i tryed with ragdoll and collision 2D but as expected it gets stuck into terrain. Any help or guidence ?
Answer by ThisGuyThatsHere · Feb 22, 2017 at 02:51 PM
Actually there is a simple solution, just make your spider move however you want, but, to check if player got caught you can get player position on x axis transform.position.x
and same for spider, subtract those values, get absolute value and this way you have the distance between player and spider. The last thing is to set the minimal distance and if it's closer you call something like player.Die();
I'm really greatfull, script is in my head already. Thank you !