Changeset 618
- Timestamp:
- 2010-06-09 14:53:41 (13 years ago)
- Location:
- 2010/23/ekeimaja/Labyrinth/Labyrinth
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/23/ekeimaja/Labyrinth/Labyrinth/Content/Content.contentproj
r609 r618 55 55 <Processor>TextureProcessor</Processor> 56 56 </Compile> 57 <Compile Include="wall.png">58 <Name>wall</Name>59 <Importer>TextureImporter</Importer>60 <Processor>TextureProcessor</Processor>61 </Compile>62 57 </ItemGroup> 63 58 <ItemGroup> -
2010/23/ekeimaja/Labyrinth/Labyrinth/Peli.cs
r609 r618 8 8 namespace Labyrinth // © Eki Majankallio 2010 9 9 { 10 public class Peli : Game10 public class Peli : PhysicsGame 11 11 { 12 GameObject Pelaaja1; 12 PhysicsObject Pelaaja1; 13 PhysicsObject Pelaaja2; 13 14 14 15 const int RuudunLeveys = 50; … … 37 38 } 38 39 39 GameObject LuoPelaaja1()40 PhysicsObject LuoPelaaja1() 40 41 { 41 Pelaaja1 = new GameObject(50.0,50.0); 42 Pelaaja1 = new PhysicsObject(40.0,40.0); 43 Pelaaja1.IgnoresPhysicsLogics = true; 44 Pelaaja1.CanRotate = false; 42 45 Pelaaja1.Image = LoadImage("player1"); 43 46 Add(Pelaaja1); … … 46 49 } 47 50 48 GameObject LuoPelaaja2()51 PhysicsObject LuoPelaaja2() 49 52 { 50 GameObject Pelaaja2 = new GameObject(50.0, 50.0); 53 Pelaaja2 = new PhysicsObject(40.0, 40.0); 54 Pelaaja2.IgnoresPhysicsLogics = true; 55 Pelaaja2.CanRotate = false; 51 56 Pelaaja2.Image = LoadImage("player2"); 52 57 Add(Pelaaja2); … … 82 87 PhysicsObject seina = PhysicsObject.CreateStaticObject(50.0, 50.0); 83 88 seina.Shape = Shapes.Rectangle; 89 seina.Restitution = 0.0; 84 90 seina.Color = Color.Black; 85 91 return seina; … … 88 94 void LuoOhjain() 89 95 { 90 96 //näppäin alhaalla 91 97 Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaaVasemmalle, null); 92 98 Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaaOikealle, null); 93 99 Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaPelaajaaYlos, null); 94 100 Keyboard.Listen(Key.Down, ButtonState.Down, LiikutaPelaajaaAlas, null); 101 Keyboard.Listen(Key.A, ButtonState.Down, LiikutaPelaaja2Vasemmalle, null); 102 Keyboard.Listen(Key.D, ButtonState.Down, LiikutaPelaaja2Oikealle, null); 103 Keyboard.Listen(Key.W, ButtonState.Down, LiikutaPelaaja2Ylos, null); 104 Keyboard.Listen(Key.S, ButtonState.Down, LiikutaPelaaja2Alas, null); 105 //näppäin ylhäällä 106 Keyboard.Listen(Key.Left, ButtonState.Released, Pelaaja1.StopHorizontal, null); 107 Keyboard.Listen(Key.Right, ButtonState.Released, Pelaaja1.StopHorizontal, null); 108 Keyboard.Listen(Key.Up, ButtonState.Released, Pelaaja1.StopVertical, null); 109 Keyboard.Listen(Key.Down, ButtonState.Released, Pelaaja1.StopVertical, null); 110 Keyboard.Listen(Key.A, ButtonState.Released, Pelaaja2.StopHorizontal, null); 111 Keyboard.Listen(Key.D, ButtonState.Released, Pelaaja2.StopHorizontal, null); 112 Keyboard.Listen(Key.W, ButtonState.Released, Pelaaja2.StopVertical, null); 113 Keyboard.Listen(Key.S, ButtonState.Released, Pelaaja2.StopVertical, null); 95 114 96 115 } 97 116 98 117 //pelaaja1 99 118 void LiikutaPelaajaaVasemmalle() 100 119 { 101 Pelaaja1. Move(new Vector(-20, 0));120 Pelaaja1.Hit(new Vector(-10, 0)); 102 121 } 103 122 104 123 void LiikutaPelaajaaOikealle() 105 124 { 106 Pelaaja1. Move(new Vector(20, 0));125 Pelaaja1.Hit(new Vector(20, 0)); 107 126 } 108 127 109 128 void LiikutaPelaajaaYlos() 110 129 { 111 Pelaaja1. Move(new Vector(0, -0));130 Pelaaja1.Hit(new Vector(0, 10)); 112 131 } 113 132 114 133 void LiikutaPelaajaaAlas() 115 134 { 116 Pelaaja1.Move(new Vector(-0, 0)); 135 Pelaaja1.Hit(new Vector(0, -10)); 136 } 137 //Pelaaja2 138 void LiikutaPelaaja2Vasemmalle() 139 { 140 Pelaaja2.Hit(new Vector(-10, 0)); 141 } 142 143 void LiikutaPelaaja2Oikealle() 144 { 145 Pelaaja2.Hit(new Vector(20, 0)); 146 } 147 148 void LiikutaPelaaja2Ylos() 149 { 150 Pelaaja2.Hit(new Vector(0, 10)); 151 } 152 153 void LiikutaPelaaja2Alas() 154 { 155 Pelaaja2.Hit(new Vector(0, -10)); 117 156 } 118 157
Note: See TracChangeset
for help on using the changeset viewer.