public CreationLevel(float panelWidth, float panelHeight, string levelFile, Graphics g) { vars = new CreationGlobalVars(); rand = new Random(); this.g = g; Bitmap lvlImg = ( Bitmap )Bitmap.FromFile(levelFile); cameraWidth = panelWidth; cameraHeight = panelHeight; this.levelWidth = lvlImg.Width * GlobalVars.LEVEL_READER_TILE_WIDTH; this.levelHeight = lvlImg.Height * GlobalVars.LEVEL_READER_TILE_HEIGHT; if (!sysManagerInit) { sysManager = new CreationSystemManager(this); } sysManagerInit = true; LevelImageReader lvlImgReader = new LevelImageReader(this, lvlImg); lvlImgReader.readImage(this); //levelBeginState = new Dictionary<int, Entity>(entities); //Copy the beginning game state prevTicks = DateTime.Now.Ticks; levelFullyLoaded = true; }
public void loadFromPaint(string fileName, Graphics newG) { sysManagerInit = false; this.g = newG; Bitmap lvlImg = ( Bitmap )Bitmap.FromFile(fileName); this.levelWidth = lvlImg.Width * GlobalVars.LEVEL_READER_TILE_WIDTH; this.levelHeight = lvlImg.Height * GlobalVars.LEVEL_READER_TILE_HEIGHT; sysManager = new CreationSystemManager(this); sysManagerInit = true; LevelImageReader lvlImgReader = new LevelImageReader(this, lvlImg); lvlImgReader.readImage(this); }
//Add an entity to the list of entities public override void addEntity(int id, Entity e) { if (!sysManagerInit) { sysManager = new CreationSystemManager(this); sysManagerInit = true; } if (e is BasicGround) { GlobalVars.groundEntities.Add(id, e); } else { GlobalVars.nonGroundEntities.Add(id, e); } if (e.hasComponent(GlobalVars.COLLIDER_COMPONENT_NAME)) { getCollisionSystem().colliderAdded(e); } }
public CreationLevel(float levelWidth, float levelHeight, float panelWidth, float panelHeight, Graphics g) { vars = new CreationGlobalVars(); rand = new Random(); this.g = g; this.cameraWidth = panelWidth; this.cameraHeight = panelHeight; this.levelWidth = levelWidth; this.levelHeight = levelHeight; if (!sysManagerInit) { sysManager = new CreationSystemManager(this); } sysManagerInit = true; prevTicks = DateTime.Now.Ticks; levelFullyLoaded = true; }