Exemplo n.º 1
0
        public Player(float x, float y, Map map)
        {
            this.x      = x;
            this.y      = y;
            this.a      = 0;
            this.Map    = map;
            sin_a       = (float)Math.Sin(a);
            cos_a       = (float)Math.Cos(a);
            RayCast     = new RayCast(Map);
            WallTexture = new Bitmap[Properties.Resources.Wall.Width];
            var texture = new Bitmap(Properties.Resources.Wall);

            for (int i = 0; i < WallTexture.Length; i++)
            {
                var tempBMP = new Bitmap(1, Properties.Resources.Wall.Width);
                for (int picY = 0; picY < tempBMP.Width; picY++)
                {
                    tempBMP.SetPixel(0, picY, texture.GetPixel(i, picY));
                }
                WallTexture[i] = (Bitmap)tempBMP.Clone();
            }
        }
Exemplo n.º 2
0
        public Player(Map map)
        {
            this.x   = map.In.x + 0.5F;
            this.y   = map.In.y + 0.5F;
            this.a   = 0;
            this.Map = map;

            PlayerSpeed = Settings.PlayerSpeed;
            Stamina     = 1F;

            Random rnd = new Random(DateTime.Now.Millisecond);

            mapActivator = new System.Drawing.Point(rnd.Next(Settings.MapSize) * 2 + 1, rnd.Next(Settings.MapSize) * 2 + 1);

            sin_a               = (float)Math.Sin(a);
            cos_a               = (float)Math.Cos(a);
            RayCast             = new RayCast(Map);
            wall_texture        = new Texture(Resources.wall);
            wall_texture.Smooth = true;

            StaminaBar = new ProgressBar(20F, Settings.sHeight - 50, 35, Settings.sWidth / 4F);
            StaminaBar.SetText("Выносливость");
            StaminaBar.SetTextColor(Color.Cyan);
        }