Changeset 430


Ignore:
Timestamp:
2009-08-07 13:02:06 (14 years ago)
Author:
zhjiang
Message:
 
Location:
zhipeng_j/Avaruuspeli1
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • zhipeng_j/Avaruuspeli1/Content/Content.contentproj

    r337 r430  
    5555  </ItemGroup> 
    5656  <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> 
    5778    <Folder Include="NewFolder1\" /> 
    5879  </ItemGroup> 
  • zhipeng_j/Avaruuspeli1/Peli.cs

    r396 r430  
    2525        BattleObject pelaaja2; 
    2626        BattleObject pelaaja3; 
    27         PlasmaCannon ase; 
     27        PlasmaCannon sukellusVeneenAse; 
     28        PlasmaCannon laivanAse; 
     29        PlasmaCannon lentokoneenAse; 
    2830        PhysicsObject laiva; 
    2931 
     
    5153            hitpointNaytto.ValueColor = Color.LightGreen; 
    5254            hitpointNaytto.BackColor = Color.Red; 
    53             hitpointNaytto.Max = 1000; 
     55            hitpointNaytto.Max = 50; 
    5456            hitpointNaytto.Position = new Vector2D(Screen.RightSafe - 300, Screen.TopSafe - 170); 
    5557            Add(hitpointNaytto); 
     
    108110            if (pelaaja2.Y > 0) 
    109111            { 
    110                 pelaaja2.Push(new Vector2D(0, 1000000)); 
     112                pelaaja2.Push(new Vector2D(0,60000)); 
    111113            } 
    112114            else 
     
    134136 
    135137            // 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); 
    142144            pelaaja1.X = 0; 
    143145            pelaaja1.Y = -900; 
    144             kentta.Objects.Add(ase); 
     146            kentta.Objects.Add(sukellusVeneenAse); 
    145147        } 
    146148 
     
    162164 
    163165            // 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); 
    170172            pelaaja2.X = -400; 
    171173            pelaaja2.Y = 800; 
    172             kentta.Objects.Add(ase); 
     174            kentta.Objects.Add(lentokoneenAse); 
    173175 
    174176           
     
    180182            // Pelaaja 3 
    181183            Texture2D alus = Content.Load<Texture2D>("laiva"); 
    182             IShape ympara = Shapes.CreateCircle(30.0); 
     184            IShape ympara = Shapes.CreateCircle(100.0); 
    183185            pelaaja3 = new BattleObject(ympara , 10, (int) hitpointNaytto.Max); 
    184186            pelaaja3.Texture = alus; 
     
    194196 
    195197            // 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); 
    202204            pelaaja3.X = 0; 
    203205            pelaaja3.Y = 100; 
    204             kentta.Objects.Add(ase); 
     206            kentta.Objects.Add(laivanAse); 
    205207        } 
    206208        PhysicsObject luomeri(Level kentta) 
     
    222224            PhysicsObject pelaaja = e.Parameter0.ToPhysicsObject(); 
    223225            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); 
    233227            return false; 
    234228 
     
    252246            Controls.Listen(Keys.Up, ButtonPosition.Down, liikutapelaajaa, null, pelaaja1, new Vector2D(0, +10000)); 
    253247            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); 
    255249 
    256250            // 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); 
    262256 
    263257 
    264258            // 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); 
    270264 
    271265 
     
    282276        } 
    283277 
     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 
    284290        private Boolean UusiPeli(ControlEvent e) 
    285291        { 
     
    290296        private Boolean Ammu(ControlEvent e) 
    291297        { 
     298            ProjectileWeapon ase = e.Parameter0 as ProjectileWeapon; 
     299 
    292300            // luodaan ammus 
    293301            Projectile ammus = ase.Use(); 
     
    308316            PhysicsObject pelaaja = e.Parameter0.ToPhysicsObject(); 
    309317            pelaaja.Angle = pelaaja.Angle += e.Parameter1.ToAngle(); 
    310             ase.Angle = pelaaja.Angle; 
     318            sukellusVeneenAse.Angle = pelaaja.Angle; 
    311319            return false; 
    312320        } 
Note: See TracChangeset for help on using the changeset viewer.