Esempio n. 1
0
File: News.cs Progetto: Lyloox/Abimn
 public static void Draw(Pos pos)
 {
     if (docLoaded)
     {
         foreach (XmlNode e in doc.DocumentElement.ChildNodes)
         {
             foreach (XmlNode i in e.ChildNodes)
             {
                 switch (i.Name)
                 {
                     case "title":
                         Text.Write("vie", i.InnerText, pos.ToVector2(), Color.Yellow, 1.4f);
                         pos.J += 35;
                         break;
                     case "date":
                         Text.Write("vie", i.InnerText, pos.ToVector2(), Color.Silver, 0.8f);
                         pos.J += 25;
                         break;
                     case "content":
                         Text.Write("vie", i.InnerText, pos.ToVector2(), Color.White, 0.9f);
                         pos.J += 100;
                         break;
                     default:
                         break;
                 }
             }
         }
     }
     else
         Text.Write("vie", "Pas de connexion", pos.ToVector2(), Color.Gray);
 }
Esempio n. 2
0
File: Tile.cs Progetto: Lyloox/Abimn
 /// <summary>
 /// Dessine le sprite en utilisant ses attributs et le spritebatch donné
 /// </summary>
 /// <param name="spriteBatch">Le spritebatch avec lequel dessiner</param>
 /// <param name="gameTime">Le GameTime de la frame</param>
 public virtual void Draw(Pos pos, Center center = Center.None)
 {
     if (center == Center.Horizontal || center == Center.All)
         pos.X = pos.X = pos.X - _texture.Width / 2;
     if (center == Center.Vertical || center == Center.All)
         pos.Y = pos.Y = pos.Y - _texture.Height / 2;
     G.spriteBatch.Draw(_texture, pos.ToVector2(), Color.White);
 }
Esempio n. 3
0
File: Cell.cs Progetto: Lyloox/Abimn
        public void Draw(Pos pos, Center center = Center.None)
        {
            byte[] clone = _id.ToArray();

            G.tiles[(int)Tiles.Main][clone[0] - 1].Draw(pos, center);
            for (byte i = 1; i < clone.Length; i++)
                G.tiles[(int)Tiles.MainDeco][clone[i] - 1].Draw(pos, center);
        }
Esempio n. 4
0
 public MapEditor(Map map, byte slot)
     : base(true)
 {
     this.map = map;
     this.slot = slot;
     this.camera = new Pos(map.Dimensions.X * C.sizeCell / 2, map.Dimensions.Y * C.sizeCell / 2);
     this.decorating = false;
     this.currBlock = 1;
 }
Esempio n. 5
0
File: Main.cs Progetto: Lyloox/Abimn
 public override void Initialize()
 {
     Music.Play("1");
     this._idmap = 3;
     this._backmap = new Map(_idmap);
     this._poshero = _backmap.StartPos;
     this._idhero = 0;
     this._dir = "right";
     this._shift = new Pos();
     this._time = 0;
     EntityHero = new Entity(new Pos((9 * 50), (7 * 50)));
     this.event1 = false;
 }
Esempio n. 6
0
 /// <summary>
 /// Met à jour les variables du sprite
 /// </summary>
 /// <param name="gameTime">Le GameTime associé à la frame</param>
 public virtual void Update(GameTime gameTime)
 {
     _pos += _direction * _speed * (float)gameTime.ElapsedGameTime.TotalMilliseconds;
     _rect.X = (int) _pos.X;
     _rect.Y = (int) _pos.Y;
 }
Esempio n. 7
0
 /// <summary>
 /// Initialise les variables de l'entity
 /// <param name="direction">La direction de l'entity</param>
 /// <param name="speed">La vitesse de l'entity</param>
 /// </summary>
 public virtual void Initialize(Pos position, Vector2 direction, float speed, bool visible = true)
 {
     _pos = position;
     _direction = direction;
     _speed = speed;
     _rect = new Rectangle();
     _visible = visible;
 }
