- Timestamp:
- 2010-07-29 14:58:16 (13 years ago)
- Location:
- 2010/30/lesejuku/Somalia 1993
- Files:
-
- 5 added
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/30/lesejuku/Somalia 1993/Content/Content.contentproj
r1384 r1421 48 48 </ItemGroup> 49 49 <ItemGroup> 50 <Compile Include=" Black Hawk.png">51 <Name> Black Hawk</Name>50 <Compile Include="rajahdys.png"> 51 <Name>rajahdys</Name> 52 52 <Importer>TextureImporter</Importer> 53 <Processor>TextureProcessor</Processor> 53 54 </Compile> 54 55 </ItemGroup> 55 56 <ItemGroup> 56 <Compile Include="rajahdys.png"> 57 <Name>rajahdys</Name> 57 <Compile Include="tahtain.png"> 58 <Name>tahtain</Name> 59 <Importer>TextureImporter</Importer> 60 <Processor>TextureProcessor</Processor> 61 </Compile> 62 </ItemGroup> 63 <ItemGroup> 64 <Compile Include="Black Hawk2.png"> 65 <Name>Black Hawk2</Name> 66 <Importer>TextureImporter</Importer> 67 <Processor>TextureProcessor</Processor> 68 </Compile> 69 </ItemGroup> 70 <ItemGroup> 71 <Compile Include="Black Hawk1.png"> 72 <Name>Black Hawk1</Name> 58 73 <Importer>TextureImporter</Importer> 59 74 <Processor>TextureProcessor</Processor> -
2010/30/lesejuku/Somalia 1993/Peli.cs
r1384 r1421 7 7 public class Tasohyppely : PhysicsGame 8 8 { 9 Image[] oikealleLento = LoadImages("Black Hawk1", "Black Hawk2"); 10 Image[] vasemmalleLento; 11 12 //Image[] lentäminenVasemmalle = LoadImages("Black Hawk1", "Black Hawk2"); 13 //Image[] lentäminenOikealle; 14 15 9 16 PhysicsObject helikopteri; 10 double helikopterinNopeus;11 Image helikopterinKuva = LoadImage("Black Hawk");12 Image helikopterinKuva2;13 PhysicsObject pelaaja1;17 //double helikopterinNopeus; 18 //Image helikopterinKuva = LoadImage("Black Hawk1"); 19 //Image helikopterinKuva2; 20 //PhysicsObject pelaaja1; 14 21 AssaultRifle machinegun; 22 const double pallonNopeus = 500; 23 ExplosionSystem rajahdys; 24 25 Animation oikeaLiike; 26 Animation vasenLiike; 27 28 GameObject tahtain; 29 30 const int ruudunLeveys = 50; 31 const int ruudunKorkeus = 150; 15 32 16 33 protected override void Begin() 17 34 { 35 rajahdys = new ExplosionSystem(LoadImage("rajahdys"), 200); 36 Add(rajahdys); 37 18 38 LuoKentta(); 19 39 //pelaaja1 = new PhysicsObject(40, 40); 20 helikopterinKuva2 = Image.Mirror(LoadImage("Black Hawk"));40 //helikopterinKuva2 = Image.Mirror(LoadImage("Black Hawk1")); 21 41 //Add(pelaaja1); 22 42 … … 26 46 Keyboard.Listen(Key.S, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -100)); 27 47 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu"); 28 Keyboard.Listen(Key.Space, ButtonState.Down, machinegun.Use, "Ammu"); 29 Keyboard.Listen(Key.Q,ButtonState.Down,KallistaKopteria,null, 30 Keyboard.Listen(Key.E,ButtonState.Down,KallistaKopteria,null, 31 32 Gravity = new Vector( 0, -80.0 ); 48 Keyboard.Listen(Key.Space, ButtonState.Down, Ammu, "Ammu"); 49 Keyboard.Listen(Key.Right,ButtonState.Down, KallistaHelikopteria, null, (-2.0)); 50 Keyboard.Listen(Key.Left, ButtonState.Down, KallistaHelikopteria, null, (2.0)); 51 52 Gravity = new Vector(0.0 , -50.0); 53 54 LuoAnimaatio(); 55 } 56 57 58 59 void Ammu() 60 { 61 PhysicsObject ammus= machinegun.Shoot(); 62 if (ammus != null) 63 { 64 ammus.Width = 20; 65 ammus.Height = 1; 66 ammus.Color = Color.Black; 67 68 } 33 69 } 34 70 35 71 void LuoKentta() 36 { 37 helikopteri = new PhysicsObject(40.0, 40.0); 38 helikopteri.Shape = Shapes.Circle; 39 helikopteri.Mass =1.0; 40 helikopteri.Image = helikopterinKuva; 72 { 73 TileMap ruudut = TileMap.FromFile("kentta.txt"); 74 ruudut['='] = LuoMaasto; 75 ruudut['X'] = LuoAloitus; 76 ruudut['M'] = LuoVihollinen; 77 78 79 helikopteri = new PhysicsObject(150.0, 55.0); 80 helikopteri.Shape = Shapes.Rectangle; 81 helikopteri.Mass = 1.0; 82 //helikopteri.Image = helikopterinKuva; 41 83 helikopteri.Color = Color.Gray; 42 84 helikopteri.X = -200.0; 43 85 helikopteri.Y = 0.0; 44 helikopterinNopeus = 200;86 //helikopterinNopeus = 10; 45 87 helikopteri.LinearDamping = 1.0; 46 helikopteri. Size = new Vector(150, 55);88 helikopteri.CanRotate = false; 47 89 Add(helikopteri); 48 90 … … 51 93 Add(machinegun); 52 94 machinegun.Ammo.Value = int.MaxValue; 95 machinegun.IsVisible = false; 53 96 machinegun.BulletCollision = LuotiOsuu; 54 Level.CreateBorders(1.0, true); 97 machinegun.Angle = helikopteri.Angle; 98 helikopteri.Add(machinegun); 99 100 101 102 103 55 104 int pMaxMaara = 200; 56 105 106 Tahtain(); 107 57 108 ExplosionSystem rajahdys = new ExplosionSystem(LoadImage("rajahdys"), pMaxMaara); 58 double x = 0; 109 double x = 0; 59 110 double y = 0; 60 111 int pMaara = 50; 61 112 rajahdys.AddEffect(x, y, pMaara); 62 63 Level.BackgroundColor = Color.Blue; 64 Camera.ZoomToLevel(); 65 helikopteri.Restitution = 1.0; 113 114 115 Camera.Follow(helikopteri); 116 helikopteri.Restitution = 0.1; 117 helikopteri.AngularDamping = 0.95; 66 118 Level.BackgroundColor = Color.Black; 67 68 69 70 } 71 72 const double pallonNopeus = 500; 73 119 } 120 121 void LuotiOsuu(PhysicsObject ammus, PhysicsObject mihinOsuttiin) 122 { 123 if (mihinOsuttiin != helikopteri) 124 { 125 rajahdys.MinVelocity = 10; 126 rajahdys.MaxVelocity = 200; 127 rajahdys.MinScale = 0.01; 128 rajahdys.MinLifetime = 0.1; 129 rajahdys.MaxLifetime = 1.0; 130 rajahdys.MaxScale = 0.1; 131 rajahdys.AddEffect(ammus.X, ammus.Y, 80); 132 ammus.Destroy(); 133 } 134 } 135 136 137 protected override void Update(Time time) 138 { 139 if (helikopteri.Velocity.X < 0) 140 { 141 tahtain.Position = helikopteri.Position - Vector.FromLengthAndAngle(200, machinegun.Angle); 142 helikopteri.Angle = -Angle.Degrees(180); 143 //helikopteri.Image = Image.Flip(helikopterinKuva); 144 helikopteri.Animation = vasenLiike; 145 } 146 else 147 { 148 tahtain.Position = helikopteri.Position - Vector.FromLengthAndAngle(-200, machinegun.Angle); 149 helikopteri.Angle = Angle.Degrees(0); 150 //helikopteri.Image = helikopterinKuva; 151 helikopteri.Animation = oikeaLiike; 152 } 153 154 155 156 base.Update(time); 157 } 158 159 void LiikutaPelaajaa(Vector vektori) 160 { 161 helikopteri.Hit(vektori); 162 } 163 164 void LiikutaPelaajaa(AnalogState tatinTila) 165 { 166 Vector tatinAsento = tatinTila.StateVector; 167 } 168 169 void KallistaHelikopteria(double kaanto) 170 { 171 machinegun.Angle = Angle.Degrees(machinegun.Angle.Degree + kaanto); 172 } 173 174 PhysicsObject LuoMaasto() 175 { 176 PhysicsObject maasto = PhysicsObject.CreateStaticObject(50.0, 50.0); 177 maasto.Shape = Shapes.Rectangle; 178 maasto.Color = Color.Gray; 179 return maasto; 180 181 182 } 183 GameObject LuoAloitus() 184 { 185 GameObject Aloitus = new GameObject(20.0, 1.0); 186 return Aloitus; 187 } 188 PhysicsObject LuoVihollinen() 189 { 190 PhysicsObject Vihollinen = new PhysicsObject(2.0, 20.0); 191 return Vihollinen; 192 193 } 194 195 GameObject Tahtain() 196 { 197 tahtain = new GameObject(100, 100); 198 Add(tahtain); 199 tahtain.Image = LoadImage("tahtain"); 200 return tahtain; 201 202 } 203 void LuoAnimaatio() 204 { 205 //vasemmalleLento = Image.Mirror(oikealleLento); 206 vasemmalleLento = new Image[2]; 207 vasemmalleLento[0] = Image.Flip(oikealleLento[0]); 208 vasemmalleLento[1] = Image.Flip(oikealleLento[1]); 209 210 oikeaLiike = new Animation(oikealleLento); 211 vasenLiike = new Animation(vasemmalleLento); 212 213 oikeaLiike.FPS = 4; 214 vasenLiike.FPS = 4; 215 oikeaLiike.Start(); 216 vasenLiike.Start(); 217 } 74 218 75 protected override void Update( Time time )76 {77 if (helikopteri.Velocity.X < 0)78 helikopteri.Image = helikopterinKuva2;79 else80 helikopteri.Image = helikopterinKuva;81 base.Update( time );82 }83 84 void LiikutaPelaajaa( Vector vektori )85 {86 helikopteri.Hit(vektori);87 }88 89 void LiikutaPelaajaa(AnalogState tatinTila)90 {91 Vector tatinAsento = tatinTila.StateVector;92 }93 94 void KallistaHelikopteria(double kaanto);95 {helikopteri.Angle = Angle.degrees(helikopteri.Angle.Degree +kaanto);96 97 }98 219 99 220 -
2010/30/lesejuku/Somalia 1993/Somalia 1993.csproj
r1344 r1421 89 89 <Content Include="Game.ico" /> 90 90 <Content Include="GameThumbnail.png" /> 91 <Content Include="kentta.txt"> 92 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 93 </Content> 91 94 </ItemGroup> 92 95 <ItemGroup>
Note: See TracChangeset
for help on using the changeset viewer.