예제 #1
0
파일: Wall.cs 프로젝트: secgoat/Kroz
        public override void OnCollision(Player player)
        {
            if (!m_Visible)
                m_Visible = true;

            base.OnCollision(player);
        }
예제 #2
0
파일: Statue.cs 프로젝트: secgoat/Kroz
 public double CheckDistanceToPlayer(Player player)
 {
     double distance;
     /*  this gets the distance between 2 points. absolute value so it is a positive number, pow raises first part
      *  by second part Ie X to the power of 2. and then divide by IMGsize to find how many squares on the map away the
      *  player is from the mob.
      */
     distance = Math.Abs(Math.Sqrt(Math.Pow((player.collisionRect.Center.X - this.collisionRect.Center.X), 2) + Math.Pow((player.collisionRect.Center.Y - this.collisionRect.Center.Y), 2))) / frameSize.X;
     return distance;
 }
예제 #3
0
파일: Sprite.cs 프로젝트: secgoat/Kroz
 //this will do nothing if no event is attached, however will fire event if defined in levelManager
 public virtual void OnCollision(Player player)
 {
     if (this.OnCollisionEvent != null)
         this.OnCollisionEvent(this);
 }
예제 #4
0
파일: BaseMob.cs 프로젝트: secgoat/Kroz
        public Vector2 DirToPlayer(Player player)
        {
            Vector2 direction;
            double radian;
            double degree;
            int dx = 0;
            int dy = 0;

            if (this.CheckDistanceToPlayer(player) <= this.m_Sensitivity)
            {
                //get the radian to the player
                radian = Math.Atan2(this.collisionRect.Center.Y - player.collisionRect.Center.Y, this.collisionRect.Center.X - player.collisionRect.Center.X);
                //convert radian to degrees to tell mob which direction to move
                degree = Util.Calculate.RadianToDegree(radian);
                if (degree < 0) //always get a positive degree
                    degree += 360;
                if (degree == 0)
                {
                    dx = -1;
                    dy = 0;
                }
                if (degree == 45)
                {
                    dx = -1;
                    dy = -1;
                }
                if (degree == 90)
                {
                    dx = 0;
                    dy = -1;
                }
                if (degree == 135)
                {
                    dx = 1;
                    dy = -1;
                }
                if (degree == 180)
                {
                    dx = 1;
                    dy = 0;
                }
                if (degree == 225)
                {
                    dx = 1;
                    dy = 1;
                }
                if (degree == 270)
                {
                    dx = 0;
                    dy = 1;
                }
            }
            direction.X = dx;
            direction.Y = dy;
            return direction;
        }
예제 #5
0
파일: BaseMob.cs 프로젝트: secgoat/Kroz
 public override void OnCollision(Player player)
 {
     player.Health = -m_Strength;
     player.Score = scoreValue;
 }
예제 #6
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);
            baseFont = Game.Content.Load<SpriteFont>("BaseFont");
            //-------------LOAD TEXTURES------------------------------//
            ancientTabletTexture = Game.Content.Load<Texture2D>(@"Images\tablet");
            breakableTexture = Game.Content.Load <Texture2D>(@"Images\breakable");
            chestTexture =  Game.Content.Load<Texture2D>(@"Images\chest");
            doorTexture =   Game.Content.Load<Texture2D>(@"Images\door");
            floorTexture =  Game.Content.Load<Texture2D>(@"Images\floor");
            freezeTexture = Game.Content.Load<Texture2D>(@"Images\freeze_monester");
            gemTexture =    Game.Content.Load<Texture2D>(@"Images\gem");
            gnomeTexture = Game.Content.Load<Texture2D>(@"Images\gnome");
            goldTexture =   Game.Content.Load<Texture2D>(@"Images\gold");
            keyTexture = Game.Content.Load<Texture2D>(@"Images\key");
            stairsTexture = Game.Content.Load<Texture2D>(@"Images\stairs");
            teleportTexture = Game.Content.Load<Texture2D>(@"Images\teleport");
            wallTexture =   Game.Content.Load<Texture2D>(@"Images\wall");
            waterTexture =  Game.Content.Load<Texture2D>(@"Images\water");
            whipAnimation = Game.Content.Load<Texture2D>(@"Images\whipAnimation16"); //drop the 16 when you got to 32x32 tiles
            whipTexture =   Game.Content.Load<Texture2D>(@"Images\whip");

            player = new Player(Game.Content.Load<Texture2D>(@"Images\player"), new Vector2(32,32),
                spriteSize, 2, Vector2.Zero, 0, 350);
            playerWhip = new WhipAnimation(whipAnimation, Vector2.Zero, spriteSize, 0, Vector2.Zero, 0, 350);
            this.ExtractMap();
            base.LoadContent();
        }