Esempio n. 8
0
 /// <summary>
 /// Initialise les variables de l'entity
 /// <param name="position">La position à laquelle sera placée l'entity</param>
 /// </summary>
 public virtual void Initialize(Pos position, bool visible = true)
 {
     _pos = position;
     _direction = Vector2.Zero;
     _speed = 0;
     _rect = new Rectangle((int)_pos.X, (int)_pos.Y, 0, 0);
     _visible = visible;
 }
Esempio n. 9
0
 /// <summary>
 /// Initialise les variables de l'entity
 /// </summary>
 public virtual void Initialize(bool visible = true)
 {
     _pos = new Pos();
     _direction = Vector2.Zero;
     _speed = 0;
     _rect = new Rectangle();
     _visible = visible;
 }
Esempio n. 10
0
 /// <summary>
 /// Initialise les variables de l'entity
 /// <param name="direction">Direction de l'entity</param>
 /// <param name="speed">Vitesse de l'entity</param>
 /// <param name="visible">Définit si l'entity est visible ou non</param>
 /// </summary>
 public virtual void Initialize(Pos position, Vector2 direction, float speed, bool visible = true)
 {
     this.Initialize(position, direction * speed, visible);
 }
Esempio n. 11
0
 public Button(Pos position, bool visible = true)
 {
     this.Initialize(position, visible);
 }
Esempio n. 12
0
 /// <summary>
 /// Initialise les variables du Sprite
 /// </summary>
 public virtual void Initialize(bool visible = true)
 {
     _pos = new Pos();
     _rect = new Rectangle();
     _visible = visible;
 }
Esempio n. 13
0
File: Main.cs Progetto: Lyloox/Abimn
        /// <summary>
        /// Regarde les trois cases en face du personnage
        /// Retourne vrai si elles sont occupées par un marchand
        /// </summary>
        public int Interact()
        {
            Pos FrontTile = new Pos();

            if (FrontTile.X == 0 && FrontTile.X == 49)
            {
                if (_dir == "left")
                    FrontTile = new Pos(_poshero.X - 1, _poshero.Y);
                if (_dir == "right")
                    FrontTile = new Pos(_poshero.X + 1, _poshero.Y);
                if (_dir == "down")
                    FrontTile = new Pos(_poshero.X, _poshero.Y + 1);
                if (_dir == "up")
                    FrontTile = new Pos(_poshero.X, _poshero.Y - 1);
                if (FrontTile.X == 0 && FrontTile.X == 49 && _backmap.Decoration(FrontTile) == 5)
                    return 5;
            }
            else
            {
                Pos FrontTileLeft = new Pos();
                Pos FrontTileRight = new Pos();
                Pos FrontTileFront = new Pos();

                if (_dir == "left")
                {
                    FrontTile = new Pos(_poshero.X - 1, _poshero.Y);
                    FrontTileLeft = new Pos(FrontTile.X, FrontTile.Y - 1);
                    FrontTileRight = new Pos(FrontTile.X, FrontTile.Y + 1);
                    FrontTileFront = new Pos(FrontTile.X - 1, FrontTile.Y);
                }
                if (_dir == "right")
                {
                    FrontTile = new Pos(_poshero.X + 1, _poshero.Y);
                    FrontTileLeft = new Pos(FrontTile.X, FrontTile.Y - 1);
                    FrontTileRight = new Pos(FrontTile.X, FrontTile.Y + 1);
                    FrontTileFront = new Pos(FrontTile.X + 1, FrontTile.Y);
                }
                if (_dir == "down")
                {
                    FrontTile = new Pos(_poshero.X, _poshero.Y + 1);
                    FrontTileLeft = new Pos(FrontTile.X - 1, FrontTile.Y);
                    FrontTileRight = new Pos(FrontTile.X + 1, FrontTile.Y);
                    FrontTileFront = new Pos(FrontTile.X, FrontTile.Y + 1);
                }
                if (_dir == "up")
                {
                    FrontTile = new Pos(_poshero.X, _poshero.Y - 1);
                    FrontTileLeft = new Pos(FrontTile.X - 1, FrontTile.Y);
                    FrontTileRight = new Pos(FrontTile.X + 1, FrontTile.Y);
                    FrontTileFront = new Pos(FrontTile.X, FrontTile.Y - 1);
                }

                if (_backmap.Decoration(FrontTile) == 5 ||
                    _backmap.Decoration(FrontTileLeft) == 5 ||
                    _backmap.Decoration(FrontTileRight) == 5 ||
                    _backmap.Decoration(FrontTileFront) == 5) //id du renard Mesmer
                    return 5;

                if (_backmap.Decoration(FrontTile) == 7 ||
                    _backmap.Decoration(FrontTileLeft) == 7 ||
                    _backmap.Decoration(FrontTileRight) == 7 ||
                    _backmap.Decoration(FrontTileFront) == 7) //id du PNJ
                    return 7;

                if (_backmap.Decoration(FrontTile) == 8 ||
                    _backmap.Decoration(FrontTileLeft) == 8 ||
                    _backmap.Decoration(FrontTileRight) == 8) //id du PNJ
                    return 8;

                if (_backmap.Decoration(FrontTile) == 9 ||
                   _backmap.Decoration(FrontTileLeft) == 9 ||
                   _backmap.Decoration(FrontTileRight) == 9) //id du PNJ
                    return 9;
            }
            return 0;
        }
