Example #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
 public ShiftStick(Game1 game, Vector2 pos, bool one_off, bool moveable)
     : base(game, pos)
 {
     position = pos;
     this.keyUpHint = new KeyUpHint(game, new Vector2(position.X + 7, position.Y - 35),
         "ShiftStick_hint");
 }
        public Player(Game1 game, XmlTextReader reader)
            : base(game, reader)
        {
            string pxStr = reader.GetAttribute("px");
            string pyStr = reader.GetAttribute("py");
            float px = float.Parse(pxStr);
            float py = float.Parse(pyStr);
            this.game = game;

            // born
            /*
            if (Game.PlayerBornPointId != null)
            {
                this.position = Game.BindingPoint.GetPosById(Game.Current_levelFileName, Game.PlayerBornPointId);
            }
                // reborn*/

            if (Game.BindingPoint != null)
            {
                this.position = Game.BindingPoint.JudgeBindingPoint(Game.Current_levelFileName, Game.DiePosition);
            }
            else
            {
                this.position = new Vector2(px, py);
            }
        }
 public Switch(Game1 game, Vector2 pos)
     : base(game, pos)
 {
     position = pos;
     this.keyUpHint = new KeyUpHint(game, new Vector2(position.X + 7, position.Y - 35),
         "Switch_hint");
 }
        public Treasure(Game1 game, XmlTextReader reader, bool isGotten)
            : base(game, reader)
        {
            string pxStr = reader.GetAttribute("px");
            string pyStr = reader.GetAttribute("py");
            this.id = reader.GetAttribute("id");

            float px = float.Parse(pxStr);
            float py = float.Parse(pyStr);
            this.position = new Vector2(px, py);

            LoadContent();

            this.isGotten = isGotten;
            if (isGotten)
            {
                this.Texture = textureOff;
            }
            else
            {
                this.Texture = textureOn;
            }

            top = (int)Y - 20;
            bottom = (int)Y;
        }
 public Door(Game1 game, Vector2 position, string levelFileName)
     : base(game, position)
 {
     this.levelFileName = levelFileName;
     this.keyUpHint = new KeyUpHint(game, new Vector2(position.X + 7, position.Y - 35),
         "Door_hint");
 }
 public KeyUpHint(Game1 game, Vector2 position, string id)
     : base(game)
 {
     this.id = id;
     this.game = game;
     this.position = position;
     Level.Objects.Add(this);
 }
Example #8
0
        public OgreBase(Game1 game, Vector2 position)
            : base(game)
        {
            this.game = game;
            this.position = position;

            Level.Objects.Add(this);
            LoadContent();
        }
 public Treasure(Game1 game,string id, bool isGotten)
     : base(game)
 {
     this.id = id;
     this.isGotten = isGotten;
     LoadContent();
     top = (int)Y - 20;
     bottom = (int)Y;
 }
Example #10
0
        public OgreCore(Game1 game, Vector2 position, float Maxoffset)
            : base(game)
        {
            this.game = game;
            this.position = new Vector2(position.X + 18, position.Y + 13);
            this.maxOffset = Maxoffset;

            Level.MovableObjects.Add(this);
            LoadContent();
        }
        public DeadlyObject(Game1 game, XmlTextReader reader)
            : base(game,reader)
        {
            string pxStr = reader.GetAttribute("px");
            string pyStr = reader.GetAttribute("py");
            string widthStr = reader.GetAttribute("width");

            float px = float.Parse(pxStr);
            float py = float.Parse(pyStr);
            frameX = (int)Math.Ceiling(double.Parse(widthStr) / texture.Width);
            this.position = new Vector2(px, py);
        }
        public ShiftStick(Game1 game, XmlTextReader reader)
            : base(game, reader)
        {
            string pxStr = reader.GetAttribute("px");
            string pyStr = reader.GetAttribute("py");
            float px = float.Parse(pxStr);
            float py = float.Parse(pyStr);

            this.game = game;
            this.position = new Vector2(px, py);
            this.keyUpHint = new KeyUpHint(game, new Vector2(px + 7, py - 35),
                this.id + "hint");
        }
        public Ladder(Game1 game, XmlTextReader reader)
            : base(game, reader)
        {
            string pxStr = reader.GetAttribute("px");
            string pyStr = reader.GetAttribute("py");
            string heightStr = reader.GetAttribute("height");

            float px = float.Parse(pxStr);
            float py = float.Parse(pyStr);
            int height = int.Parse(heightStr);

            this.position = new Vector2(px, py);
            this.Height = height;
        }
        public Ogre(Game1 game, XmlTextReader reader)
        {
            string pxStr = reader.GetAttribute("px");
            string pyStr = reader.GetAttribute("py");
            string offsetStr = reader.GetAttribute("offset");

            float px = float.Parse(pxStr);
            float py = float.Parse(pyStr);
            float offset = float.Parse(offsetStr);

            Vector2 position = new Vector2(px, py);

            ogreBase = new OgreBase(game, position);
            ogreCore = new OgreCore(game, position, offset);
        }
