- Timestamp:
- 2010-06-09 11:59:55 (13 years ago)
- Location:
- 2010/23/elalylon/Ball Wars
- Files:
-
- 6 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/23/elalylon/Ball Wars/Content/Content.contentproj
r569 r610 47 47 </Compile> 48 48 </ItemGroup> 49 <ItemGroup> 50 <Compile Include="m16_levea.png"> 51 <Name>m16_levea</Name> 52 <Importer>TextureImporter</Importer> 53 <Processor>TextureProcessor</Processor> 54 </Compile> 55 </ItemGroup> 56 <ItemGroup> 57 <Compile Include="m16_levea2.png"> 58 <Name>m16_levea2</Name> 59 <Importer>TextureImporter</Importer> 60 <Processor>TextureProcessor</Processor> 61 </Compile> 62 </ItemGroup> 63 <ItemGroup> 64 <Compile Include="enemy.png"> 65 <Name>enemy</Name> 66 <Importer>TextureImporter</Importer> 67 <Processor>TextureProcessor</Processor> 68 </Compile> 69 </ItemGroup> 70 <ItemGroup> 71 <Compile Include="Glock 17.png"> 72 <Name>Glock 17</Name> 73 <Importer>TextureImporter</Importer> 74 <Processor>TextureProcessor</Processor> 75 </Compile> 76 </ItemGroup> 77 <ItemGroup> 78 <Compile Include="Glock 17_2.png"> 79 <Name>Glock 17_2</Name> 80 <Importer>TextureImporter</Importer> 81 <Processor>TextureProcessor</Processor> 82 </Compile> 83 </ItemGroup> 49 84 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 50 85 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2010/23/elalylon/Ball Wars/Peli.cs
r569 r610 10 10 { 11 11 const double nopeus = 200; 12 const double hyppyVoima = 4000; 12 const double hyppyVoima = 8000; 13 Vector enemyshootvector; 14 Vector tahtaa; 13 15 14 16 IntMeter pisteLaskuri; 15 17 ValueDisplay pisteNaytto; 16 18 ValueDisplay ammoNaytto; 17 19 PlatformCharacter pelaaja1; 20 PlatformCharacter vihollinen; 21 AssaultRifle m16; 22 AssaultRifle Glock; 18 23 19 24 protected override void Begin() … … 33 38 Add(pisteNaytto); // lisätään peliin 34 39 40 ammoNaytto = new ValueDisplay(); 41 ammoNaytto.Text = "Pisteitä: "; 42 ammoNaytto.X = Screen.RightSafe - 250; 43 ammoNaytto.Y = Screen.TopSafe - 50; 44 Add(ammoNaytto); 45 46 47 // Ajastin, jonka avulla ajastetaan vihollisen toiminta, 48 // mm. ampuminen säännöllisin väliajoin 49 Timer aly = new Timer(); 50 aly.Interval = 0.01; // 0.1 sekuntia 51 aly.Trigger += enemyshoot; 52 Add(aly); 53 aly.Start(); 54 35 55 // Zoomataan lähemmäksi 36 56 Camera.ZoomFactor = 2.0; … … 42 62 } 43 63 64 void enemyshoot(Timer t) 65 { 66 if (pelaaja1.Position.X < 0) 67 { 68 //Glock laitetaan toisin päin 69 } 70 enemyshootvector = pelaaja1.Position - vihollinen.Position; 71 vihollinen.Weapon.Angle = enemyshootvector.Angle; 72 Glock.Use(); 73 } 74 75 76 44 77 void luoKentta() 45 78 { 46 79 Level.CreateBorders(); 47 Level.Background.CreateGradient(Color.Bl ack, Color.Red);80 Level.Background.CreateGradient(Color.Blue, Color.Red); 48 81 Gravity = new Vector(0, -1000); 49 82 50 83 51 lisaaTaso(-200, - 350);52 lisaaTaso(0, - 200);53 84 lisaaTaso(-200, -400); 85 lisaaTaso(0, -300); 86 lisaaTaso(-450, -300); 54 87 55 88 lisaaPelaajat(); 89 LuoVihollinen(); 56 90 Camera.Follow(pelaaja1); 57 91 lisaaNappaimet(); … … 61 95 { 62 96 PhysicsObject taso = PhysicsObject.CreateStaticObject(100, 30); 63 taso.Color = Color.Gr een;97 taso.Color = Color.Gray; 64 98 taso.X = x; 65 99 taso.Y = y; … … 69 103 void lisaaPelaajat() 70 104 { 71 pelaaja1 = new PlatformCharacter( 40, 40);105 pelaaja1 = new PlatformCharacter(50, 50); 72 106 pelaaja1.Mass = 10.0; 73 107 pelaaja1.Image = LoadImage("Hero"); 74 108 pelaaja1.X = 0; 75 109 pelaaja1.Y = Level.Bottom + 120; 110 Add(pelaaja1); 76 111 77 Add(pelaaja1); 112 m16 = new AssaultRifle(100, 30); 113 m16.Ammo.Value = 60; 114 pelaaja1.Weapon = m16; 115 m16.Image = LoadImage("m16_levea"); 116 m16.TimeBetweenUse = new TimeSpan(1500000); 117 // TODO: Panokset lentämään suorempaan 78 118 } 119 void LuoVihollinen() 120 { 121 vihollinen = new PlatformCharacter(50, 50); 122 vihollinen.Mass = 10.0; 123 vihollinen.Image = LoadImage("enemy"); 124 vihollinen.X = 200; 125 vihollinen.Y = Level.Bottom + 120; 126 Add(vihollinen); 127 128 Glock = new AssaultRifle(100, 30); 129 Glock.Ammo.Value = 14; 130 pelaaja1.Weapon = m16; 131 Glock.Image = LoadImage("Glock 17"); 132 Glock.TimeBetweenUse = new TimeSpan(3000000); 133 vihollinen.Weapon = Glock; 134 // TODO: Saako vihollisen ampumia panoksia / omia panoksia häviämään jotenkin? (tuleeko niistä damagea pelaajalle?) 79 135 136 } 80 137 void lisaaNappaimet() 81 138 { … … 86 143 Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu oikealle", pelaaja1, nopeus); 87 144 Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Hyppää", pelaaja1, hyppyVoima); 145 Mouse.Listen(MouseButton.Left, ButtonState.Down, shoot, "ammu"); 146 Mouse.ListenMovement(0.1, tahtax_, null); 88 147 } 89 148 149 void tahtax_(AnalogState tila) 150 { 151 if (Mouse.PositionOnScreen.X < 0) 152 { 153 m16.Image = LoadImage("m16_levea"); 154 } 155 tahtaa = Mouse.PositionOnWorld - pelaaja1.Position; 156 pelaaja1.Weapon.Angle = tahtaa.Angle; 157 } 158 159 void shoot() 160 { 161 pelaaja1.Weapon.Use(); 162 } 90 163 91 164 void liikuta(PlatformCharacter hahmo, double nopeus)
Note: See TracChangeset
for help on using the changeset viewer.