Game Overview
Grapple was a game made for BaconGameJam 10, with the theme "One Weapon - Many Uses". As a team, we decided that our weapon should be a grapple as you can pull, hook shot to damge enemies and hook shot you to parts of the map. Our levels were carefully designed so that you can stealth around each enemy undetected whilst still being a challenge towards the player.My Role
What went well?
What can be improved?
Enemy Roam:
A code sample taken from the enemy script that deals with chosing the path of where the enemy should go using a list of positions.public void Roam() { Vector3 position = transform.position; if (roamPositions != null && roamPositions.Count > 1) { Vector3 destination = roamPositions[roamPositionIndex]; if (destination != position && currentPosition != destination) { agent.SetDestination(destination); currentPosition = destination; isAtPosition = false; } else if (position == destination && !isAtPosition) { isAtPosition = true; //random timer on wait StartCoroutine(Wait(Random.Range(2.0f, 4.0f))); } else if (destination != position && !isAtPosition) { //if chased and no longer chasing - return back to normal path agent.SetDestination(destination); currentPosition = destination; isAtPosition = false; } } else if(position != startPosition) { agent.SetDestination(startPosition); } }
Enemy Chase:
A code sample taken from the enemy script that deals with the enemy chasing the player. When the player is in the view cone, the enemy will set its new destination to the players position within the world. The rotation function is there to stop the enemy from losing the player so easy.void RotateToPlayer() { //allows enemy to quickly rotate this.transform.LookAt(new Vector3(player_controller.transform.position.x, transform.position.y, player_controller.transform.position.z)); } public void Chase() { RotateToPlayer(); Vector3 playerPosition = (player_controller.transform.position); agent.speed = 4.0f; agent.SetDestination(playerPosition); }