- Timestamp:
- 2011-06-30 12:44:17 (12 years ago)
- Location:
- 2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/Peli.cs
r2348 r2349 9 9 public class Peli : PhysicsGame 10 10 { 11 List<Label> titleMenu; 11 12 const int SCREEN_WIDTH = 50; 12 13 const int SCREEN_HEIGTH = 50; 13 14 Player player; 14 15 Image background1 = LoadImage("Images/reactorBG"); 15 List<Label> titleMenu; 16 16 17 17 18 public override void Begin() 18 19 { 20 menuCreate(); 21 22 } 23 24 void menuCreate() 25 { 26 ClearAll(); 27 titleMenu = new List<Label>(); 28 29 Label button1 = new Label("Start Game"); 30 button1.Position = new Vector(0, 40); 31 titleMenu.Add(button1); 32 33 Label button2 = new Label("Exit Game"); 34 button2.Position = new Vector(0, -40); 35 titleMenu.Add(button2); 36 37 foreach (Label titleMenuScreen in titleMenu) 38 { 39 Add(titleMenuScreen); 40 } 41 42 Mouse.ListenOn(button1, MouseButton.Left, ButtonState.Pressed, StartGame, null); 43 Mouse.ListenOn(button2, MouseButton.Left, ButtonState.Pressed, Exit, null); 44 45 Mouse.IsCursorVisible = true; 46 Mouse.ListenMovement(1.0, MenuMovement, null); 47 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, ""); 48 } 49 50 void MenuMovement(AnalogState mouseState) 51 { 52 foreach (Label button in titleMenu) 53 { 54 if (Mouse.IsCursorOn(button)) 55 { 56 button.TextColor = Color.DarkRed; 57 } 58 else 59 { 60 button.TextColor = Color.DarkBlue; 61 } 62 } 63 } 64 65 void StartGame() 66 { 67 ClearAll(); 68 createLevel(); 19 69 Gravity = new Vector(0, -1000); 20 createLevel();21 menuCreate();22 70 23 71 // Starts playing the background music, which is set to repeat … … 31 79 } 32 80 33 34 // Creates the level from a text file35 81 void createLevel() 36 82 { … … 60 106 { 61 107 PhysicsObject hBlock = PhysicsObject.CreateStaticObject(SCREEN_WIDTH, SCREEN_HEIGTH, 62 108 Shape.Rectangle, CollisionShapeQuality.Best); 63 109 hBlock.Color = Color.Gray; 64 110 return hBlock; … … 68 114 { 69 115 PhysicsObject vBlock = PhysicsObject.CreateStaticObject(SCREEN_WIDTH, SCREEN_HEIGTH, 70 116 Shape.Rectangle, CollisionShapeQuality.Best); 71 117 vBlock.Color = Color.DarkGray; 72 118 return vBlock; 73 119 } 74 75 void menuCreate()76 {77 78 }79 120 } -
2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/Player.cs
r2348 r2349 37 37 38 38 // Collision handlers for enemies 39 AddCollisionHandler();39 // AddCollisionHandler(); 40 40 } 41 41
Note: See TracChangeset
for help on using the changeset viewer.