Changeset 430
- Timestamp:
- 2009-08-07 13:02:06 (14 years ago)
- Location:
- zhipeng_j/Avaruuspeli1
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
zhipeng_j/Avaruuspeli1/Content/Content.contentproj
r337 r430 55 55 </ItemGroup> 56 56 <ItemGroup> 57 <Compile Include="ohjus1.png"> 58 <Name>ohjus1</Name> 59 <Importer>TextureImporter</Importer> 60 <Processor>TextureProcessor</Processor> 61 </Compile> 62 </ItemGroup> 63 <ItemGroup> 64 <Compile Include="ohjus2.png"> 65 <Name>ohjus2</Name> 66 <Importer>TextureImporter</Importer> 67 <Processor>TextureProcessor</Processor> 68 </Compile> 69 </ItemGroup> 70 <ItemGroup> 71 <Compile Include="ohjus3.png"> 72 <Name>ohjus3</Name> 73 <Importer>TextureImporter</Importer> 74 <Processor>TextureProcessor</Processor> 75 </Compile> 76 </ItemGroup> 77 <ItemGroup> 57 78 <Folder Include="NewFolder1\" /> 58 79 </ItemGroup> -
zhipeng_j/Avaruuspeli1/Peli.cs
r396 r430 25 25 BattleObject pelaaja2; 26 26 BattleObject pelaaja3; 27 PlasmaCannon ase; 27 PlasmaCannon sukellusVeneenAse; 28 PlasmaCannon laivanAse; 29 PlasmaCannon lentokoneenAse; 28 30 PhysicsObject laiva; 29 31 … … 51 53 hitpointNaytto.ValueColor = Color.LightGreen; 52 54 hitpointNaytto.BackColor = Color.Red; 53 hitpointNaytto.Max = 1000;55 hitpointNaytto.Max = 50; 54 56 hitpointNaytto.Position = new Vector2D(Screen.RightSafe - 300, Screen.TopSafe - 170); 55 57 Add(hitpointNaytto); … … 108 110 if (pelaaja2.Y > 0) 109 111 { 110 pelaaja2.Push(new Vector2D(0, 1000000));112 pelaaja2.Push(new Vector2D(0,60000)); 111 113 } 112 114 else … … 134 136 135 137 // luodaan ase 136 ase = new PlasmaCannon(new PlasmaParticle());137 ase.SetOwner(pelaaja1, kentta);138 ase.Visible = true;139 ase.Color = Color.SteelBlue;140 ase.FireRate = 1000;141 ase.Power = new Meter<double>(5000, 5000, 5000);138 sukellusVeneenAse = new PlasmaCannon(new PlasmaParticle()); 139 sukellusVeneenAse.SetOwner(pelaaja1, kentta); 140 sukellusVeneenAse.Visible = true; 141 sukellusVeneenAse.Color = Color.SteelBlue; 142 sukellusVeneenAse.FireRate = 1000; 143 sukellusVeneenAse.Power = new Meter<double>(5000, 5000, 5000); 142 144 pelaaja1.X = 0; 143 145 pelaaja1.Y = -900; 144 kentta.Objects.Add( ase);146 kentta.Objects.Add(sukellusVeneenAse); 145 147 } 146 148 … … 162 164 163 165 // luodaan ase 164 ase = new PlasmaCannon(new PlasmaParticle());165 ase.SetOwner(pelaaja2, kentta);166 ase.Visible = true;167 ase.Color = Color.SteelBlue;168 ase.FireRate = 1000;169 ase.Power = new Meter<double>(5000, 5000, 5000);166 lentokoneenAse = new PlasmaCannon(new PlasmaParticle()); 167 lentokoneenAse.SetOwner(pelaaja2, kentta); 168 lentokoneenAse.Visible = true; 169 lentokoneenAse.Color = Color.SteelBlue; 170 lentokoneenAse.FireRate = 1000; 171 lentokoneenAse.Power = new Meter<double>(5000, 5000, 5000); 170 172 pelaaja2.X = -400; 171 173 pelaaja2.Y = 800; 172 kentta.Objects.Add( ase);174 kentta.Objects.Add(lentokoneenAse); 173 175 174 176 … … 180 182 // Pelaaja 3 181 183 Texture2D alus = Content.Load<Texture2D>("laiva"); 182 IShape ympara = Shapes.CreateCircle( 30.0);184 IShape ympara = Shapes.CreateCircle(100.0); 183 185 pelaaja3 = new BattleObject(ympara , 10, (int) hitpointNaytto.Max); 184 186 pelaaja3.Texture = alus; … … 194 196 195 197 // luodaan ase 196 ase = new PlasmaCannon(new PlasmaParticle());197 ase.SetOwner(pelaaja3, kentta);198 ase.Visible = true;199 ase.Color = Color.SteelBlue;200 ase.FireRate = 1000;201 ase.Power = new Meter<double>(5000, 5000, 5000);198 laivanAse = new PlasmaCannon(new PlasmaParticle()); 199 laivanAse.SetOwner(pelaaja3, kentta); 200 laivanAse.Visible = true; 201 laivanAse.Color = Color.SteelBlue; 202 laivanAse.FireRate = 1000; 203 laivanAse.Power = new Meter<double>(5000, 5000, 5000); 202 204 pelaaja3.X = 0; 203 205 pelaaja3.Y = 100; 204 kentta.Objects.Add( ase);206 kentta.Objects.Add(laivanAse); 205 207 } 206 208 PhysicsObject luomeri(Level kentta) … … 222 224 PhysicsObject pelaaja = e.Parameter0.ToPhysicsObject(); 223 225 Vector2D suunta = e.Parameter1.ToVector2D(); 224 if (pelaaja.Position.Y < 0) 225 { 226 pelaaja.Velocity = Vector2D.Zero; 227 pelaaja.Push(new Vector2D(0, -15000)); 228 } 229 else 230 { 231 pelaaja.Push(suunta); 232 } 226 pelaaja.Push(suunta); 233 227 return false; 234 228 … … 252 246 Controls.Listen(Keys.Up, ButtonPosition.Down, liikutapelaajaa, null, pelaaja1, new Vector2D(0, +10000)); 253 247 Controls.Listen(Keys.Down, ButtonPosition.Down, liikutapelaajaa, null, pelaaja1, new Vector2D(0, -10000)); 254 Controls.Listen(Keys.Space, ButtonPosition.Down, Ammu );248 Controls.Listen(Keys.Space, ButtonPosition.Down, Ammu, null, sukellusVeneenAse); 255 249 256 250 // Pelaajan 2 näppäimet 257 Controls.Listen( Buttons .DPadLeft , ButtonPosition.Down, liikutapelaajaa, null, pelaaja2, new Vector2D(-10, 0));258 Controls.Listen( Buttons.DPadRight, ButtonPosition.Down, liikutapelaajaa, null, pelaaja2, new Vector2D(10, 0));259 Controls.Listen( Buttons .DPadUp, ButtonPosition.Down, liikutapelaajaa, null, pelaaja2, new Vector2D(0, +10000));260 Controls.Listen( Buttons.DPadDown, ButtonPosition.Down, liikutapelaajaa, null, pelaaja2, new Vector2D(0, -10000));261 Controls.Listen( Buttons.A, ButtonPosition.Down, Ammu);251 Controls.Listen(PlayerIndex.One, Buttons .DPadLeft , ButtonPosition.Down, liikutapelaajaa, null, pelaaja2, new Vector2D(-10000, 0)); 252 Controls.Listen(PlayerIndex.One, Buttons.DPadRight, ButtonPosition.Down, liikutapelaajaa, null, pelaaja2, new Vector2D(10000, 0)); 253 Controls.Listen(PlayerIndex.One, Buttons.DPadUp, ButtonPosition.Down, liikutapelaajaa, null, pelaaja2, new Vector2D(0, +10000)); 254 Controls.Listen(PlayerIndex.One, Buttons.DPadDown, ButtonPosition.Down, liikutapelaajaa, null, pelaaja2, new Vector2D(0, -10000)); 255 Controls.Listen(PlayerIndex.One, Buttons.A, ButtonPosition.Down, lentokoneAmpuu, null, lentokoneenAse); 262 256 263 257 264 258 // Pelaajan 3 näppäimet 265 Controls.Listen( Buttons.DPadLeft, ButtonPosition.Down, liikutapelaajaa, null, pelaaja3, new Vector2D(-10, 0));266 Controls.Listen( Buttons.DPadRight, ButtonPosition.Down, liikutapelaajaa, null, pelaaja3, new Vector2D(10, 0));267 Controls.Listen( Buttons.DPadUp, ButtonPosition.Down, liikutapelaajaa, null, pelaaja3, new Vector2D(0, +10000));268 Controls.Listen( Buttons.DPadDown, ButtonPosition.Down, liikutapelaajaa, null, pelaaja3, new Vector2D(0, -10000));269 Controls.Listen( Buttons.A, ButtonPosition.Down, Ammu);259 Controls.Listen(PlayerIndex.Two, Buttons.DPadLeft, ButtonPosition.Down, liikutapelaajaa, null, pelaaja3, new Vector2D(-10000, 0)); 260 Controls.Listen(PlayerIndex.Two, Buttons.DPadRight, ButtonPosition.Down, liikutapelaajaa, null, pelaaja3, new Vector2D(100000, 0)); 261 Controls.Listen(PlayerIndex.Two, Buttons.DPadUp, ButtonPosition.Down, liikutapelaajaa, null, pelaaja3, new Vector2D(0, +10000)); 262 Controls.Listen(PlayerIndex.Two, Buttons.DPadDown, ButtonPosition.Down, liikutapelaajaa, null, pelaaja3, new Vector2D(0, -10000)); 263 Controls.Listen(PlayerIndex.Two, Buttons.A, ButtonPosition.Down, Ammu, null, laivanAse); 270 264 271 265 … … 282 276 } 283 277 278 bool lentokoneAmpuu(ControlEvent e) 279 { 280 PhysicsObject lentokone = e.Parameter0.ToPhysicsObject(); 281 CannonBall ohjus = new CannonBall(20, 20); 282 ohjus.Texture = Content.Load<Texture2D>("ohjus1"); 283 ohjus.X = lentokone.X + lentokone.Size.X * 8 ; 284 ohjus.Y = lentokone.Y; 285 ohjus.Hit(new Vector2D(1000, 0)); 286 Level.Objects.Add(ohjus); 287 return false; 288 } 289 284 290 private Boolean UusiPeli(ControlEvent e) 285 291 { … … 290 296 private Boolean Ammu(ControlEvent e) 291 297 { 298 ProjectileWeapon ase = e.Parameter0 as ProjectileWeapon; 299 292 300 // luodaan ammus 293 301 Projectile ammus = ase.Use(); … … 308 316 PhysicsObject pelaaja = e.Parameter0.ToPhysicsObject(); 309 317 pelaaja.Angle = pelaaja.Angle += e.Parameter1.ToAngle(); 310 ase.Angle = pelaaja.Angle;318 sukellusVeneenAse.Angle = pelaaja.Angle; 311 319 return false; 312 320 }
Note: See TracChangeset
for help on using the changeset viewer.