Esempio n. 14
0
 public Entity(Pos position, Vector2 movement, bool visible = true)
 {
     this.Initialize(position, movement, visible);
 }
Esempio n. 15
0
 /// <summary>
 /// Indique si la souris survole l'entity
 /// </summary>
 public virtual bool MouseIsOver(Pos strict = null)
 {
     if (Visible)
     {
         if (strict == null) strict = new Pos();
         return E.GetMousePosX() >= Pos.I + strict.X
             && E.GetMousePosX() <= Pos.I + _rect.Width - strict.X
             && E.GetMousePosY() >= Pos.J + strict.Y
             && E.GetMousePosY() <= Pos.J + _rect.Height - strict.Y;
     }
     return false;
 }
Esempio n. 16
0
 /// <summary>
 /// Charge l'image voulue grâce au ContentManager donné en plaçant son centre sur sa position
 /// </summary>
 /// <param name="keyNormal">Clé de l'image normale</param>
 /// <param name="keyOver">Clé de l'image de l'entité survolée</param>
 /// <param name="keyPushed">Clé de l'image de l'entité appuyée</param>
 /// <param name="center">Permet de centrer l'image par rapport à se position</param>
 public virtual void LoadContent(string keyNormal, string keyOver, string keyPushed, Center center = Center.None)
 {
     KeyTextureNormal = keyNormal;
     KeyTextureOver = keyOver;
     KeyTexturePushed = keyPushed;
     Texture2D buff = Ressources.GetImage(KeyTextureNormal);
     Rect = new Rectangle(0, 0, buff.Width, buff.Height);
     if (center != Center.None)
         Pos = new Pos(center == Center.All ? Pos.X - Rect.Width / 2 : Pos.X,
                       center == Center.All ? Pos.Y - Rect.Height / 2 : Pos.Y);
 }
Esempio n. 17
0
 /// <summary>
 /// Indique si l'entity est cliquée
 /// </summary>
 public virtual bool IsClicked(Pos strict = null)
 {
     return E.LeftIsReleased() && this.MouseIsOver(strict);
 }
Esempio n. 18
0
 /// <summary>
 /// Initialise les variables de l'entity
 /// <param name="position">Position à laquelle sera placée l'entity</param>
 /// <param name="movement">Vecteur mouvement de l'entity</param>
 /// <param name="visible">Définit si l'entity est visible ou non</param>
 /// </summary>
 public virtual void Initialize(Pos position, Vector2 movement, bool visible = true)
 {
     Pos = position;
     Movement = movement;
     Visible = visible;
     Delta = new Pos();
     Rotation = 0;
     Scale = 1;
     Opacity = 1;
 }
