Leaderboards, bumping other players and death traps

Hey, I was wondering; most of the game i have actually finished coding, however I am struggling with getting the players to bump each other and also getting the traps to kill the players not to mention i don't know how to add a leaderboard similar to slither.io.

PLAYER CODE:

public void OnSyncedCollisionEnter(TSCollision other) { if (other.gameObject.tag == "Food") { // grow slow and destroy food currentScale *= growSlow; // move food to a new place (deterministic randoms) TSRigidBody food = other.rigidbody; food.position = new TSVector (TSRandom.Range(-35,35),0,TSRandom.Range(-20,20)); } else if (other.gameObject.tag == "Player") { LockPlayer enemy = other.gameObject.GetComponent<LockPlayer> (); if (ss.Radius > enemy.ss.Radius) { // grow fast and eat other currentScale *= growFast; enemy.tsRigidBody.position = new TSVector (TSRandom.Range(-35,35),0,TSRandom.Range(-20,20)); enemy.currentScale = FP.One; //TrueSyncManager.SyncedDestroy(other); } } }


Death Trap Code:
public Transform player; public FP currentScale = FP.One; public FP growSlow = 1.125f; public FP growFast = 1.25f; private FP originalRadius; private Vector3 originalGraphicsScale; void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { LockPlayer enemy = other.gameObject.GetComponent<LockPlayer> (); other.gameObject.GetComponent<Animation> ().Play("Death"); } } }
Sign In or Register to comment.