Projects

Fox in the Woods


A crafting base survival casual gameplay. You play as a fox with his bird friend and try to survive until the end of winter.

My Contributions

Player Mechanics

The fox needed to move where the player clicked in the world. To achieve this, I used the camera position and the mouse position to set where the fox would move.

The camera needed to follow the player but still feel smooth for a better experience. We also found that if the camera was offset from the center of the screen the player could see ahead of them and see more of what was to come.

I wanted the movement to feel smooth and responsive. Using the camera and mouse potion in the world the player could click and move the fox. We used sprite-based animations, so to make sure the fox was facing the direction of mouse click I split the screen to determined which way the fox would face.

Companion Mechanics

The player would click on the bird then drag the bird anywhere in a radius around the fox. When the player released the bird, it would fly off in that direction, then return to the player. The bird was used for attacking enemies and collecting items.

The bird followed the player using an offset. We wanted the bird close but not overlapping with the player. I adjusted the offset depending on which way the fox was facing to avoid any overlapping of the sprites. To keep the bird from snapping to the player I used linear interpolation so the bird would appear to slow down as it approached the position.

The slingshot of the bird took a lot of time to figure out. The aim was the trickiest to get down. Using an anchor position (the fox) and the mouse position, the start and end points were created. I used a rigid body on the bird and added force to the bird to have it fly off. When the bird returned to the player, I reset the velocity because we found it would keep building up force.

AI

The AI each had different behaviors but shared some commonalities. I used inheritance so I had a base script to pull from and update each individual enemy as needed.

The wolf was an aggressive enemy; it would patrol around waypoints, and - if the player was within a certain radius of the wolf - it would begin chasing the player and would not give up the chase.

The raccoon was a passive type of enemy. If the player got too close, the raccoon would attack; but if the player moved out of the radius, the raccoon would leave the player alone.

The enemy bird would only fly away from the player.

Pathfinding

I used the A* algorithm for the enemies’ movement. I wanted the enemies to follow anywhere the player went and at the time I thought this algorithm was the best choice. I’ve since learned more about pathfinding algorithms, and while the A* is a good choice for most cases, a simpler algorithm would have been better for this game. I learned a lot about A*, so I’m glad I spent the time to learn and implement it in this game.