コード例 #1
0
ファイル: Player.cs プロジェクト: AdoriaStudios/BlockyGame
        public Player(MainGame game, Tile spawnPoint)
        {
            //Salvando os tiles ocupados:
            mCurrentTiles = new List<Tile>();
            mCurrentTiles.Add(spawnPoint);

            //Definindo o estado inicial:
            mCurrentState = STATE.STANDING;

            //Inicializando o Sprite:
            _sprite = new Sprite(game.Content.Load<Texture2D>("Images/Tileset"), mCurrentTiles[0].Sprite.DrawPosition);

            //Corrigindo o Y:
            _sprite.DrawPosition_Y -= 128;

            //Salvando o spriteRect:
            _sprite.SpriteRect = new Rectangle(0, 64, 128, 192);

            //Atualizando a origem do sprite (Sempre Centralizada):
            _sprite.Origin = new Vector2(_sprite.SpriteRect.Width / 2, _sprite.SpriteRect.Height / 2);
            _sprite.Color = new Color(Color.White, 0.5f);
            _sprite.Rotation = 0f;

            //Zerando:
            _qtdMoves = 0;
            _playTime = TimeSpan.Zero;
        }
コード例 #2
0
ファイル: Map.cs プロジェクト: AdoriaStudios/BlockyGame
        public Map(sLoadedMap mapInfo, MainGame game)
        {
            //Salvando as informações:
            _mapInfo = mapInfo;
            mExitTiles = new List<Tile>();

            //Instanciando os tiles:
            _tiles = new Tile[(int)_mapInfo._mapSize.X, (int)_mapInfo._mapSize.Y];
            for (int x = 0; x < _mapInfo._mapSize.X; x++)
            {
                for (int y = 0; y < _mapInfo._mapSize.Y; y++)
                {
                    _tiles[x,y] = new Tile(game, _mapInfo.MapTiles[x, y]._type, _mapInfo.MapTiles[x, y]._mapPosition);
                }
            }

            //Acertando as posições de desenho:
            for (int y = 0; y < _mapInfo._mapSize.Y; y++)
            {
                for (int x = (int)_mapInfo._mapSize.X - 1; x >= 0; x--)
                {
                    //Calculando a posição:
                    _tiles[x, y].Sprite.DrawPosition = new Vector2((x * Tile.TILE_SIZE.X / 2) + (y * Tile.TILE_SIZE.X / 2),
                                                               (y * Tile.TILE_SIZE.Y / 2) - (x * Tile.TILE_SIZE.Y / 2));
                }
            }

            //Procurando o Spawn Point e as saídas:
            foreach (var tile in _tiles)
            {
                //É um spawn?
                if(tile.Type == TILE_TYPES.SPAWN)
                {
                    mSpawnPoint = tile;
                }

                if(tile.Type == TILE_TYPES.EXIT)
                {
                    mExitTiles.Add(tile);
                }
            }
        }
コード例 #3
0
 public GamePage(string launchArguments)
 {
     _game = XamlGame<MainGame>.Create(launchArguments, Window.Current.CoreWindow, this);
 }
コード例 #4
0
ファイル: Camera.cs プロジェクト: AdoriaStudios/BlockyGame
 public Camera2D(MainGame game)
     : base(game)
 {
 }