Example #15
0
 public Object(Game1 game, XmlTextReader reader)
     : this(game)
 {
     this.id = reader.GetAttribute("id");
     string movable = reader.GetAttribute("movable");
     if (movable != null && movable == "true")
     {
         this.movable = true;
         Level.MovableObjects.Add(this);
     }
     else
     {
         this.movable = false;
         Level.Objects.Add(this);
     }
 }
        public Mirror(Game1 game, XmlTextReader reader)
            : base(game, reader)
        {
            string pxStr2 = reader.GetAttribute("px");
            string pyStr2 = reader.GetAttribute("py");
            string normalAngleStr = reader.GetAttribute("normalAngle");

            float px2 = float.Parse(pxStr2);
            float py2 = float.Parse(pyStr2);
            if (normalAngleStr != null)
                this.normalAngle = float.Parse(normalAngleStr);

            this.game = game;
            this.position = new Vector2(px2, py2);
            keyUpHint = new KeyUpHint(game, new Vector2(px2 + 5, py2 - 15), this.id + "hint");
        }
        public Door(Game1 game, XmlTextReader reader)
            : base(game, reader)
        {
            string pxStr = reader.GetAttribute("px");
            string pyStr = reader.GetAttribute("py");
            this.levelFileName = reader.GetAttribute("levelFileName");
            this.levelName = reader.GetAttribute("levelName");
            this.bindingId = reader.GetAttribute("bindingId");

            float px = float.Parse(pxStr);
            float py = float.Parse(pyStr);

            this.game = game;
            this.position = new Vector2(px, py);
            this.keyUpHint = new KeyUpHint(game, new Vector2(px + 7, py - 35),
                this.id + "hint");
        }
        public LightSource(Game1 game, XmlTextReader reader)
            : base(game, reader)
        {
            string pxStr2 = reader.GetAttribute("px");
            string pyStr2 = reader.GetAttribute("py");
            string angleStr = reader.GetAttribute("angle");
            string switchOnStr = reader.GetAttribute("switchOn");

            float px2 = float.Parse(pxStr2);
            float py2 = float.Parse(pyStr2);
            if (angleStr != null)
                this.angle = float.Parse(angleStr);
            if (switchOnStr != null && switchOnStr == "false")
                this.switchOn = false;

            this.game = game;
            this.position = new Vector2(px2, py2);
            this.lightRay = new LightRay(game, Helper.ToVector2(CollisionRect.Center), angle);
            this.lightRay.LightSource = this;
        }
