/// <summary> /// Determines if player has touched totem yet /// </summary> /// <param name="p"></param> Player /// <param name="t"></param> Totem /// <returns></returns> public bool Collision(Player p, Totem t) { Rectangle pRec = new Rectangle(p.x, p.y, p.size, p.size); Rectangle tRec = new Rectangle(t.x, t.y, t.size, t.size); if (pRec.IntersectsWith(tRec)) { return(true); } else { return(false); } }
/// <summary> /// Sets up everything for the new game /// </summary> private void SetUp() { totems.Clear(); players.Clear(); //Create a totem for each player Totem t = new Totem(100, 150, 500, 0); Totem tt = new Totem(500, 150, 500, 0); //Add totems to a list totems.Add(t); totems.Add(tt); P1 = new Player(t.x + 10, t.y - 82, 80, 8, player1); P2 = new Player(tt.x + 10, tt.y - 82, 80, 8, player2); players.Add(P1); players.Add(P2); }