Ejemplo n.º 1
0
        public SkeletonKing(Vector2 position, Map map, Vector2 patrolTarget, NewTimer timer)
        {
            this.map = map;
            this.timer = timer;

            Tag = "SkeletonKing";

            transform = AddComponent<Transform>();
            transform.Position = position;

            renderer = AddComponent<ViewRenderer>();
            renderer.SetImage(Managers.Content.Load<Texture2D>("Sprites/SkeletonKing/SkeletonKing_Front_0"),40,40);
            renderer.SetImage(Managers.Content.Load<Texture2D>("Sprites/Sprite_Sheet/RougyMon"), 40, 40);
            //renderer.Pivot = new Vector2(renderer.ImageWidth / 2, renderer.ImageHeight / 1f);
            renderer.Pivot = new Vector2(16, 32);

            patrol = AddComponent<Patrol>();
            patrol.PatrolToTarget(patrolTarget);
            moveSpeed = 1;

            Animation = new SpriteAnimation("SkeletonKing", Managers.Content.Load<Texture2D>("Sprites/Sprite_Sheet/RougyMon"), Path.Combine(Managers.Content.RootDirectory, "Sprites", "Sprite_Sheet", "RougyMon.xml"));
            Animation.FrameDelay = 100;

            collider = AddComponent<BoxCollider>();
            collider.OnCollisionEnter += OnCollisionEnter;

            EventManager.OnLateUpdate += OnLateUpdate;
            EventManager.OnUpdate += OnUpdate;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Event handler for when the Map menu entry is selected.
        /// </summary>
        void MapMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            currentMap++;

            if (currentMap > Map.World)
                currentMap = 0;

            SetMenuEntryText();
        }
Ejemplo n.º 3
0
        /// <summary>
        ///   Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (_content == null)
                _content = new ContentManager(ScreenManager.Game.Services, "Content");

            _gameFont = _content.Load<SpriteFont>("gamefont");
            _mapTiles.Add(_content.Load<Texture2D>("MapTiles\\black"));
            _mapTiles.Add(_content.Load<Texture2D>("MapTiles\\white"));

            _chessBoard = new Map("chessBoard.txt");

            // A real game would probably have more content than this sample, so
            // it would take longer to load. We simulate that by delaying for a
            // while, giving you a chance to admire the beautiful loading screen.
            Thread.Sleep(1000);

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();
        }
Ejemplo n.º 4
0
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = Managers.Content;

                gameFont = content.Load<SpriteFont>("Fonts/ComicSansMS");

                Thread.Sleep(1000);
            }

            #if WINDOWS_PHONE
            if (Microsoft.Phone.Shell.PhoneApplicationService.Current.State.ContainsKey("PlayerPosition"))
            {
                playerPosition = (Vector2)Microsoft.Phone.Shell.PhoneApplicationService.Current.State["PlayerPosition"];
                enemyPosition = (Vector2)Microsoft.Phone.Shell.PhoneApplicationService.Current.State["EnemyPosition"];
            }
            #endif

            map = new Map(content.Load<Texture2D>("Map/Tiles"));
            map.LoadMapFromImage(content.Load<Texture2D>("Map/MainMap"));
            //Objects

            goldSpawn();
            healPotionSpawn();

            orkForestSpawn();
            SpiderSpawn();
            SkeletonSpawn();
            orkGraveyardSpawn();

            skeletonKing = new SkeletonKing(new Vector2(104 * 32, 40 * 32), map, new Vector2(112 * 32, 40 * 32), timer);

            skeletonKing.moveSpeed = 3;

            key_1 = new Key(new Vector2(992, 2560));
            key_2 = new Key_2(new Vector2(1136, 2096));

            doorForest = new DoorForest(new Vector2(35 * 32, 67 * 32));
            gateGraveyard = new GateGraveyard(new Vector2(81 * 32, 56 * 32));
            player = new Player(new Vector2(2976, 2240), map, doorForest, gateGraveyard);

            camera = new Camera(Managers.Graphics.GraphicsDevice.Viewport);
            //timer.GetPlayer(player);
            timer.Start();
        }