Example #19
0
        public Enemy(Game1 game, Vector2 position, Vector2 speed, string launcherId)
            : base(game, position)
        {
            this.leftBound = 0;
            this.rightBound = Level.Width;
            if (speed != Vector2.Zero)
            {
                this.speed = speed;
                if (this.speed.X > 0)
                {
                    this.face_right = true;
                }
                else
                {
                    this.face_right = false;
                }

                isPowered = true;
            }
            this.launcherId = launcherId;
        }
        public Launcher(Game1 game, XmlTextReader reader)
            : base(game, reader)
        {
            string pxStr = reader.GetAttribute("px");
            string pyStr = reader.GetAttribute("py");
            string generateTimeStr = reader.GetAttribute("generate_time");
            string generateAmountStr = reader.GetAttribute("generateAmount");
            string speedXStr = reader.GetAttribute("speed_x");
            string speedYStr = reader.GetAttribute("speed_y");
            string direction = reader.GetAttribute("direction");

            this.generateType = reader.GetAttribute("generate_type");
            this.generateTime = int.Parse(generateTimeStr);
            this.game = game;

            if (direction == "right")
            {
                spriteEffects = SpriteEffects.FlipHorizontally;
            }
            else
            {
                spriteEffects = SpriteEffects.None;
            }
            if (generateAmountStr == null)
            {
                this.generateAmount = -1;
            }
            else
            {
                this.generateAmount = int.Parse(generateAmountStr);
            }

            float speedX = float.Parse(speedXStr);
            float speedY = float.Parse(speedYStr);
            this.powerSpeed = new Vector2(speedX, speedY);

            float px = float.Parse(pxStr);
            float py = float.Parse(pyStr);
            this.position = new Vector2(px, py);
        }
Example #21
0
 public Enemy(Game1 game, XmlTextReader reader)
     : base(game, reader)
 {
     string pxStr = reader.GetAttribute("px");
     string pyStr = reader.GetAttribute("py");
     string positiveStr = reader.GetAttribute("face_right");
     string leftStr = reader.GetAttribute("left");
     string rightStr = reader.GetAttribute("right");
     float px = float.Parse(pxStr);
     float py = float.Parse(pyStr);
     if (leftStr != null)
     {
         leftBound = float.Parse(leftStr);
     }
     else
     {
         leftBound = 0;
     }
     if (rightStr != null)
     {
         rightBound = float.Parse(rightStr);
     }
     else
     {
         rightBound = Level.Width;
     }
     this.game = game;
     this.launcherId = null;
     this.position = new Vector2(px, py);
     if (positiveStr == "true")
     {
         face_right = true;
     }
     else
     {
         face_right = false;
     }
 }
Example #22
0
 public Object(Game1 game)
 {
     this.game = game;
     LoadContent();
 }
Example #23
0
 public Object(Game1 game, Vector2 position)
     : this(game)
 {
     this.position = position;
 }
 public Ladder(Game1 game, Vector2 position, int height)
     : base(game, position)
 {
     this.Height = height;
 }
 public Launcher(Game1 game, Vector2 position)
     : base(game, position)
 {
 }
 public Gate(Game1 game, Vector2 position, Point tileFrame)
     : base(game, position, tileFrame)
 {
 }
        public Gate(Game1 game, XmlTextReader reader)
            : base(game, reader)
        {
            string pxStr = reader.GetAttribute("px");
            string pyStr = reader.GetAttribute("py");
            string widthStr = reader.GetAttribute("width");
            string heightStr = reader.GetAttribute("height");

            float px = float.Parse(pxStr);
            float py = float.Parse(pyStr);
            int width = int.Parse(widthStr);
            int height = int.Parse(heightStr);

            this.position = new Vector2(px, py);
            this.Width = width;
            this.Height = height;

            XmlReader subtree = reader.ReadSubtree();
            while (subtree.Read())
            {
                if (subtree.NodeType == XmlNodeType.Element)
                {
                    if (subtree.Name == "bound")
                    {
                        string leftStr = reader.GetAttribute("left");
                        string rightStr = reader.GetAttribute("right");
                        string topStr = reader.GetAttribute("top");
                        string bottomStr = reader.GetAttribute("bottom");
                        float left = float.Parse(leftStr);
                        float right = float.Parse(rightStr);
                        float top = float.Parse(topStr);
                        float bottom = float.Parse(bottomStr);
                        this.blockInfo = new BlockInfo(left, right, top, bottom, true);
                    }
                }
            }
        }
 public Gate(Game1 game, Vector2 position, int width, int height)
     : base(game, position, width, height)
 {
 }
 public Gate(Game1 game, Vector2 position, int width)
     : base(game, position, width)
 {
 }
Example #30
0
 public Object(Game1 game, Vector2 position, float scale)
     : this(game)
 {
     this.position = position;
     this.scale = scale;
 }
Example #31
0
 public Level(Game1 game)
 {
     this.game = game;
 }