示例#1
0
        public cWorld(cGameScene p_scene, Vector2u window_size)
        {
            pScene         = p_scene;
            windowSize     = window_size;
            drawTileBounds = new cAABB(0, 0, 1, 1);

            m_Level1 = new cMapData();
            //m_Level1.Create(100, 100);
            this.LoadLevel("levels/level1.txt");                                                          //("levels/level1.txt");

            m_TextureOfTiles = new RenderTexture((uint)m_WorldBounds.dims.X, (uint)m_WorldBounds.dims.Y); //(windowSize.X, windowSize.Y);
            m_TextureOfTiles.SetActive(true);

            m_TileSetTexture        = cAssetManager.GetTexture("tileSet_16");
            m_TileSetTexture.Smooth = true;

            m_BGtexture          = cAssetManager.GetTexture(Constants.BG_TEXTURE);
            m_BGtexture.Repeated = true;
            m_BGtexture.Smooth   = true;

            background             = new Sprite(m_BGtexture);
            background.TextureRect = new IntRect(0, 0, (int)m_WorldBounds.dims.X, (int)m_WorldBounds.dims.Y); // (int)m_TextureOfTiles.Size.X, (int)m_TextureOfTiles.Size.Y);
            background.Color       = Constants.BACKGROUND_COLOR;

            tempSprite = new Sprite(m_TileSetTexture);
        }
示例#2
0
        private NeighInfo getNumOfLinearNeighsByCode(cMapData map, Vector2i tile_pos, TileType type)
        {
            NeighInfo returner = new NeighInfo();

            int tx = tile_pos.X;
            int ty = tile_pos.Y;

            cTile left  = map.GetTileAtXY(tx - 1, ty);
            cTile top   = map.GetTileAtXY(tx, ty - 1);
            cTile right = map.GetTileAtXY(tx + 1, ty);
            cTile bot   = map.GetTileAtXY(tx, ty + 1);

            if (left != null && left.Type == type)
            {
                returner.HasLeft = true;
            }

            if (top != null && top.Type == type)
            {
                returner.HasTop = true;
            }

            if (right != null && right.Type == type)
            {
                returner.HasRight = true;
            }

            if (bot != null && bot.Type == type)
            {
                returner.HasBottom = true;
            }

            return(returner);
        }
示例#3
0
        public cWorld(GameScene p_scene, Vector2u window_size)
        {
            sceneRef   = p_scene;
            windowSize = window_size;

            currentLevel = new cMapData(p_scene.Assets);

            m_BGtexture          = sceneRef.Assets.GetTexture(Constants.BG_TEXTURE);
            m_BGtexture.Repeated = true;
            m_BGtexture.Smooth   = true;

            //tempSprite = new Sprite(m_TileSetTexture);

            background       = new Sprite(m_BGtexture);
            background.Color = Constants.BACKGROUND_COLOR;
        }