I have a sprite that is attach to the camera and it is one the mid-ground layer. The player is a 2D sprite with a collider that moves forwards and backwards, and it can collide with objects in its path. The enemy/sprite collider is to trigger and hit or block the path of the player, preventing it from moving or killing it. My problem is that the player is on the foreground and the enemy is visible but not meant to block the path until trigger. I currently stuck on how to implement this. Any help would be great.
There’s no such thing as a “partial” collision, it either collides or doesn’t.
What you probably want to do is when the player collides with the enemy you call a function on the player to reduce its speed or reduce some stat over time(start a timer).
Or if the player moves closer to the enemy.position then you track that position data. As the player gets closer to the enemy then you increase the effect based off of the position.
In other words. When the player collides with a trigger, call a function and create a unit of measure that changes > update variables based off of those changes.