示例#1
0
        // player wird angegriffen
        public bool fight_p2p(ref c_npc npc, ref c_LOV player)
        {
            int direction = 0;

                if (npc.Destbox.X < player.Destbox.X)
                {
                    direction = 8;
                }
                else
                {
                    direction = 9;
                }

                if (npc.canAttack)
                {
                    player.properties.livepoints -= npc.properties.staerke;
                    npc.canAttack = false;
                    AUDIO.play_sound(1);
                    if (player.properties.livepoints <= 0) // npc besiegt
                    {
                        player.Color = Color.Blue;

                        AUDIO.play_sound(3);
                    }
                    npc.attackcnt = 1;

                    return true;
                }
                else
                {
                    if(10 * npc.attackcnt <= npc.properties.attackSpeed)
                    {
                        npc.attackcnt++;
                    } else {
                        ac++;
                    }
                       if (ac >= 7)
                        ac = 0;
                    npc.setSprite(direction, ac);

                    npc.caminar = false;

                }

            return false;
        }
示例#2
0
        private void init_CHARAKTER()
        {
            CHARAKTER = new c_LOV(3, 1, 11, 9, 96);

            CHARAKTER.Color = Color.White;
            CHARAKTER.speed.X = 3;
            CHARAKTER.speed.Y = 3;

            //die DrawBox des players///
            CHARAKTER.box.X = 500;
            CHARAKTER.box.Y = 350;
            CHARAKTER.box.Width = 96;
            CHARAKTER.box.Height = 96;

            CHARAKTER.Destbox.X = CHARAKTER.box.X;
            CHARAKTER.Destbox.Y = CHARAKTER.box.Y;
            CHARAKTER.Destbox.Width = CHARAKTER.box.Width;
            CHARAKTER.Destbox.Height = CHARAKTER.box.Height;
            ////////////////////////////

            //bouncebox des players

            CHARAKTER.HitBox = new Polygon();
            CHARAKTER.HitBox.Points.Add(new Vector(30, 50));
            CHARAKTER.HitBox.Points.Add(new Vector(60, 50));
            CHARAKTER.HitBox.Points.Add(new Vector(60, 80));
            CHARAKTER.HitBox.Points.Add(new Vector(30, 80));
            CHARAKTER.HitBox.Offset(new Vector(CHARAKTER.box.X, CHARAKTER.box.Y));
            CHARAKTER.HitBox.BuildEdges();

            CHARAKTER.properties.evil = false;
            CHARAKTER.properties.expirience = 20;
            CHARAKTER.properties.klasse = "ak";
            CHARAKTER.properties.level = 2;
            CHARAKTER.properties.livepoints = 100;
            CHARAKTER.properties.maxlivepoints = CHARAKTER.properties.livepoints;
            CHARAKTER.properties.mana = 10;
            CHARAKTER.properties.name = "npc";
            CHARAKTER.properties.staerke = 10;
            CHARAKTER.properties.defensivpoints = 0;
            CHARAKTER.properties.attackSpeed = 300;
            CHARAKTER.properties.attackRange = 150;

            CHARAKTER.Zebene = (CHARAKTER.HitBox.Points[0].Y + 100) / 1000f;
        }
示例#3
0
        public bool fight_p2p(ref c_npc npc, ref c_LOV player,bool playerAttacks)
        {
            if (playerAttacks) //player greift an
            {
                int direction = 0;
                if (player.Destbox.X < npc.Destbox.X)
                {
                    direction = 8;
                }
                else
                {
                    direction = 9;
                }
                if (player.canAttack)
                {
                    npc.properties.livepoints -= player.properties.staerke;
                    player.canAttack = false;
                    AUDIO.play_sound(1);
                    if (npc.properties.livepoints <= 0) // npc besiegt
                    {
                        npc = null;
                        AUDIO.play_sound(2);
                    }
                    player.attackcnt = 1;
                    player.setSprite(direction, 0);
                    return true;
                }
                else
                {
                    int ac = (int)(player.attackcnt / (player.properties.attackSpeed / ((player.properties.attackSpeed / 100) * 10)));
                    if (ac >= 7) ac = 0;
                        player.setSprite(direction, ac);
                        player.attackcnt++;

                }

            }

            return false;
        }