public void Draw() { if (isAlive) { IndexClose close = Index.GetCmdClose(); for (int i = 0; i < scores.Length; i++) { if (scores[i].Position.Y >= close.Position.Y + close.Radius) { scores[i].Draw(); } } } }
public override void OnCick() { if (Game.isPlayble) { Game.isAlive = true; Index.Wrap(true); IndexClose close = Index.GetCmdClose(); close.IsAlive = false; } else { Game.Reset(); Game.isPlayble = true; Game.isAlive = true; } }
static Index() { window = new Window(800, 600, "Home Page", PixelFormat.RGB); GfxTools.Init(window); //CMDLOGO Vector2 logoPosition; logoPosition.X = GfxTools.Win.width / 2; logoPosition.Y = 150; int numSpriteLogo = 1; float fpsLogo = 0; logo = new Logo(logoPosition, numSpriteLogo, fpsLogo); //CMDPLAY Vector2 playPosition; playPosition.X = GfxTools.Win.width / 2; playPosition.Y = 300; float fpsPalyer = 0; int numSpritePlayer = 1; int verticalMaxSpeedPlayer = Gravity.gravity * 3; int horizontalMaxSpeedPlayer = Gravity.gravity * 3; cmdPlay = new IndexPlay(playPosition, numSpritePlayer, fpsPalyer, verticalMaxSpeedPlayer, horizontalMaxSpeedPlayer); //CMDSCORE Vector2 scorePosition; scorePosition.X = GfxTools.Win.width / 2; scorePosition.Y = playPosition.Y + 100; float fpsScore = 0; int numSpriteScore = 1; int verticalMaxSpeedScore = Gravity.gravity * 3; int horizontalMaxSpeedScore = Gravity.gravity * 3; cmdScore = new IndexScore(scorePosition, numSpriteScore, fpsScore, verticalMaxSpeedScore, horizontalMaxSpeedScore); //CMDCREDITS Vector2 creditsPosition; creditsPosition.X = GfxTools.Win.width / 2; creditsPosition.Y = scorePosition.Y + 100; float fpsCredits = 0; int numSpriteCredits = 1; int verticalMaxSpeedCredits = Gravity.gravity * 3; int horizontalMaxSpeedCredits = Gravity.gravity * 3; cmdCredits = new IndexCredits(creditsPosition, numSpriteCredits, fpsCredits, verticalMaxSpeedCredits, horizontalMaxSpeedCredits); //CMDCLOSE Vector2 closePosition; closePosition.X = GfxTools.Win.width - 50; closePosition.Y = 100; float fpsClose = 0; int numSpriteClose = 1; int verticalMaxSpeedClose = Gravity.gravity * 3; int horizontalMaxSpeedClose = Gravity.gravity * 3; cmdClose = new IndexClose(closePosition, numSpriteClose, fpsClose, verticalMaxSpeedClose, horizontalMaxSpeedClose); //CMDSOUND Vector2 soundPosition; soundPosition.X = 100; soundPosition.Y = GfxTools.Win.height - 100; float fpsSound = 0; int numSpriteSound = 2; cmdSound = new CMDSound(soundPosition, numSpriteSound, fpsSound); //CREDITSTEXT Vector2 creditsTextPosition; creditsTextPosition.X = GfxTools.Win.width / 2; creditsTextPosition.Y = 300; float fpsCreditsText = 0; int numSpriteCreditsText = 1; int verticalMaxSpeedCreditsText = Gravity.gravity * 3; int horizontalMaxSpeedCreditsText = Gravity.gravity * 3; credits = new Credits(playPosition, numSpriteCreditsText, fpsCreditsText, verticalMaxSpeedCreditsText, horizontalMaxSpeedCreditsText); //SCORES scores = new Score(); //AUDIO string[] audioPath = { @"Assets\media\index\Deep_In_Space.wav" }; audio = new Audio(audioPath, true); audio.Play(); }