Esempio n. 19
0
 public Entity(Pos position, bool visible = true)
 {
     this.Initialize(position, visible);
 }
Esempio n. 20
0
 public Entity(Pos position, Vector2 direction, float speed, bool visible = true)
 {
     this.Initialize(position, direction, speed, visible);
 }
Esempio n. 21
0
        public override void Update(GameTime gameTime)
        {
            if (E.IsPushed(Keys.S))
                save();
            else if (E.IsPushed(Keys.Q))
                G.currentGame.Pop();

            if (E.GetMousePosX() < C.sizeCell && camera.X > 0)
                camera.X -= 10 * (C.sizeCell - E.GetMousePosX()) / C.sizeCell;
            if (E.GetMousePosX() > C.Screen.Width - C.sizeCell && camera.X < map.Dimensions.X * C.sizeCell)
                camera.X += 10 * (E.GetMousePosX() - C.Screen.Width + C.sizeCell) / C.sizeCell;
            if (E.GetMousePosY() < C.sizeCell && camera.Y > 0)
                camera.Y -= 10 * (C.sizeCell - E.GetMousePosY()) / C.sizeCell;
            if (E.GetMousePosY() > C.Screen.Height - C.sizeCell && camera.Y < map.Dimensions.Y * C.sizeCell)
                camera.Y += 10 * (E.GetMousePosY() - C.Screen.Height + C.sizeCell) / C.sizeCell;

            if (E.RightIsReleased())
                this.decorating = !this.decorating;

            if (E.getMouseWheel() != 0)
            {
                if (E.getMouseWheel() > 0)
                    currBlock++;
                else
                    currBlock--;
                currBlock--;
                currBlock += TileProperty.getFrom(decorating ? Tiles.MainDeco : Tiles.Main).Size;
                currBlock = currBlock % (TileProperty.getFrom(decorating ? Tiles.MainDeco : Tiles.Main).Size);
                currBlock++;
            }

            Pos under = new Pos((camera.X - C.Screen.Width/2 + E.GetMousePosX() + C.sizeCell/2) / 50, (camera.Y - C.Screen.Height/2 + E.GetMousePosY() + C.sizeCell/2) / 50);
            Cell buff = map.GetCell(under);
            if (E.LeftIsDown())
            {
                if (decorating)
                    buff.addDecoration((byte)currBlock);
                else
                    buff.setBackground((byte)currBlock);
                map.SetCell(under, buff);
            }
            else if (E.Button1IsDown() || E.Button2IsDown() || E.IsDown(Keys.Back))
            {
                buff.ClearDecoration();
                map.SetCell(under, buff);
            }
            else if (E.MiddleIsReleased())
                currBlock = buff.GetArray()[0];

            Cursor.setCursor(decorating ? Tiles.MainDeco : Tiles.Main, currBlock, currBlock, new Pos (C.sizeCell/2));

            if (E.IsReleased(Keys.Escape))
            {
                G.currentGame.Clear();
                G.currentGame.Push(new Menu());
            }
        }
Esempio n. 22
0
 /// <summary>
 /// Initialise les variables du Button
 /// </summary>
 /// <param name="position">La position à laquelle sera placé le button</param>
 public virtual void Initialize(Pos position, bool visible = true)
 {
     _pos = position;
     _rect = new Rectangle((int)_pos.X, (int)_pos.Y, 0, 0);
     _visible = visible;
 }
