Beispiel #1
0
        //Collision between a polygon and a circle
        public static bool Collision(CircleHitbox circle, PolygonHitbox polygon)
        {
            bool value = false;
            foreach (Vector2 vector in polygon.Vectors)
            {
                if (circle.Contains(vector))
                {
                    value = true;
                    break;
                }
            }

            return value;
        }
Beispiel #2
0
        public Player(InGameState Game)
            : base(Game, new LineModel(Player.PlayerVectors), new Vector2(400, 300))
        {
            FlameModel = new LineModel(Player.PlayerFlameVectors);

            Vector2[] hitboxModel =
            {
                new Vector2(0, -27),
                new Vector2(15, 17),
                new Vector2(-15, 17),
            };
            hitbox = new PolygonHitbox(this, hitboxModel);

            //start the player off as in the "dead" state
            canRespawn = true;
            Alive = false;
            DrawFlame = false;
            Model.ModelColor = Color.Black;
        }