public static void DrawInstructionPage() { SwinGame.DrawBitmapOnScreen(_gameBackground, 0, 0); SwinGame.FillRectangle(SwinGame.RGBAColor(0, 0, 0, 200), 0, 0, 750, 630); SwinGame.FillRectangle(SwinGame.RGBAColor(0, 0, 0, 200), 0, 0, 750, 30); SwinGame.DrawTextLines("Swinburne University of Technology Sarawak", Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 12, FontAlignment.AlignLeft, 12, 12, 300, 100); SwinGame.DrawTextLines("SWE20001 Development Project 1 - Tools and Practices", Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 12, FontAlignment.AlignLeft, 420, 12, 400, 100); SwinGame.DrawBitmapOnScreen(_Images["instruction"], 180, 55); SwinGame.DrawText("1. Left click on your mouse to select the first block, then, right click on the second", Color.White, 10, 155); SwinGame.DrawText(" block to swap.", Color.White, 10, 170); SwinGame.DrawText("2. Blocks can only be swapped if their are located next to each other, above or below", Color.White, 10, 195); SwinGame.DrawText(" of each other.", Color.White, 10, 210); SwinGame.DrawText("3. Blocks will not be swapped if there is no match.", Color.White, 10, 235); SwinGame.DrawText("4. When there are 3 or more matching blocks, they will be deleted and new blocks will", Color.White, 10, 260); SwinGame.DrawText(" be generated.", Color.White, 10, 275); SwinGame.DrawText("5. Score as many as you can in 1 minute before the time runs out!", Color.White, 10, 300); //Back button SwinGame.DrawBitmapOnScreen(_Images ["button"], 280, 500); SwinGame.DrawTextLines("Back", SwinGame.RGBColor(51, 102, 0), SwinGame.RGBAColor(0, 0, 0, 0), "mavenbold", 20, FontAlignment.AlignCenter, 280, 535, 200, 100); SwinGame.FillRectangle(SwinGame.RGBAColor(0, 0, 0, 200), 0, 610, 750, 30); //SwinGame.DrawTextLines ("SWE20001 Development Project 1 - Tools and Practices", Color.White, SwinGame.RGBAColor (0, 0, 0, 0), "maven_pro_regular", 12, FontAlignment.AlignLeft, 12, 612, 400, 100); SwinGame.DrawTextLines("Developed by: Agile Crocodile (Sharon Lo Ying Ying, Darren Wong Siew Ding, Joseph Sim Wei Min)", Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 12, FontAlignment.AlignLeft, 12, 612, 600, 100); }
public static void DrawEndGame() { SwinGame.DrawBitmapOnScreen(_gameBackground, 0, 0); SwinGame.FillRectangle(SwinGame.RGBAColor(0, 0, 0, 200), 0, 0, 750, 630); SwinGame.FillRectangle(SwinGame.RGBAColor(0, 0, 0, 200), 0, 0, 750, 30); SwinGame.DrawTextLines("Swinburne University of Technology Sarawak", Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 12, FontAlignment.AlignLeft, 12, 12, 300, 100); SwinGame.DrawBitmapOnScreen(_Images["ranking"], 245, 55); }
public static void DrawGameBoard(Board myBoard, ColorBlock[,] _blocks) { timeTicks = SwinGame.TimerTicks(gameTime); SwinGame.DrawBitmapOnScreen(_gameBackground, 0, 0); SwinGame.DrawBitmapOnScreen(_gamePanel, 540, 12); SwinGame.FillRectangle(SwinGame.RGBAColor(0, 0, 0, 200), 12, 12, 525, 615); for (int x = 0; x < 9; x++) { for (int y = 0; y < 9; y++) { _blocks [x, y].Draw(); } } //SwinGame.FillRectangle(SwinGame.RGBAColor (0, 0, 0, 200), 12, 639, 524, 50); //SwinGame.DrawRectangle (Color.White, 12, 639, 524, 50); SwinGame.DrawBitmapOnScreen(_boxPanel, 548, 48); SwinGame.DrawTextLines("End Time:", Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 20, FontAlignment.AlignCenter, 492, 60, 300, 100); SwinGame.DrawTextLines(endTime.ToString(), Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 25, FontAlignment.AlignCenter, 496, 80, 300, 100); SwinGame.DrawBitmapOnScreen(_boxPanel, 548, 130); SwinGame.DrawTextLines("Time:", Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 20, FontAlignment.AlignCenter, 496, 140, 300, 100); SwinGame.DrawTextLines((timeTicks /= 1000).ToString(), Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 25, FontAlignment.AlignCenter, 496, 160, 300, 100); SwinGame.DrawBitmapOnScreen(_boxPanel, 548, 210); SwinGame.DrawTextLines("Score:", Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 20, FontAlignment.AlignCenter, 495, 220, 300, 100); SwinGame.DrawTextLines(myBoard.Score.ToString(), Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 25, FontAlignment.AlignCenter, 496, 240, 300, 100); if (UIController.TimerPaused) { //Draw a layer to cover the game board SwinGame.FillRectangle(SwinGame.RGBAColor(0, 0, 0, 200), 12, 12, 525, 615); SwinGame.DrawTextLines("Game Paused", Color.White, SwinGame.RGBAColor(0, 0, 0, 200), "maven_pro_regular", 40, FontAlignment.AlignCenter, 125, 260, 300, 100); //Draw the resume button on the right game panel SwinGame.DrawBitmapOnScreen(_Images ["resume"], 565, 320); } else { //Draw the pause button on the right game panel SwinGame.DrawBitmapOnScreen(_Images ["pause"], 565, 320); } //Draw the buttons on the game panel SwinGame.DrawBitmapOnScreen(_Images["menu"], 565, 400); SwinGame.DrawBitmapOnScreen(_Images["exit"], 565, 480); //SwinGame.DrawText ("EndTime: " + endTime, Color.White, 550, 100); //SwinGame.DrawText ("Score: " + myBoard.Score, Color.White, 100, 660); //SwinGame.DrawText ("Time: " + (timeTicks/=1000).ToString() + " seconds", Color.White, 350, 660); }
public static void DrawRanking() { SwinGame.DrawBitmapOnScreen(_gameBackground, 0, 0); SwinGame.FillRectangle(SwinGame.RGBAColor(0, 0, 0, 200), 0, 0, 750, 630); SwinGame.FillRectangle(SwinGame.RGBAColor(0, 0, 0, 200), 0, 0, 750, 30); SwinGame.DrawTextLines("Swinburne University of Technology Sarawak", Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 12, FontAlignment.AlignLeft, 12, 12, 300, 100); SwinGame.DrawTextLines("SWE20001 Development Project 1 - Tools and Practices", Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 12, FontAlignment.AlignLeft, 420, 12, 400, 100); SwinGame.DrawBitmapOnScreen(_Images["ranking"], 245, 55); SwinGame.DrawBitmapOnScreen(_Images ["button"], 280, 500); SwinGame.DrawTextLines("Back", SwinGame.RGBColor(51, 102, 0), SwinGame.RGBAColor(0, 0, 0, 0), "mavenbold", 20, FontAlignment.AlignCenter, 280, 535, 200, 100); SwinGame.DrawTextLines("Developed by: Agile Crocodile (Sharon Lo Ying Ying, Darren Wong Siew Ding, Joseph Sim Wei Min)", Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 12, FontAlignment.AlignLeft, 12, 612, 600, 100); }
public static void DrawMenuPage() { SwinGame.DrawBitmapOnScreen(_Background, 0, 0); SwinGame.FillRectangle(SwinGame.RGBAColor(0, 0, 0, 200), 0, 0, 750, 30); SwinGame.DrawTextLines("Swinburne University of Technology Sarawak", Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 12, FontAlignment.AlignLeft, 12, 12, 300, 100); SwinGame.DrawTextLines("SWE20001 Development Project 1 - Tools and Practices", Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 12, FontAlignment.AlignLeft, 420, 12, 400, 100); SwinGame.DrawTextLines("Play", SwinGame.RGBColor(51, 102, 0), SwinGame.RGBAColor(0, 0, 0, 0), "mavenbold", 20, FontAlignment.AlignCenter, 282, 242, 200, 100); SwinGame.DrawTextLines("Instruction", SwinGame.RGBColor(51, 102, 0), SwinGame.RGBAColor(0, 0, 0, 0), "mavenbold", 20, FontAlignment.AlignCenter, 285, 318, 200, 100); SwinGame.DrawTextLines("Ranking", SwinGame.RGBColor(51, 102, 0), SwinGame.RGBAColor(0, 0, 0, 0), "mavenbold", 20, FontAlignment.AlignCenter, 285, 390, 200, 100); SwinGame.DrawTextLines("Quit", SwinGame.RGBColor(51, 102, 0), SwinGame.RGBAColor(0, 0, 0, 0), "mavenbold", 20, FontAlignment.AlignCenter, 285, 465, 200, 100); SwinGame.FillRectangle(SwinGame.RGBAColor(0, 0, 0, 200), 0, 610, 750, 30); SwinGame.DrawTextLines("Developed by: Agile Crocodile (Sharon Lo Ying Ying, Darren Wong Siew Ding, Joseph Sim Wei Min)", Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 12, FontAlignment.AlignLeft, 12, 612, 600, 100); }
public static void DrawEndRanking() { SwinGame.DrawBitmapOnScreen(_gameBackground, 0, 0); SwinGame.FillRectangle(SwinGame.RGBAColor(0, 0, 0, 200), 0, 0, 750, 630); SwinGame.FillRectangle(SwinGame.RGBAColor(0, 0, 0, 200), 0, 0, 750, 30); SwinGame.DrawTextLines("Swinburne University of Technology Sarawak", Color.White, SwinGame.RGBAColor(0, 0, 0, 0), "maven_pro_regular", 12, FontAlignment.AlignLeft, 12, 12, 300, 100); SwinGame.DrawBitmapOnScreen(_Images["ranking"], 245, 55); SwinGame.DrawBitmapOnScreen(_Images["button"], 60, 500); SwinGame.DrawTextLines("Menu", SwinGame.RGBColor(51, 102, 0), SwinGame.RGBAColor(0, 0, 0, 0), "mavenbold", 20, FontAlignment.AlignCenter, 115, 535, 100, 100); SwinGame.DrawBitmapOnScreen(_Images["button"], 500, 500); SwinGame.DrawTextLines("Play Again", SwinGame.RGBColor(51, 102, 0), SwinGame.RGBAColor(0, 0, 0, 0), "mavenbold", 20, FontAlignment.AlignCenter, 550, 535, 100, 100); }
public static void Main() { //Open the game window SwinGame.OpenGraphicsWindow("GameMain", 900, 650); GameBoard gb = new GameBoard(); gb.BackgroundColor = SwinGame.RandomRGBColor(255); ObstacleType obstacleToAdd = ObstacleType.Car; PlayerVehicle p = new PlayerVehicle(415, 570); ScoreBoard s = new ScoreBoard(0, 3, 1, "Peak Hours"); //Run the game loop while (false == SwinGame.WindowCloseRequested()) { Random _random = new Random(); int _chance = _random.Next(0, 10); Car c = new Car(415, 20); Lorry l = new Lorry(415, 20); Motorcycle m = new Motorcycle(415, 20); Fuel f = new Fuel(415, 20); if (_chance == 0 || _chance == 1 || _chance == 2) { obstacleToAdd = ObstacleType.Car; } else if (_chance == 3 || _chance == 4 || _chance == 5) { obstacleToAdd = ObstacleType.Lorry; } else if (_chance == 6 || _chance == 7 || _chance == 8) { obstacleToAdd = ObstacleType.Motorcycle; } else if (_chance == 9) { obstacleToAdd = ObstacleType.Fuel; } SwinGame.ProcessEvents(); SwinGame.ClearScreen(Color.White); gb.Draw(); gb.Spawned = false; while (gb.Spawned == false) { //Fetch the next batch of UI interaction SwinGame.ProcessEvents(); //Clear the screen and draw the framerate SwinGame.ClearScreen(Color.White); gb.Draw(); if (obstacleToAdd == ObstacleType.Car) { gb.RandomSpawnVehicle(c, s, p); } else if (obstacleToAdd == ObstacleType.Lorry) { gb.RandomSpawnVehicle(l, s, p); } else if (obstacleToAdd == ObstacleType.Motorcycle) { gb.RandomSpawnVehicle(m, s, p); } else if (obstacleToAdd == ObstacleType.Fuel) { gb.RandomSpawnVehicle(f, s, p); } if (SwinGame.KeyTyped(KeyCode.vk_LEFT)) { p.NavigateLeft(); } else if (SwinGame.KeyTyped(KeyCode.vk_RIGHT)) { p.NavigateRight(); } p.Draw(); SwinGame.DrawText("Score:" + s.Score.ToString(), Color.Black, 10, 100); SwinGame.DrawText("Life:" + s.Life.ToString(), Color.Black, 10, 150); SwinGame.DrawText("Stage:" + s.Stage.ToString(), Color.Black, 10, 200); SwinGame.DrawText("Speed:" + s.Traffic.ToString(), Color.Black, 10, 350); SwinGame.DrawText("Right Arrow key to move right", Color.Black, 10, 250); SwinGame.DrawText("Left Arrow key to move left", Color.Black, 10, 300); SwinGame.DrawFramerate(0, 0); //Draw onto the screen SwinGame.RefreshScreen(60); } gb.GetScore(s); gb.ClearScreen(); gb.DisplaySpeed(s); if (gb.GameOver(s) == true) { // // if (SwinGame.KeyTyped (KeyCode.vk_y)) // { // SwinGame.ClearScreen(); // s.Life = 3; // s.Score = 0; // } // else if (SwinGame.KeyTyped (KeyCode.vk_n)) // { // do // { // SwinGame.DrawBitmapOnScreen (new Bitmap("thankyou.jpg"), 0, 0); // SwinGame.RefreshScreen (60); // SwinGame.ReleaseBitmap("thankyou.jpg"); // } while (false == SwinGame.WindowCloseRequested ()); // } // else // { // do // { // SwinGame.DrawBitmapOnScreen(new Bitmap("gameover.jpg"), 0, 0); // SwinGame.RefreshScreen (25); // SwinGame.ReleaseBitmap("gameover.jpg"); // } while (false == SwinGame.WindowCloseRequested()); // } do { SwinGame.ProcessEvents(); SwinGame.DrawBitmapOnScreen(new Bitmap("gameover.jpg"), 0, 0); SwinGame.RefreshScreen(60); SwinGame.ReleaseBitmap("gameover.jpg"); } while (SwinGame.AnyKeyPressed() == false); //}while (!(SwinGame.KeyTyped (KeyCode.vk_y)) || !(SwinGame.KeyTyped (KeyCode.vk_n)) ); if (SwinGame.KeyTyped(KeyCode.vk_y)) { s.Life = 3; s.Score = 0; gb.RestartTimer(); } else if (SwinGame.KeyTyped(KeyCode.vk_n)) { do { SwinGame.DrawBitmapOnScreen(new Bitmap("thankyou.jpg"), 0, 0); SwinGame.RefreshScreen(60); SwinGame.ReleaseBitmap("thankyou.jpg"); } while (false == SwinGame.WindowCloseRequested()); } } SwinGame.DrawFramerate(0, 0); //Draw onto the screen SwinGame.RefreshScreen(60); } }