Esempio n. 23
0
File: Main.cs Progetto: Lyloox/Abimn
        /// <summary>
        /// Appelle une nouvelle map
        /// </summary>
        public void Travel()
        {
            Pos HighTile = new Pos(_poshero.X, _poshero.Y - 1);
            Pos DownTile = new Pos(_poshero.X, _poshero.Y + 1);
            if ((_backmap.Decoration(HighTile) == 4 && (E.IsPushed(Keys.Up) || E.IsPushed(Keys.Z))) || (_backmap.Decoration(DownTile) == 4 && (E.IsPushed(Keys.Down) || E.IsPushed(Keys.S))))
            {
                _idmap = 2;
                _backmap = new Map(_idmap);
                _shift = new Pos(0, 0);
                _poshero = _backmap.StartPos;
                _idhero = 0;
                G.currentGame.Push(new Abimn.Game_States.Transition());

            }

            if (((_backmap.Decoration(HighTile) == 3 && (E.IsDown(Keys.Up) || E.IsDown(Keys.Z))) || (_backmap.Decoration(DownTile) == 3 && (E.IsDown(Keys.Down) || E.IsDown(Keys.S)))) && _idmap == 2)
            {
                _idmap = 1;
                _poshero = new Pos(45, 46);
                _backmap = new Map(_idmap);
                _idhero = 0;
                _dir = "down";
                _shift = new Pos(0, 0);
                G.currentGame.Push(new Abimn.Game_States.Transition());

            }

            if (((_backmap.Decoration(HighTile) == 3 && (E.IsDown(Keys.Up) || E.IsDown(Keys.Z))) || (_backmap.Decoration(DownTile) == 3 && (E.IsDown(Keys.Down) || E.IsDown(Keys.S)))) && _idmap == 3)
            {
                _idmap = 1;
                _backmap = new Map(_idmap);
                _idhero = 0;
                _dir = "right";
                _poshero = new Pos(0, 25);
                _shift = new Pos(0, 0);
                G.currentGame.Push(new Abimn.Game_States.Transition());

            }

            if (((_backmap.Decoration(_poshero) == 6 && (E.IsDown(Keys.Up) || E.IsDown(Keys.Z))) || (_backmap.Decoration(_poshero) == 6 && (E.IsDown(Keys.Down) || E.IsDown(Keys.S)))) && _idmap == 4)
            {
                _idmap = 1;
                _backmap = new Map(_idmap);
                _idhero = 0;
                _dir = "down";
                _poshero = new Pos(39, 03);
                _shift = new Pos(0, 0);
                G.currentGame.Push(new Abimn.Game_States.Transition());

            }
            if (((_backmap.Decoration(_poshero) == 6 && (E.IsDown(Keys.Up) || E.IsDown(Keys.Z))) || (_backmap.Decoration(_poshero) == 6 && (E.IsDown(Keys.Down) || E.IsDown(Keys.S)))) && _idmap == 1  && _poshero.X < 40)
            {

                _idmap = 4;
                Music.Play("map2");
                _backmap = new Map(_idmap);
                _idhero = 0;
                _dir = "up";
                _poshero = new Pos(05, 48);
                _shift = new Pos(0, 0);
                G.currentGame.Push(new Abimn.Game_States.Transition());
            }

            /* if (((_backmap.Decoration(_poshero) == 6 && (E.IsDown(Keys.Right) || E.IsDown(Keys.D)))) && _idmap == 5  && _poshero.X>40)
             {
                 _idmap = 5;
                 _backmap = new Map(_idmap);
                 _idhero = 0;
                 _dir = "right";
                 _poshero = new Pos(01, 25);
                 _shift = new Pos(0, 0);
                 G.currentGame.Push(new Abimn.Game_States.Transition());
             }*/

            if (((_backmap.Decoration(_poshero) == 6 && (E.IsDown(Keys.Left) || E.IsDown(Keys.Q)))) && _idmap == 5)
            {
                _idmap = 1;
                _backmap = new Map(_idmap);
                _idhero = 0;
                _dir = "left";
                _poshero = new Pos(48, 25);
                _shift = new Pos(0, 0);
                G.currentGame.Push(new Abimn.Game_States.Transition());

            }
        }
