Changeset 5138
- Timestamp:
- 2014-06-27 10:52:16 (9 years ago)
- Location:
- 2014/26/OttoK
- Files:
-
- 3 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
2014/26/OttoK/Jump/Jump/Jump/Jump.cs
r5118 r5138 15 15 public IntMeter KranaattiLaskuri { get { return kranaattiLaskuri; } } 16 16 17 private IntMeter nopeus = new IntMeter(200); 18 public IntMeter Nopeus { get { return nopeus; } } 19 20 public bool onkoautossa = false; 21 17 22 public Norsu(double leveys, double korkeus) 18 23 : base(leveys, korkeus) … … 21 26 Weapon.Ammo.Value = 10000; 22 27 Weapon.InfiniteAmmo = true; 28 Tag = "norsu"; 23 29 } 24 30 } … … 39 45 Image pelaajanKuva = LoadImage("norsu"); 40 46 Image tahtiKuva = LoadImage("tahti"); 47 Image autonKuva = LoadImage("auto"); 41 48 42 49 SoundEffect maaliAani = LoadSoundEffect("maali"); … … 50 57 LuoPistelaskuri(pelaaja1); 51 58 LuoPistelaskuri(pelaaja2); 59 52 60 53 61 Camera.Follow(pelaaja1, pelaaja2); … … 69 77 kentta.SetTileMethod('N', LisaaPelaaja); 70 78 kentta.SetTileMethod('C', LisaaPelaaja2); 79 kentta.SetTileMethod('F', LuoAuto); 71 80 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 72 81 Level.CreateBorders(); … … 121 130 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 122 131 123 Keyboard.Listen(Key.Left, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, - nopeus);124 Keyboard.Listen(Key.Right, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, nopeus);132 Keyboard.Listen(Key.Left, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, -1.0); 133 Keyboard.Listen(Key.Right, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja1, 1.0); 125 134 Keyboard.Listen(Key.Up, ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 126 135 Keyboard.Listen(Key.NumPad2, ButtonState.Pressed , HeitaKranaatti, "Heitä Kranaatti", pelaaja1); 127 136 Keyboard.Listen(Key.NumPad1, ButtonState.Down, AmmuAseella, "Ammu", pelaaja1); 128 129 Keyboard.Listen(Key.A, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja2, -nopeus); 130 Keyboard.Listen(Key.D, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja2, nopeus); 137 Keyboard.Listen(Key.NumPad3, ButtonState.Pressed, OtaAuto, "Nouse auton kyytiin", pelaaja1); 138 139 Keyboard.Listen(Key.A, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja2, -1.0); 140 Keyboard.Listen(Key.D, ButtonState.Down, Liikuta, "Liikkuu vasemmalle", pelaaja2, 1.0); 131 141 Keyboard.Listen(Key.W,ButtonState.Pressed, Hyppaa, "Pelaaja hyppää", pelaaja2, hyppyNopeus); 132 142 Keyboard.Listen(Key.F, ButtonState.Pressed, HeitaKranaatti, "Heitä Kranaatti", pelaaja2); 133 143 Keyboard.Listen(Key.G, ButtonState.Down, AmmuAseella, "Ammu", pelaaja2); 144 Keyboard.Listen(Key.H, ButtonState.Pressed, OtaAuto, "Nouse auton kyytiin", pelaaja2); 134 145 135 146 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); … … 143 154 } 144 155 145 156 void UlosAuto(Norsu pelaaja) 157 { 158 pelaaja.Image = pelaajanKuva; 159 pelaaja.Width = RUUDUN_KOKO; 160 pelaaja.Height = RUUDUN_KOKO; 161 pelaaja.Mass = 4.0; 162 pelaaja.Nopeus.Value = 200; 163 pelaaja.onkoautossa = false; 164 } 165 166 void OtaAuto(Norsu pelaaja) 167 { 168 if (pelaaja.onkoautossa) 169 { 170 UlosAuto(pelaaja); 171 LuoAuto(pelaaja.Position, RUUDUN_KOKO, RUUDUN_KOKO); 172 } 173 else 174 { 175 foreach (PhysicsObject auto in GetObjectsWithTag("Auto")) 176 { 177 if (Vector.Distance(auto.Position, pelaaja.Position) < 100) 178 { 179 pelaaja.Image = auto.Image; 180 pelaaja.Width = auto.Width; 181 pelaaja.Height = auto.Height; 182 pelaaja.Position = auto.Position; 183 //pelaaja.Mass = auto.Mass; 184 pelaaja.Nopeus.Value = 300; 185 pelaaja.onkoautossa = true; 186 auto.Destroy(); 187 return; 188 } 189 } 190 } 191 } 146 192 147 193 void HeitaKranaatti(Norsu pelaaja) … … 153 199 pelaaja.KranaattiLaskuri.Value--; 154 200 // kranu.Mass = 1000.0; 155 } 201 kranu.Explosion.AddShockwaveHandler("Auto", KranaattiOsui); 202 kranu.Explosion.AddShockwaveHandler("norsu", KranaattiOsui); 203 204 } 205 } 206 207 void KranaattiOsui(IPhysicsObject rajahdyksenKohde, Vector v) 208 { 209 if (rajahdyksenKohde.Tag == "norsu") 210 { 211 UlosAuto(rajahdyksenKohde as Norsu); 212 } 213 else 214 { 215 rajahdyksenKohde.Destroy(); 216 } 217 218 Explosion rajahdys = new Explosion(500); 219 rajahdys.Position = rajahdyksenKohde.Position; 220 Add(rajahdys); 156 221 } 157 222 … … 163 228 164 229 { 165 ammus.Mass = 99999999999;230 ammus.Mass = 10; 166 231 //ammus.Size *= 167 232 //ammus.Image = ... … … 177 242 178 243 179 void Liikuta(PlatformCharacter hahmo, double nopeus) 180 { 181 hahmo.Walk(nopeus); 182 } 183 184 void Hyppaa(PlatformCharacter hahmo, double nopeus) 185 { 186 hahmo.Jump(nopeus); 244 void Liikuta(Norsu hahmo, double suunta) 245 { 246 hahmo.Walk(hahmo.Nopeus.Value * suunta); 247 } 248 249 void Hyppaa(Norsu hahmo, double nopeus) 250 { 251 if (!hahmo.onkoautossa) 252 { 253 hahmo.Jump(nopeus); 254 } 187 255 } 188 256 … … 221 289 ajastin.Timeout += delegate 222 290 { 223 pisteNaytto.Position = Camera.WorldToScreen(pelaaja.Position + new Vector(0, 30));224 kranaattiNaytto.Position = Camera.WorldToScreen(pelaaja.Position + new Vector(0, 50));291 pisteNaytto.Position = Camera.WorldToScreen(pelaaja.Position) + new Vector(0, 40); 292 kranaattiNaytto.Position = Camera.WorldToScreen(pelaaja.Position) + new Vector(0, 65); 225 293 }; 226 294 ajastin.Start(); … … 228 296 } 229 297 298 void LuoAuto(Vector paikka, double leveys, double korkeus) 299 { 300 PhysicsObject Auto = new PhysicsObject(leveys*4, korkeus*2); 301 //PhysicsObject Auto = PhysicsObject.CreateStaticObject(leveys * 4, korkeus * 2); 302 //Auto.Shape = Shape.FromImage(autonKuva); 303 Auto.Position = paikka; 304 Auto.Color = Color.Green; 305 Auto.Tag = "Auto"; 306 Auto.Mass = 1000; 307 Auto.LinearDamping = 0.7; 308 Auto.AngularDamping = 0.5; 309 Auto.Image = autonKuva; 310 Add(Auto); 311 } 312 230 313 231 314 } -
2014/26/OttoK/Jump/Jump/Jump/Jump.csproj.Debug.cachefile
r5107 r5138 3 3 Content\tahti.xnb 4 4 Content\kentta1.xnb 5 Content\auto.xnb -
2014/26/OttoK/Jump/Jump/Jump/obj/x86/Debug/ContentPipeline-{63B38ACA-3B70-45B9-9BE0-E245FDD44385}.xml
r5118 r5138 36 36 <Options>None</Options> 37 37 <Output>C:\MyTemp\OttoK\Jump\Jump\Jump\bin\x86\Debug\Content\kentta1.xnb</Output> 38 <Time>2014-06-26T13:37:45.3701107+03:00</Time> 38 <Time>2014-06-27T10:43:26.7849264+03:00</Time> 39 </Item> 40 <Item> 41 <Source>auto.png</Source> 42 <Name>auto</Name> 43 <Importer>TextureImporter</Importer> 44 <Processor>TextureProcessor</Processor> 45 <Options>None</Options> 46 <Output>C:\MyTemp\OttoK\Jump\Jump\Jump\bin\x86\Debug\Content\auto.xnb</Output> 47 <Time>2014-06-27T09:48:36.0008809+03:00</Time> 39 48 </Item> 40 49 <BuildSuccessful>true</BuildSuccessful> -
2014/26/OttoK/Jump/Jump/Jump/obj/x86/Debug/Jump.csproj.FileListAbsolute.txt
r5107 r5138 11 11 C:\MyTemp\OttoK\Jump\Jump\Jump\obj\x86\Debug\Jump.exe 12 12 C:\MyTemp\OttoK\Jump\Jump\Jump\obj\x86\Debug\Jump.pdb 13 C:\MyTemp\OttoK\Jump\Jump\Jump\bin\x86\Debug\Content\auto.xnb -
2014/26/OttoK/Jump/Jump/Jump/obj/x86/Debug/cachefile-{63B38ACA-3B70-45B9-9BE0-E245FDD44385}-targetpath.txt
r5107 r5138 3 3 Content\tahti.xnb 4 4 Content\kentta1.xnb 5 Content\auto.xnb -
2014/26/OttoK/Jump/Jump/JumpContent/JumpContent.contentproj
r5107 r5138 67 67 </Compile> 68 68 </ItemGroup> 69 <ItemGroup> 70 <Compile Include="auto.png"> 71 <Name>auto</Name> 72 <Importer>TextureImporter</Importer> 73 <Processor>TextureProcessor</Processor> 74 </Compile> 75 </ItemGroup> 69 76 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 70 77 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2014/26/OttoK/Jump/Jump/JumpContent/kentta1.txt
r5118 r5138 11 11 12 12 13 14 *13 F 14 * 15 15 ####################### 16 16 * * * * * * # … … 30 30 # * # # # ######## * ## 31 31 # #################### # * ### 32 # 32 # F ## 33 33 #### * 34 34 ##################3 # 35 ######## ### #* ##36 * # ## ######################37 #### ##### ###38 C N * #35 ######## ### * ## 36 * # ## ##################### 37 #### ##### F # # 38 C N * 39 39 ###################################################### 40 *************************************************** *#41 ****************************************************# 42 ****************************************************# 43 ##################################################### 40 *************************************************** ## 41 ****************************************************# F F F F 42 ****************************************************# 43 ###################################################################################################################################################
Note: See TracChangeset
for help on using the changeset viewer.