Changeset 3743
- Timestamp:
- 2012-07-25 14:44:48 (11 years ago)
- Location:
- 2012/30/JereK
- Files:
-
- 33 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/30/JereK/FysiikkaPeli4/FysiikkaPeli4/FysiikkaPeli4/FysiikkaPeli4.cs
r3717 r3743 27 27 public override void Begin() 28 28 { 29 ClearAll(); 30 29 31 pallo = new PhysicsObject(40, 40); 30 32 Add(pallo); … … 41 43 alkuValikko.ItemSelected += PainettiinValikonNappia; 42 44 43 44 45 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Lopeta peli"); 45 46 … … 52 53 Add(pelaaja2); 53 54 pelaaja2.Image = ukeli2; 54 pelaaja.Mass = 6;55 pelaaja2.Mass = 6;55 pelaaja.Mass = 5; 56 pelaaja2.Mass = 5; 56 57 57 58 PhysicsObject mali = PhysicsObject.CreateStaticObject(15.0, 200.0); … … 73 74 maali.Color = Color.Blue; 74 75 75 76 77 76 PhysicsObject mali2 = PhysicsObject.CreateStaticObject(15.0, 200.0); 78 77 mali2.Shape = Shape.Rectangle; … … 101 100 puolustaja2.Mass = 0.2; 102 101 103 104 102 LuoPisteLaskuri(); 105 106 103 107 104 FollowerBrain seuraajanAivot = new FollowerBrain(pelaaja2); … … 110 107 puolustaja.Brain = seuraajanAivot; 111 108 puolustaja2.Brain = seuraajanAivot2; 112 seuraajanAivot2.Speed = 20; 113 seuraajanAivot.Speed = 20; 114 115 109 seuraajanAivot2.Speed = 80; 110 seuraajanAivot.Speed = 80; 116 111 117 112 PhysicsObject maali2 = PhysicsObject.CreateStaticObject(20.0, 180.0); … … 128 123 AddCollisionHandler(pallo, "maali", PalloKeskelle); 129 124 130 Keyboard.Listen(Key.Left, ButtonState.Down, 131 LiikutaPelaajaa, null, new Vector(-1000, 0)); 132 Keyboard.Listen(Key.Right, ButtonState.Down, 133 LiikutaPelaajaa, null, new Vector(1000, 0)); 134 Keyboard.Listen(Key.Up, ButtonState.Down, 135 LiikutaPelaajaa, null, new Vector(0, 1000)); 136 Keyboard.Listen(Key.Down, ButtonState.Down, 137 LiikutaPelaajaa, null, new Vector(0, -1000)); 138 139 Keyboard.Listen(Key.A, ButtonState.Down, 140 LiikutaPelaaja2, null, new Vector(-1000, 0)); 141 Keyboard.Listen(Key.D, ButtonState.Down, 142 LiikutaPelaaja2, null, new Vector(1000, 0)); 143 Keyboard.Listen(Key.W, ButtonState.Down, 144 LiikutaPelaaja2, null, new Vector(0, 1000)); 145 Keyboard.Listen(Key.S, ButtonState.Down, 146 LiikutaPelaaja2, null, new Vector(0, -1000)); 147 148 149 150 Level.CreateBorders(false); 125 Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-900, 0)); 126 Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaa, null, new Vector(900, 0)); 127 Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 900)); 128 Keyboard.Listen(Key.Down, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -900)); 129 130 Keyboard.Listen(Key.A, ButtonState.Down, LiikutaPelaaja2, null, new Vector(-900, 0)); 131 Keyboard.Listen(Key.D, ButtonState.Down, LiikutaPelaaja2, null, new Vector(900, 0)); 132 Keyboard.Listen(Key.W, ButtonState.Down, LiikutaPelaaja2, null, new Vector(0, 900)); 133 Keyboard.Listen(Key.S, ButtonState.Down, LiikutaPelaaja2, null, new Vector(0, -900)); 134 Keyboard.Listen(Key.R, ButtonState.Pressed, Begin, null); 135 136 Level.CreateBorders(true); 137 138 PhysicsObject vasenYlakulma = PhysicsObject.CreateStaticObject(150, 150); 139 vasenYlakulma.Angle = Angle.FromDegrees(45); 140 vasenYlakulma.Position = new Vector(Level.Left, Level.Top); 141 Add(vasenYlakulma); 142 vasenYlakulma.Color = Color.Transparent; 143 144 PhysicsObject oikeaYlakulma = PhysicsObject.CreateStaticObject(150, 150); 145 oikeaYlakulma.Angle = Angle.FromDegrees(45); 146 oikeaYlakulma.Position = new Vector(Level.Right, Level.Top); 147 Add(oikeaYlakulma); 148 oikeaYlakulma.Color = Color.Transparent; 149 150 PhysicsObject alaYlakulma = PhysicsObject.CreateStaticObject(150, 150); 151 alaYlakulma.Angle = Angle.FromDegrees(45); 152 alaYlakulma.Position = new Vector(Level.Left, Level.Bottom); 153 Add(alaYlakulma); 154 alaYlakulma.Color = Color.Transparent; 155 156 PhysicsObject oikeaAlakulma = PhysicsObject.CreateStaticObject(150, 150); 157 oikeaAlakulma.Angle = Angle.FromDegrees(45); 158 oikeaAlakulma.Position = new Vector(Level.Right, Level.Bottom); 159 Add(oikeaAlakulma); 160 oikeaAlakulma.Color = Color.Transparent; 161 151 162 Level.Background.Image = taustakuva; 152 163 Camera.ZoomToLevel(); … … 154 165 pelaaja.CanRotate = false; 155 166 pelaaja2.CanRotate = false; 156 157 167 } 158 168 -
2012/30/JereK/ponfs/ponfs/ponfs/ponfs.cs
r3720 r3743 40 40 pallo.MomentOfInertia = Double.PositiveInfinity; 41 41 pallo.Color = Color.Gold; 42 pallo.Image = LoadImage("troll"); 42 43 Add(pallo); 44 pallo.CanRotate = false; 43 45 AddCollisionHandler(pallo, KasittelePallonTormays); 44 46 … … 77 79 maila.X = x; 78 80 maila.Y = y; 79 maila.Restitution = 1. 0;81 maila.Restitution = 1.2; 80 82 maila.KineticFriction = 0.0; 81 83 maila.Color = Color.Rose; … … 93 95 { 94 96 IntMeter laskuri = new IntMeter(0); 95 laskuri.MaxValue = 10;97 laskuri.MaxValue = 666; 96 98 97 99 Label naytto = new Label(); -
2012/30/JereK/ponfs/ponfs/ponfsContent/ponfsContent.contentproj
r3720 r3743 44 44 <Reference Include="TextFileContentExtension" /> 45 45 </ItemGroup> 46 <ItemGroup> 47 <Compile Include="troll.png"> 48 <Name>troll</Name> 49 <Importer>TextureImporter</Importer> 50 <Processor>TextureProcessor</Processor> 51 </Compile> 52 </ItemGroup> 46 53 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 47 54 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.