Esempio n. 24
0
        public override void Update(GameTime gameTime)
        {
            if (_hero.Pos.I < -14)
            {
                _hero.Pos.I = -14;
                _hero.Movement = new Vector2(0, _hero.Movement.Y);
            }
            int heightByHero = _map.GetHeightByHero(_hero.Pos.I + 14);
            if (_hero.Pos.J + _hero.Rect.Height < C.Screen.Height - heightByHero)
                _hero.Movement = new Vector2(_hero.Movement.X, _hero.Movement.Y + 0.05f);
            else
            {
                _hero.Movement = Vector2.Zero;
                if (!G.willFightBoss)
                {
                    if (Math.Abs(_ennemy.Pos.X - _hero.Pos.X) <= 40 && ennemyAttack == 100)
                        ennemyAttack--;
                    if (ennemyAttack < 100)
                        ennemyAttack--;
                    if (ennemyAttack == 0)
                        ennemyAttack = 100;
                    if (ennemyAttack == 90)
                        Hero.Life -= 1000;
                    if (ennemyAttack == 100)
                        _ennemy.Delta = new Pos(0);
                    else if (ennemyAttack >= 90)
                        _ennemy.Delta = new Pos(ennemyAttack - 100, -ennemyAttack % 10);
                    else
                        _ennemy.Delta = new Pos();
                }

                if (heroAttack < 20)
                    heroAttack--;
                if (heroAttack == 0)
                    heroAttack = 20;

                if (heroAttack == 10 && Math.Abs(_ennemy.Pos.X - _hero.Pos.X) < 50)
                    _ennemy.Life -= 10000 / 14;
            }
            if (_hero.Pos.J + _hero.Rect.Height > C.Screen.Height - heightByHero)
                _hero.Pos.J = C.Screen.Height - heightByHero - _hero.Rect.Height + 7;

            int heightByMonster = _map.GetHeightByHero(_ennemy.Pos.I + 17);
            if (_ennemy.Pos.J + _ennemy.Rect.Height + 7 < C.Screen.Height - heightByMonster)
                _ennemy.Movement = new Vector2(_ennemy.Movement.X, _ennemy.Movement.Y + 0.05f);
            else
                _ennemy.Movement = Vector2.Zero;
            if (_ennemy.Pos.J + _ennemy.Rect.Height + 7 > C.Screen.Height - heightByMonster)
                _ennemy.Pos.J = C.Screen.Height - heightByMonster - _ennemy.Rect.Height;

            _hero.Update(gameTime);
                _ennemy.Update(gameTime);
            if (!G.willFightBoss)
            {
                _ennemy.Pos = _ennemy.Pos + getDirection(_ennemy, _hero, Math.Abs(_ennemy.Pos.X - _hero.Pos.X) > 40);
            }
            moveHero();

            if (Hero.Life < 100)
            {
                Hero.Life = 0;
                Cursor.SetVisibility(true);
                G.currentGame.Push(new GameOver());
            }
            else if (_ennemy.Life < 100)
            {
                _ennemy.Life = 0;
                Cursor.SetVisibility(true);
                G.currentGame.Push(new FightRecap());
                this.State = State.Exit;
            }

            if (E.IsPushed(Keys.A) && Hero.Mana > 13)
            {
                Hero.Mana -= 13;
                _fireball.Pos = new Pos(_hero.Pos.I, _hero.Pos.J - 32);
                _fireball.Visible = true;
                _fireball.Movement = (new Pos(_ennemy.Pos.I - _fireball.Pos.I, _ennemy.Pos.J + 50 - _fireball.Pos.J)).ToVector2() / 750;
            }
            _fireball.Update(gameTime);

            if (E.IsPushed(Keys.Up))
            {
                _hero.Movement = new Vector2(0, -0.8f);
                if (E.IsDown(Keys.Right))
                    _hero.Movement = new Vector2(0.2f, _hero.Movement.Y);
                if (E.IsDown(Keys.Left))
                    _hero.Movement = new Vector2(-0.2f, _hero.Movement.Y);
                _hero.Pos = new Pos(_hero.Pos.I, _hero.Pos.J - 10);
            }

            int heightByFireball = C.Screen.Height - _map.GetHeightByHero(_fireball.Pos.I + 9);

            if (_fireball.Pos.J + 32 >= heightByFireball)
            {
                if (Math.Abs(_hero.Pos.I - _fireball.Pos.I) < 50)
                    Hero.Life -= 1500;
                if (Math.Abs(_ennemy.Pos.I - _fireball.Pos.I) < 30)
                   _ennemy.Life -= 1000;
                _map.Destruct(new Pos(_fireball.Pos.I, heightByFireball), 30);
                _fireball.Movement = Vector2.Zero;
                _fireball.Pos = new Pos();
                _fireball.Visible = false;
            }

            if (G.willFightBoss)
            {
                if (_ennemyFireball.Visible)
                {
                    Vector2 buff = new Pos(_hero.Pos.I - _ennemyFireball.Pos.I, _hero.Pos.J + 50 - _ennemyFireball.Pos.J).ToVector2();
                    buff.Normalize();
                    _ennemyFireball.Movement = buff / 3;
                }
                else
                {
                    _ennemyFireball.Pos = new Pos(_ennemy.Pos.I, _ennemy.Pos.J - 32);
                    _ennemyFireball.Visible = true;
                }
                int heightByEnnemyFireball = C.Screen.Height - _map.GetHeightByHero(_ennemyFireball.Pos.I + 9);
                if (_ennemyFireball.Pos.J + 32 >= heightByEnnemyFireball)
                {
                    if (Math.Abs(_hero.Pos.I - _ennemyFireball.Pos.I) < 50)
                        Hero.Life -= 1000;
                    if (Math.Abs(_ennemy.Pos.I - _ennemyFireball.Pos.I) < 30)
                        _ennemy.Life -= 3000;
                    _map.Destruct(new Pos(_ennemyFireball.Pos.I, heightByEnnemyFireball), 30);
                    _ennemyFireball.Movement = Vector2.Zero;
                    _ennemyFireball.Pos = new Pos();
                    _ennemyFireball.Visible = false;
                }
                _ennemyFireball.Update(gameTime);
            }

            if (E.IsPushed(Keys.Escape))
            {
                G.currentGame.Push(new PauseMenu());
            }

            /*
            _ennemy.Update(gameTime);
            if (_ennemy.Pos.X < _hero.Pos.X + 50)
            {
                _ennemy.Speed = 0;
                _fightContact = true;
            }

            if (E.IsPushed(Keys.Escape))
                G.currentGame.Push(new PauseMenu());
            if (E.IsPushed(Keys.I))
            {
                G.currentGame.Push(new Inventory());
            }
            if (E.IsDown(Keys.Right))
            {
                _hero.LoadContent(1, Tiles.Fight);
                _hero.Pos.X++;
            }
            if (E.IsDown(Keys.Left))
            {
                _hero.LoadContent(2, Tiles.Fight);
                _hero.Pos.X--;
            }
            if (!_jumping && E.IsPushed(Keys.Space))
            {
                _jumping = true;
            }
            else if (E.IsReleased(Keys.Left) || E.IsReleased(Keys.Right))
                _hero.Speed = 0;

            //_hero.Update(gameTime);
             */
        }
