Example #1
0
        public new bool HasCollidedWithPlayer(SpriteUV player)         //Check if the a sprite has hit a part of the maze
        {
            if (tileIndex > 5 && tileIndex < 15)
            {
                laserOn = true;
            }
            else
            {
                laserOn = false;
            }

            Bounds2 playerBounds = player.GetlContentLocalBounds();

            player.GetContentWorldBounds(ref playerBounds);             //Get sprite bounds (player bounds)

            Bounds2 laserBounds = sprite.GetlContentLocalBounds();

            sprite.GetContentWorldBounds(ref laserBounds);             //Get all of the maze bounds

            laserBounds.Max = laserBounds.Max - 15.0f;
            laserBounds.Min = laserBounds.Min + 15.0f;

            if (playerBounds.Overlaps(laserBounds) && laserOn)
            {
                return(true);
            }

            return(false);
        }
        public bool HasCollidedWithPlayer(SpriteUV player)         //Check if the a sprite has hit a part of the maze
        {
            if (collected == false)
            {
                Bounds2 playerBounds = player.GetlContentLocalBounds();
                player.GetContentWorldBounds(ref playerBounds);                 //Get sprite bounds (player bounds)

                Bounds2 spriteBounds = sprite.GetlContentLocalBounds();
                sprite.GetContentWorldBounds(ref spriteBounds);                 //Get all of the maze bounds

                if (playerBounds.Overlaps(spriteBounds))
                {
                    return(true);
                }
            }

            return(false);
        }
Example #3
0
        public bool HasCollidedWith(SpriteUV sprite)
        {
            //beam1 bounds
            Bounds2 beam1 = spinSprite[0].GetlContentLocalBounds();

            spinSprite[0].GetContentWorldBounds(ref beam1);

            //beam2 bounds
            Bounds2 beam2 = spinSprite[1].GetlContentLocalBounds();

            spinSprite[1].GetContentWorldBounds(ref beam2);

            //beam3 bounds
            Bounds2 beam3 = spinSprite[2].GetlContentLocalBounds();

            spinSprite[2].GetContentWorldBounds(ref beam3);

            //player bounds
            Bounds2 player = sprite.GetlContentLocalBounds();

            sprite.GetContentWorldBounds(ref player);

            if (player.Overlaps(beam1))
            {
                return(true);
            }

            if (player.Overlaps(beam2))
            {
                return(true);
            }

            if (player.Overlaps(beam3))
            {
                return(true);
            }

            else
            {
                return(false);
            }
        }
Example #4
0
        public new bool HasCollidedWithPlayer(SpriteUV player)         //Check if the a sprite has hit a part of the maze
        {
            Bounds2 playerBounds = player.GetlContentLocalBounds();

            player.GetContentWorldBounds(ref playerBounds);             //Get sprite bounds (player bounds)

            Bounds2 holeBounds = sprite.GetlContentLocalBounds();

            sprite.GetContentWorldBounds(ref holeBounds);             //Get all of the maze bounds

            holeBounds.Max = holeBounds.Max - 15.0f;
            holeBounds.Min = holeBounds.Min + 15.0f;

            if (playerBounds.Overlaps(holeBounds))
            {
                return(true);
            }

            return(false);
        }
Example #5
0
        public bool checkSides(Bounds2 player, SpriteUV sprite2, int gravity)         //ComparrightRotation = false;es 2 sprites to see is the left or right side has intersected
        {
            Bounds2 mazeTile = sprite2.GetlContentLocalBounds();

            sprite2.GetContentWorldBounds(ref mazeTile);
            if (gravity == 1)             //Down
            {
                if (((player.Point01.X < mazeTile.Point11.X) || (player.Point11.X > mazeTile.Point01.X)))
                {                                                //If the left side of the player is past the right side of the tile and vica versa
                    if ((player.Point01.Y) < mazeTile.Point01.Y) //If the tile is above the player
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else if (gravity == 2)             // Right
            {
                if (((player.Point10.Y < mazeTile.Point11.Y) || (player.Point10.Y > mazeTile.Point11.Y)))
                {                                                //If the left side of the player is past the right side of the tile and vica versa
                    if ((player.Point00.X) > mazeTile.Point00.X) //If the tile is above the player
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else if (gravity == 3)             // Up
            {
                //if (((player.Point10.X < mazeTile.Point00.X) || (player.Point00.X > mazeTile.Point10.X)))
                if (((player.Point01.X < mazeTile.Point11.X) || (player.Point11.X > mazeTile.Point01.X)))
                {                                                //If the left side of the player is past the right side of the tile and vica versa
                    if ((player.Point10.Y) > mazeTile.Point10.Y) //If the tile is above the player
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else if (gravity == 4)             // Left
            {
                if (((player.Point10.Y < mazeTile.Point11.Y) || (player.Point10.Y > mazeTile.Point11.Y)))
                {                                                //If the left side of the player is past the right side of the tile and vica versa
                    if ((player.Point11.X) < mazeTile.Point11.X) //If the tile is above the player
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }