public override void Initialize(Level level, float blockWidth) { Level = level; BlockWidth = blockWidth; if (door == null) { doorX = (int)SpawnPos.X + 2; doorY = -(int)SpawnPos.Y; Door door = new Door(level, blockWidth, new Vector2(doorX, -doorY)); level.AddGameObject(door, doorX, doorY); } door.SetButton((int)SpawnPos.X, -(int)SpawnPos.Y); animationSpeed = 3; animationTimer = 0; State1 = State.Unpressed; frame = 0; images = LoadedContent.button; height = images[0].Height * blockWidth / images[0].Width; body = new Body(this, level.PhysicsMangager, true, 1, 0, 0); body.Pos = SpawnPos * BlockWidth; UpdateRotation(); }
public bool MoveTile(GameObject gameObject, int x, int y, int toX, int toY) { if (toX >= 0 && toY >= 0) { level.LevelObjects[x][y].Remove(gameObject); level.AddGameObject(gameObject, toX, toY); currentSelection.Move(toX, toY); return(true); } else { return(false); } }