Esempio n. 25
0
 /// <summary>
 /// Initialise les variables de l'entity
 /// <param name="position">Position à laquelle sera placée l'entity</param>
 /// <param name="visible">Définit si l'entity est visible ou non</param>
 /// </summary>
 public virtual void Initialize(Pos position, bool visible = true)
 {
     this.Initialize(position, new Vector2(), 0, visible);
 }
Esempio n. 26
0
File: Tile.cs Progetto: Lyloox/Abimn
 /// <summary>
 /// Dessine une tile
 /// </summary>
 /// <param name="path">Chemin de l'image à afficher</param>
 /// <param name="pos">Position à laquelle dessiner la tile</param>
 /// <param name="rotation">Rotation à appliquer à la Tile en radians</param>
 /// <param name="scale">Zoom à effectuer sur la Tile. 1 Par défaut.</param>
 public static void Draw(string path, Pos pos, float rotation = 0, float scale = 1, float opacity = 1, bool flip = false)
 {
     if (path != "" && path != null)
         G.spriteBatch.Draw(Ressources.GetImage(path == "fireball2" ? "fireball" : path), pos.ToVector2(), null, path == "fight/fireball2" ? Color.Blue : Color.White * opacity, rotation, new Vector2(), scale, flip ? SpriteEffects.FlipVertically : SpriteEffects.None, 0);
 }
