private void CreateFloatingBlock() { if (this.currentBlock != null) { // if not the first time, speed up animation this.hook.SpeedUp(); } this.currentBlock = new Towerblock(new Vector2(0, -3 * Towerblock.Size.Y)); if (this.towerStack.Count > stackCapacity) { // remove unused blocks at the bottom of the stack this.gameObjectWorld.Remove(this.towerStack.Dequeue()); // remove ground object if out of view if (this.gameObjectWorld.GameObjects.Get <Ground>() != null) { this.gameObjectWorld.GameObjects.Get <Ground>().Destroy(); } } this.towerStack.Enqueue(this.currentBlock); this.gameObjectWorld.Add(this.currentBlock); this.hook.Attach(this.currentBlock); this.hook.State = Hook.HookState.Appearing; }
private void CreateGameObjects() { this.CreateBackground(); this.CreateStaticBlocks(); this.CreateHooks(); this.currentBlock = null; // hack: since this is used to not speedup if not yet created this.CreateFloatingBlock(); this.ResetPoints(); }
private void CreateStaticBlocks() { // tower blocks at the start of the game Towerblock bottom = new Towerblock(Vector2.Zero, true); this.towerStack.Enqueue(bottom); this.gameObjectWorld.Add(bottom); // first floor, already fixed Towerblock t = new Towerblock(new Vector2(0, -Towerblock.Size.Y)); t.FixPosition(); this.gameObjectWorld.Add(t); this.towerStack.Enqueue(t); }