Changeset 2796
- Timestamp:
- 2012-06-05 15:03:44 (11 years ago)
- Location:
- 2012/23/JimB/NameInPending/NameinPending/NameinPending
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/23/JimB/NameInPending/NameinPending/NameinPending/NameinPending/NameinPending.cs
r2794 r2796 45 45 PhysicsObject pelaaja1 = LuoPelaaja(paikka); 46 46 pelaaja1.Image = LoadImage("Pelaaja1"); 47 pelaaja1.CollisionIgnoreGroup = 1; 47 48 48 49 Keyboard.Listen(Key.A, ButtonState.Down, Liike,null,pelaaja1, new Vector(-200,0)); … … 56 57 Keyboard.Listen(Key.Q, ButtonState.Down, Ammu, null, pelaaja1); 57 58 } 58 void Ammu(PhysicsObject pelaaja)59 {60 PhysicsObject bullet = new PhysicsObject(LoadImage("bullet"));61 Add(bullet);62 bullet.Position = pelaaja.Position;63 Vector suunta = Vector.FromLengthAndAngle(ampumisnopeus, pelaaja.Angle + Angle.RightAngle);64 bullet.Hit(suunta);65 66 }67 59 void LuoPelaaja2(Vector paikka, double leveys, double korkeus) 68 60 { 69 61 70 62 PhysicsObject pelaaja2 = LuoPelaaja(paikka); 71 63 pelaaja2.Image = LoadImage("Pelaaja2"); 64 pelaaja2.CollisionIgnoreGroup = 2; 72 65 73 66 Keyboard.Listen(Key.Left, ButtonState.Down, Liike, null, pelaaja2, new Vector(-200, 0)); … … 79 72 Keyboard.Listen(Key.Up, ButtonState.Down, Liike, null, pelaaja2, new Vector(0, 200)); 80 73 Keyboard.Listen(Key.Up, ButtonState.Released, Liike, null, pelaaja2, new Vector(0, 0)); 74 Keyboard.Listen(Key.NumPad0, ButtonState.Down, Ammu, null, pelaaja2); 81 75 } 82 76 void LuoPelaaja3(Vector paikka, double leveys, double korkeus) … … 85 79 PhysicsObject pelaaja3 = LuoPelaaja(paikka); 86 80 pelaaja3.Image = LoadImage("Pelaaja3"); 81 pelaaja3.CollisionIgnoreGroup = 3; 87 82 88 83 Keyboard.Listen(Key.F, ButtonState.Down, Liike, null, pelaaja3, new Vector(-200, 0)); … … 94 89 Keyboard.Listen(Key.T, ButtonState.Down, Liike, null, pelaaja3, new Vector(0, 200)); 95 90 Keyboard.Listen(Key.T, ButtonState.Released, Liike, null, pelaaja3, new Vector(0, 0)); 91 Keyboard.Listen(Key.R, ButtonState.Down, Ammu, null, pelaaja3); 96 92 } 97 93 void LuoPelaaja4(Vector paikka, double leveys, double korkeus) … … 100 96 PhysicsObject pelaaja4 = LuoPelaaja(paikka); 101 97 pelaaja4.Image = LoadImage("Pelaaja4"); 98 pelaaja4.CollisionIgnoreGroup = 4; 102 99 103 100 Keyboard.Listen(Key.J, ButtonState.Down, Liike, null, pelaaja4, new Vector(-200, 0)); … … 109 106 Keyboard.Listen(Key.I, ButtonState.Down, Liike, null, pelaaja4, new Vector(0, 200)); 110 107 Keyboard.Listen(Key.I, ButtonState.Released, Liike, null, pelaaja4, new Vector(0, 0)); 108 Keyboard.Listen(Key.U, ButtonState.Down, Ammu, null, pelaaja4); 111 109 } 112 110 PhysicsObject LuoPelaaja(Vector paikka) 113 111 { 114 PhysicsObject Pelaaja = PhysicsObject.CreateStaticObject(16, 16); 112 PhysicsObject Pelaaja = new PhysicsObject(18, 18); 113 Pelaaja.Restitution = 0.01; 114 Pelaaja.AngularDamping = 0.1; 115 115 Pelaaja.Position = paikka; 116 116 Pelaaja.Shape = Shape.Circle; … … 119 119 120 120 } 121 void Ammu(PhysicsObject pelaaja) 122 { 123 PhysicsObject bullet = new PhysicsObject(LoadImage("bullet")); 124 Add(bullet); 125 // AddCollisionHandler(bullet, CollisionHandler.ExplodeObject(100, false)); 126 AddCollisionHandler(bullet, CollisionHandler.DestroyObject); 127 bullet.Position = pelaaja.Position; 128 bullet.Angle = pelaaja.Angle; 129 bullet.CollisionIgnoreGroup = pelaaja.CollisionIgnoreGroup; 130 Vector suunta = Vector.FromLengthAndAngle(ampumisnopeus, pelaaja.Angle + Angle.RightAngle); 131 bullet.Hit(suunta); 121 132 133 } 122 134 void Liike(PhysicsObject pelaaja, Vector nopeus) 123 135 { -
2012/23/JimB/NameInPending/NameinPending/NameinPending/NameinPendingContent/NameinPendingContent.contentproj
r2794 r2796 83 83 <Importer>TextureImporter</Importer> 84 84 <Processor>TextureProcessor</Processor> 85 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 85 86 </Compile> 86 87 </ItemGroup>
Note: See TracChangeset
for help on using the changeset viewer.