Esempio n. 27
0
File: Main.cs Progetto: Lyloox/Abimn
        /// <summary>
        /// permet de bouger le HERO d'une case à l'autre en fonction de la touche
        /// fonctionne avec zqsd et flèches(haut, bas, gauche, droite)
        /// </summary>
        public void MoveHeros()
        {
            _time++;

            if (_time > 10)//changement de l'indice pour les sprites
            {
                if (E.IsDown(Keys.B)) //courrir
                    _idhero = (_idhero + 1) % 3;

                else
                    _idhero = (_idhero + 1) % 2;

                _time = 0;
            }

            if (E.IsPushed(Keys.Q) || E.IsPushed(Keys.Left) || E.IsDown(Keys.Q) || E.IsDown(Keys.Left))
            {
                _dir = "left";
                Pos NextStep = new Pos(_poshero.X - 1, _poshero.Y);
                if (_backmap.CanMoveOn(NextStep))
                    _shift.X -= 3;
                else
                {
                    if (_shift.X <= 4)
                    {
                        _shift.X = 0;
                        EntityHero.Pos.X -= 5;
                    }
                    else
                        _shift.X -= 3;
                }
            }
            else
            {
                if (E.IsPushed(Keys.D) || E.IsPushed(Keys.Right) || E.IsDown(Keys.D) || E.IsDown(Keys.Right))
                {
                    _dir = "right";
                    Pos NextStep = new Pos(_poshero.X + 1, _poshero.Y);
                    if (_backmap.CanMoveOn(NextStep))
                    { _shift.X += 3; }

                    else
                    {
                        if (_shift.X >= -4)
                        {
                            _shift.X = 0;
                            EntityHero.Pos.X += 5;
                        }
                        else
                            _shift.X += 3;
                    }
                }
                else
                {
                    if (E.IsPushed(Keys.Z) || E.IsPushed(Keys.Up) || E.IsDown(Keys.Z) || E.IsDown(Keys.Up))
                    {
                        _dir = "up";
                        Pos NextStep = new Pos(_poshero.X, _poshero.Y - 1);
                        if (_backmap.CanMoveOn(NextStep))
                            _shift.Y -= 3;
                        else
                        {
                            if (_shift.Y <= 4)
                            {
                                _shift.Y = 0;
                                EntityHero.Pos.Y -= 5;
                            }
                            else
                                _shift.Y -= 3;
                        }
                    }
                    else
                    {
                        if (E.IsPushed(Keys.S) || E.IsPushed(Keys.Down) || E.IsDown(Keys.S) || E.IsDown(Keys.Down))
                        {
                            _dir = "down";
                            Pos NextStep = new Pos(_poshero.X, _poshero.Y + 1);
                            if (_backmap.CanMoveOn(NextStep))
                                _shift.Y += 3;
                            else
                            {
                                if (_shift.Y >= -4)
                                {
                                    _shift.Y = 0;
                                    EntityHero.Pos.Y += 5;
                                }
                                else
                                    _shift.Y += 3;
                            }
                        }

                        else
                            _idhero = 0;
                    }
                }
            }
        }