示例#1
0
 public static void Initialize()
 {
     mouse                = Main.mouse;
     keyboard             = Main.keyboard;
     currSpriteSheet      = TileSet.SpriteSheet[Main.currTileset];
     currTileSetPosition  = new Vector2(Main.width - currSpriteSheet.Width, 50f);
     backgroundRectangle  = new Rectangle(0, 0, Main.width - (int)currTileSetPosition.X, Main.height);
     backgroundPosition   = new Vector2(currTileSetPosition.X, 0);
     spriteSheetRectangle = new Rectangle((int)currTileSetPosition.X, (int)currTileSetPosition.Y, currSpriteSheet.Width, currSpriteSheet.Height);
     selectedTileId       = 0;
     markerPosition       = currTileSetPosition;
     dragging             = false;
     defaultRect          = new Rectangle(0, 0, TileSet.tileWidth, TileSet.tileHeight);
     markerRect           = defaultRect;
     blocksMode           = false;
     isDraggingRect       = false;
     rectsToRemove        = new List <Rectangle>();
 }
示例#2
0
        protected override void Initialize()
        {
            mouse    = new MouseCursor(width, height, 150);
            keyboard = new KeysInput();
            InitializeEnemyStats();
            exit                = false;
            camera              = new Camera();
            tilemap             = new TileMap(Vector2.Zero, levelWidth1, levelHeight1);
            TileSet.SpriteSheet = new List <Texture2D>();
            TileSet.tileHeight  = 32;
            TileSet.tileWidth   = 32;
            blockRects          = new List <Rectangle>();

            if (!inEditMode)
            {
                Projectiles    = new List <Projectile>();
                Entities       = new List <Entity>();
                removeEntities = new List <Entity>();
                player         = new Player(new Vector2(370, 1612));
                Entities.Add(player);
                Entities.Add(new Enemy(new Vector2(600, 800), 0));
                Entities.Add(new Enemy(new Vector2(700, 800), 0));
                Entities.Add(new Enemy(new Vector2(800, 800), 0));
                Entities.Add(new Enemy(new Vector2(900, 800), 0));
                Entities.Add(new Enemy(new Vector2(1000, 800), 0));
                Entities.Add(new Enemy(new Vector2(1100, 800), 0));
                Entities.Add(new Enemy(new Vector2(1200, 800), 0));
            }
            else
            {
                currTileset = 0;
            }

            LoadLevel();
            base.Initialize();
        }