Changeset 9137
- Timestamp:
- 2017-07-26 14:50:39 (6 years ago)
- Location:
- 2017/30/MainiI
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
2017/30/MainiI/FysiikkaPeli1/FysiikkaPeli1/FysiikkaPeli1/FysiikkaPeli1.cs
r9124 r9137 11 11 Image kenttaKuva = LoadImage("Kentta"); 12 12 Image Pahankuva = LoadImage("Pahis"); 13 PlatformCharacter OlioH; 13 14 public override void Begin() 14 15 { 15 LuoOlio();16 16 Luokenttä(); 17 LuoOhjaimet(); 17 18 18 19 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 19 Camera.ZoomToLevel( );20 Camera.ZoomToLevel(-1000); 20 21 21 22 } 22 void LuoOlio()23 {24 25 26 }27 28 23 void Luokenttä() 29 24 { … … 38 33 void LuoOlioH(Vector paikka, double leveys, double korkeus) 39 34 { 40 PlatformCharacterOlioH = new PlatformCharacter(leveys, korkeus);35 OlioH = new PlatformCharacter(leveys, korkeus); 41 36 OlioH.Position = paikka; 42 37 //AddCollisionHandler(OlioH, "Pahis", TormaaVihuun); … … 65 60 OlioP.Shape = Shape.Circle; 66 61 67 RandomMoverBrain satunnaisAivot = new RandomMoverBrain(200); 68 69 List<Vector> polku = new List<Vector>(); 70 71 polkuAivot = OlioP; 62 PathFollowerBrain polkuAivot = new PathFollowerBrain(200); 63 OlioP.Brain = polkuAivot; 72 64 73 65 polkuAivot.Active = true; 66 polkuAivot.TurnWhileMoving = true; 74 67 polkuAivot.Speed = 100; 75 68 … … 79 72 polku.Add(new Vector(-100, 50)); 80 73 polku.Add(new Vector(-250, -200)); 74 81 75 polkuAivot.Path = polku; 82 76 polkuAivot.Loop = true; 77 78 } 79 void LuoOhjaimet() 80 { 81 Keyboard.Listen(Key.Left, ButtonState.Down, 82 LiikutaPelaajaa, null, new Vector(-29000, 0)); 83 Keyboard.Listen(Key.Right, ButtonState.Down, 84 LiikutaPelaajaa, null, new Vector(29000, 0)); 85 Keyboard.Listen(Key.Up, ButtonState.Down, 86 LiikutaPelaajaa, null, new Vector(0, 2000)); 87 Keyboard.Listen(Key.Down, ButtonState.Down, 88 LiikutaPelaajaa, null, new Vector(0, -2000)); 89 90 } 91 void LiikutaPelaajaa(Vector vektori) 92 { 93 OlioH.Push(vektori); 83 94 } 84 95 }
Note: See TracChangeset
for help on using the changeset viewer.