- Timestamp:
- 2010-06-18 13:41:25 (13 years ago)
- Location:
- 2010/24/danmarti/Vantaa 2001
- Files:
-
- 62 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
2010/24/danmarti/Vantaa 2001/BetaMap.txt
r942 r997 1 M 1 2 2 12 3 rr j mm 4 wwwwwwwwwwwwwwwwwww wwwwwwwwwwwwwwwwww 3 4 r m m m m m m m m m 5 m j 6 fffff tttttttttttttttttttttttttttttttttttttttttt 7 bwwwww tttttttttttttttttttttttttttttttttttttttttt 8 12 bwwwww tttttttttttttttttttttttttttttttttttttttttt 9 r ffffffff tttttttttttttttttttttttttttttttttttttttttt m m m m m m 10 bbwwwwwwww tttttttttttttttttttttttttttttttttttttttttt J r 11 fffffffffffffffffffffff m m m bbbwdwwwwww tttttttttttttttttttttttttttttttttttttttttt ttttttttttttttttttttttttt 12 wwwwwwwwwwwwwwwwwwwwwww j bbbbwdwwwwww ttttttttttttttt ttttttttttttt ttttttttttttttttttttttttt 13 wwwwwwwwwwwwwwwwwwwwwww fffffffffffffffffffffffffffff ttttttttttttttt ttttttttttttt ttttttttttttttttttttttttt 14 wwwwwwwwwwwwwwwwwwwwwww wwwwwwwwwwwwwwwwwwwwwwwwwwwww ttttttttttttttt ttttttttttttt ttttttttttttttttttttttttt 15 XXXXXXXXXXwwwwwwwwwwwwwwwwwwwwwww wwwwwwwwwwwwwwwwwwwwwwwwwwwww ttttttttttttttt ttttttttttttt ttttttttttttttttttttttttt M 16 xxxxxxxxxxwwwwwwwwwwwwwwwwwwwwwww wwwwwwwwwwwwwwwwwwwwwwwwwwwww ttttttttttttttt tttttttttttttxxxxttttttttttttttttttttttttt 17 wwwwwwwwwwwwwwwwwwwwwww wwwwwwwwwwwwwwwwwwwwwwwwwwwww ttttttttttttttt ttttttttttttt ttttttttttttttttttttttttt 18 wwwwwwwwwwwwwwwwwwwwwww wwwwwwwwwwwwwwwwwwwwwwwwwwwww ttttttttttttttt ttttttttttttt ttttttttttttttttttttttttt 19 wwwwwwwwwwwwwwwwwwwwwwwxxxwwwwwwwwww wwwwwwwwwxxxxttttttttttttttt ttttttttttttt ttttttttttttttttttttttttt M 20 wwwwwwwwwwwwwwwwwwwwwww wwwwwwwwww wwwwwwwww ttttttttttttttt ttttttttttttt ttttttttttttttttttttttttt 21 wwwwwwwwww wwwwwwwww ttttttttttttttt ttttttttttttt ttttttttttttttttttttttttt 22 wwwwwwwwww wwwwwwwww ttttttttttttttt ttttttttttttt ttttttttttttttttttttttttt 23 tttttttttt 24 tttttttttt 25 tttttttttt 26 tttttttttt 27 ttttttttttX 28 ttttttttttfffffffffffffffffffffffffffffffffffffffff 29 ttttttttttwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww 30 ttttttttttwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww 31 ttttttttttwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww 32 ttttttttttwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww -
2010/24/danmarti/Vantaa 2001/Content/Content.contentproj
r942 r997 35 35 </ItemGroup> 36 36 <ItemGroup> 37 <Compile Include="menubg.png"> 38 <Name>menubg</Name> 39 <Importer>TextureImporter</Importer> 40 <Processor>TextureProcessor</Processor> 41 </Compile> 42 </ItemGroup> 43 <ItemGroup> 44 <Compile Include="Plasmasound.wav"> 45 <Name>Plasmasound</Name> 46 <Importer>WavImporter</Importer> 47 <Processor>SoundEffectProcessor</Processor> 48 </Compile> 49 </ItemGroup> 50 <ItemGroup> 37 51 <Compile Include="Split In Synapse.mp3"> 38 52 <Name>Split In Synapse</Name> … … 40 54 <Processor>SongProcessor</Processor> 41 55 </Compile> 42 </ItemGroup> 43 <ItemGroup> 44 <Compile Include="menubg.png"> 45 <Name>menubg</Name> 56 <Compile Include="Wrap.mp3"> 57 <Name>Wrap</Name> 58 <Importer>Mp3Importer</Importer> 59 <Processor>SongProcessor</Processor> 60 </Compile> 61 </ItemGroup> 62 <ItemGroup> 63 <Compile Include="Carnival.mp3"> 64 <Name>Carnival</Name> 65 <Importer>Mp3Importer</Importer> 66 <Processor>SongProcessor</Processor> 67 </Compile> 68 </ItemGroup> 69 <ItemGroup> 70 <Compile Include="BG.png"> 71 <Name>BG</Name> 72 <Importer>TextureImporter</Importer> 73 <Processor>TextureProcessor</Processor> 74 </Compile> 75 </ItemGroup> 76 <ItemGroup> 77 <Compile Include="TitleScreen.png"> 78 <Name>TitleScreen</Name> 79 <Importer>TextureImporter</Importer> 80 <Processor>TextureProcessor</Processor> 81 </Compile> 82 </ItemGroup> 83 <ItemGroup> 84 <Compile Include="GameOver.png"> 85 <Name>GameOver</Name> 86 <Importer>TextureImporter</Importer> 87 <Processor>TextureProcessor</Processor> 88 </Compile> 89 </ItemGroup> 90 <ItemGroup> 91 <Compile Include="Player1.png"> 92 <Name>Player1</Name> 93 <Importer>TextureImporter</Importer> 94 <Processor>TextureProcessor</Processor> 95 </Compile> 96 </ItemGroup> 97 <ItemGroup> 98 <Compile Include="Player2.png"> 99 <Name>Player2</Name> 100 <Importer>TextureImporter</Importer> 101 <Processor>TextureProcessor</Processor> 102 </Compile> 103 </ItemGroup> 104 <ItemGroup> 105 <Compile Include="PlayerWalk1.png"> 106 <Name>PlayerWalk1</Name> 107 <Importer>TextureImporter</Importer> 108 <Processor>TextureProcessor</Processor> 109 </Compile> 110 <Compile Include="PlayerWalk2.png"> 111 <Name>PlayerWalk2</Name> 112 <Importer>TextureImporter</Importer> 113 <Processor>TextureProcessor</Processor> 114 </Compile> 115 </ItemGroup> 116 <ItemGroup> 117 <Compile Include="Player1temp.png"> 118 <Name>Player1temp</Name> 119 <Importer>TextureImporter</Importer> 120 <Processor>TextureProcessor</Processor> 121 </Compile> 122 </ItemGroup> 123 <ItemGroup> 124 <Compile Include="Player2temp.png"> 125 <Name>Player2temp</Name> 126 <Importer>TextureImporter</Importer> 127 <Processor>TextureProcessor</Processor> 128 </Compile> 129 </ItemGroup> 130 <ItemGroup> 131 <Compile Include="PlayerWalk21.png"> 132 <Name>PlayerWalk21</Name> 133 <Importer>TextureImporter</Importer> 134 <Processor>TextureProcessor</Processor> 135 </Compile> 136 <Compile Include="PlayerWalk22.png"> 137 <Name>PlayerWalk22</Name> 138 <Importer>TextureImporter</Importer> 139 <Processor>TextureProcessor</Processor> 140 </Compile> 141 </ItemGroup> 142 <ItemGroup> 143 <Compile Include="Box.png"> 144 <Name>Box</Name> 145 <Importer>TextureImporter</Importer> 146 <Processor>TextureProcessor</Processor> 147 </Compile> 148 <Compile Include="Ground.png"> 149 <Name>Ground</Name> 150 <Importer>TextureImporter</Importer> 151 <Processor>TextureProcessor</Processor> 152 </Compile> 153 <Compile Include="Metal.png"> 154 <Name>Metal</Name> 155 <Importer>TextureImporter</Importer> 156 <Processor>TextureProcessor</Processor> 157 </Compile> 158 <Compile Include="Roof.png"> 159 <Name>Roof</Name> 160 <Importer>TextureImporter</Importer> 161 <Processor>TextureProcessor</Processor> 162 </Compile> 163 <Compile Include="Wall.png"> 164 <Name>Wall</Name> 165 <Importer>TextureImporter</Importer> 166 <Processor>TextureProcessor</Processor> 167 </Compile> 168 </ItemGroup> 169 <ItemGroup> 170 <Compile Include="Melee.png"> 171 <Name>Melee</Name> 172 <Importer>TextureImporter</Importer> 173 <Processor>TextureProcessor</Processor> 174 </Compile> 175 </ItemGroup> 176 <ItemGroup> 177 <Compile Include="Shooter.png"> 178 <Name>Shooter</Name> 179 <Importer>TextureImporter</Importer> 180 <Processor>TextureProcessor</Processor> 181 </Compile> 182 </ItemGroup> 183 <ItemGroup> 184 <Compile Include="Door.png"> 185 <Name>Door</Name> 186 <Importer>TextureImporter</Importer> 187 <Processor>TextureProcessor</Processor> 188 </Compile> 189 </ItemGroup> 190 <ItemGroup> 191 <Compile Include="Flag.png"> 192 <Name>Flag</Name> 193 <Importer>TextureImporter</Importer> 194 <Processor>TextureProcessor</Processor> 195 </Compile> 196 </ItemGroup> 197 <ItemGroup> 198 <Compile Include="Laser.png"> 199 <Name>Laser</Name> 200 <Importer>TextureImporter</Importer> 201 <Processor>TextureProcessor</Processor> 202 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 203 </Compile> 204 <Compile Include="Plasma.png"> 205 <Name>Plasma</Name> 46 206 <Importer>TextureImporter</Importer> 47 207 <Processor>TextureProcessor</Processor> -
2010/24/danmarti/Vantaa 2001/Peli.cs
r940 r997 3 3 using Jypeli.ScreenObjects; 4 4 using Jypeli.Assets; 5 using Physics2DDotNet.Ignorers; 5 6 6 7 public class Peli : PhysicsGame … … 20 21 const int TileHeight = 50; 21 22 23 ObjectIgnorer PlayerIgnore = new ObjectIgnorer(); 24 ObjectIgnorer EnemyIgnore = new ObjectIgnorer(); 25 22 26 Vector RespawnCoord; 27 23 28 24 29 protected override void Begin() … … 32 37 33 38 MediaPlayer.Play("Split In Synapse"); 34 Image bg = LoadImage(" menubg");39 Image bg = LoadImage("TitleScreen"); 35 40 Level.Background.Image = bg; 36 41 Level.Background.Size = new Vector(Screen.Width, Screen.Height); … … 40 45 void StartGame() 41 46 { 42 Image bg = Image.CreateGradient((int)Screen.Width, (int)Screen.Height, Color.LightBlue, Color.Blue); 43 // Image bg = LoadImage("kuvannimi"); 47 ClearAll(); 48 MessageDisplay.TextColor = Color.White; 49 Image bg = LoadImage("BG"); 44 50 Level.Background.Image = bg; 45 Level.Background.Size = new Vector(Screen.Width , Screen.Height);51 Level.Background.Size = new Vector(Screen.Width+100, Screen.Height+100); 46 52 Level.Background.MovesWithCamera = false; 53 54 Camera.ZoomFactor = 1.5; 47 55 48 56 LifeP1 = new IntMeter(3); // Pelaajan 1 osumat … … 65 73 Gravity = new Vector(0, -1000); 66 74 CreateLevel(); 75 Player1.CollisionIgnorer = PlayerIgnore; 76 Player2.CollisionIgnorer = PlayerIgnore; 77 67 78 Add(LifeMeterP1); 68 79 Add(LifeMeterP2); 69 80 Camera.Follow(Player1); 70 81 Controls(); 71 } 72 73 74 75 PlatformCharacter CreatePlayer() 76 { 77 PlatformCharacter Player = new PlatformCharacter(40, 60); 82 MediaPlayer.Play("Wrap"); 83 84 85 } 86 87 PlatformCharacter CreatePlayer(int x) 88 { 89 PlatformCharacter Player = new PlatformCharacter(50, 125); 78 90 Player.Mass = 4.0; 79 91 Add(Player); … … 83 95 Player.LinearDamping = 1; 84 96 Player.Tag = "Player"; 97 Player.Image = LoadImage("Player" + x); 98 99 Image[] AniTextures = LoadImages( 100 "PlayerWalk" + x 101 102 ); 103 Animation WalkingAni = new Animation( AniTextures); 104 WalkingAni.FPS = 1; 105 106 Player.RightWalkingAnimation = WalkingAni; 107 Player.LeftWalkingAnimation = Animation.Mirror(WalkingAni); 108 Player.RightIdleAnimation = new Animation( LoadImage("Player"+x)); 109 Player.LeftIdleAnimation = new Animation(Image.Mirror(LoadImage("Player"+x))); 85 110 86 111 LaserGun Weapon = new LaserGun(20, 5); 87 Weapon. X =0;112 Weapon.Y = 10; 88 113 Weapon.LaserCollision = LaserCollide; 89 114 90 //Weapon.AttackSound = null;115 Weapon.AttackSound = null; 91 116 Weapon.IsVisible = false; 92 117 Weapon.TimeBetweenUse = new TimeSpan(0, 0, 0, 0, 250); … … 99 124 PlatformCharacter CreateMelee() 100 125 { 101 Melee Melee = new Melee( 40, 65, meleeWalkingSpeed);126 Melee Melee = new Melee(50, 100, meleeWalkingSpeed); 102 127 Melee.isAlive = true; 103 128 Melee.Mass = 3.0; … … 108 133 AddCollisionHandler(Melee, EnemyPlayerCollision); 109 134 Melee.CanRotate = false; 110 //Add(Melee);111 Melee. Tag = "Melee";135 Melee.CollisionIgnorer = EnemyIgnore; 136 Melee.Image = Image.Mirror(LoadImage("Melee")); 112 137 return Melee; 113 138 114 139 } 115 140 116 void CreateLevel() 117 { 118 TileMap Tiles = TileMap.FromFile("BetaMap.txt"); 119 Tiles['x'] = CreatePit; 120 Tiles['f'] = CreateFloor; 121 Tiles['w'] = CreateWall; 122 Tiles['j'] = CreateJump; 123 Tiles['r'] = CreateRespawn; 124 Tiles['m'] = CreateMelee; 125 Tiles['1'] = StartP1; 126 Tiles['2'] = StartP2; 127 Tiles.Insert(TileWidth, TileHeight); 128 } 129 130 141 PlatformCharacter CreateShooter() 142 { 143 144 PlatformCharacter Shooter = new PlatformCharacter(50, 100); 145 Shooter.Mass = 3.0; 146 Shooter.Color = Color.Red; 147 Shooter.KineticFriction = 0.1; 148 Shooter.StaticFriction = 0.1; 149 Shooter.Tag = "Shooter"; 150 AddCollisionHandler(Shooter, EnemyPlayerCollision); 151 Shooter.CanRotate = false; 152 Shooter.CollisionIgnorer = EnemyIgnore; 153 return Shooter; 154 } 155 156 PlatformCharacter CreateShooterRight() 157 { 158 PlatformCharacter ShooterRight = CreateShooter(); 159 ShooterRight.Add(CreateWeapon(0)); 160 Timer ShooterTimer = new Timer(); 161 ShooterTimer.Interval = 1; 162 ShooterTimer.Trigger += ShooterShoot; 163 Add(ShooterTimer); 164 ShooterRight.Image = LoadImage("Shooter"); 165 return ShooterRight; 166 } 167 168 PlatformCharacter CreateShooterLeft() 169 { 170 PlatformCharacter ShooterLeft=CreateShooter(); 171 172 LaserGun ase = CreateWeapon(180); 173 ShooterLeft.Add(ase); 174 //PhysicsObject Plasma = ShooterLeft.Weapon.Shoot(); 175 //Plasma.Image = LoadImage("Plasma"); 176 Timer ShooterTimer = new Timer(); 177 ShooterTimer.Interval = 2; 178 ShooterTimer.Trigger += ShooterShoot; 179 ShooterTimer.Tag = ase; 180 Add(ShooterTimer); 181 ShooterTimer.Start(); 182 ShooterLeft.Image = Image.Mirror(LoadImage("Shooter")); 183 return ShooterLeft; 184 } 185 186 LaserGun CreateWeapon(int WDir) 187 { 188 LaserGun SWeapon = new LaserGun(20, 5); 189 SWeapon.Angle = Angle.Degrees(WDir); 190 //SWeapon.Image = Image.Mirror(SWeapon.Image); 191 SWeapon.LaserCollision = EnemyLaserCollide; 192 SWeapon.IsVisible = false; 193 SWeapon.AttackSound = null; 194 return SWeapon; 195 } 196 197 void ShooterShoot(Timer Time) 198 { 199 ((Weapon)Time.Tag).Use(); 200 201 //PhysicsObject SProjectile = Enemy.Weapon.Shoot(); 202 //if (SProjectile != null) 203 // SProjectile.IgnoresCollisionResponse = true; 204 } 131 205 132 206 void Controls() … … 135 209 Keyboard.Listen(Key.D, ButtonState.Down, Walk, "Move right", Player1, Speed); 136 210 Keyboard.Listen(Key.W, ButtonState.Down, Jump, "Jump", Player1, JumpStr); 137 Keyboard.Listen(Key.LeftControl, ButtonState.Down, Ammu, "Ammu", Player1); 138 139 211 Keyboard.Listen(Key.LeftControl, ButtonState.Down, Ammu, "Ammu", Player1); // Tähän vielä yksi parametri, missä kulmassa ammus lähtee 212 140 213 Keyboard.Listen(Key.Left, ButtonState.Down, Walk, "Move left", Player2, -Speed); 141 214 Keyboard.Listen(Key.Right, ButtonState.Down, Walk, "Move right", Player2, Speed); 142 215 Keyboard.Listen(Key.Up, ButtonState.Down, Jump, "Jump", Player2, JumpStr); 143 216 Keyboard.Listen(Key.Space, ButtonState.Down, Ammu, "Ammu", Player2); 217 218 ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, Walk, null, Player1, -Speed); 219 ControllerOne.Listen(Button.DPadRight, ButtonState.Down, Walk, null, Player1, Speed); 220 ControllerOne.Listen(Button.B, ButtonState.Down, Jump, null, Player1, JumpStr); 221 ControllerOne.Listen(Button.A, ButtonState.Down, AmmuXbox, null, Player1, ControllerOne); 222 ControllerOne.Listen(Button.RightStick, ButtonState.Up, Tahtaa, null, Player1, ControllerOne); 223 224 ControllerTwo.Listen(Button.DPadLeft, ButtonState.Down, Walk, null, Player2, -Speed); 225 ControllerTwo.Listen(Button.DPadRight, ButtonState.Down, Walk, null, Player2, Speed); 226 ControllerTwo.Listen(Button.B, ButtonState.Down, Jump, null, Player2, JumpStr); 227 ControllerTwo.Listen(Button.A, ButtonState.Down, Ammu, null, Player2); 228 ControllerOne.Listen(Button.RightStick, ButtonState.Up, Tahtaa, null, Player2, ControllerTwo); 229 230 231 } 232 233 void Tahtaa(PlatformCharacter player, GamePad gamepad) 234 { 235 Vector tatinAsento = gamepad.RightThumbDirection; 236 //MessageDisplay.Add(tatinAsento.X.ToString() + ", " + tatinAsento.Y.ToString()); 237 // TODO: Aseen tähtäys tatin perusteella. 238 144 239 } 145 240 146 241 void Ammu(PlatformCharacter player) 147 242 { 148 PhysicsObject ammus = player.Weapon.Shoot(); 149 if(ammus != null) 150 ammus.IgnoresCollisionResponse = true; 151 } 243 PhysicsObject WProjectile = player.Weapon.Shoot(); 244 if (WProjectile != null) 245 { 246 WProjectile.IgnoresCollisionResponse = true; 247 WProjectile.Image = LoadImage("Laser"); 248 WProjectile.Size = new Vector(10, 10); 249 250 } 251 } 252 253 void AmmuXbox(PlatformCharacter player, GamePad gamepad) 254 { 255 PhysicsObject WProjectile = player.Weapon.Shoot(); 256 double tatinAsentoY = gamepad.RightThumbDirection.Y; 257 double yVoima = tatinAsentoY * 1000; 258 if (WProjectile != null) 259 { 260 //MessageDisplay.Add(WProjectile.Velocity.X + " , " + yVoima); 261 WProjectile.IgnoresCollisionResponse = true; 262 WProjectile.Velocity = new Vector(WProjectile.Velocity.X, yVoima); 263 264 } 265 266 } 267 152 268 153 269 void Walk(PlatformCharacter Character, double Speed) … … 161 277 } 162 278 279 #region CreateLevelObjects 280 void CreateLevel() 281 { 282 TileMap Tiles = TileMap.FromFile("BetaMap.txt"); 283 Tiles['x'] = CreatePit; 284 Tiles['X'] = CreateEnemyPit; 285 Tiles['f'] = CreateFloor; 286 Tiles['w'] = CreateWall; 287 Tiles['j'] = CreateJump; 288 Tiles['J'] = CreateSuperJump; 289 Tiles['r'] = CreateRespawn; 290 Tiles['m'] = CreateMelee; 291 Tiles['M'] = CreateMeleeSpawner; 292 Tiles['t'] = CreateMetal; 293 Tiles['d'] = CreateDoor; 294 Tiles['b'] = CreateBox; 295 Tiles['g'] = CreateGround; 296 Tiles['s'] = CreateShooterRight; 297 //Tiles['S'] = CreateShooterRightSpawner; 298 Tiles['l'] = CreateShooterLeft; 299 //Tiles['L'] = CreateShooterLeftSpawner; 300 Tiles['1'] = StartP1; 301 Tiles['2'] = StartP2; 302 Tiles.Insert(TileWidth, TileHeight); 303 } 304 305 void CreateMeleeAtMeleeSpawner(Timer t) 306 { 307 //MessageDisplay.Add("Luodaan uusi Melee spawnerista"); 308 Melee melee = (Melee)CreateMelee(); 309 melee.Position = ((PhysicsObject)t.Tag).Position; 310 Add(melee); 311 } 163 312 164 313 … … 166 315 { 167 316 PhysicsObject Floor = PhysicsObject.CreateStaticObject(TileWidth, TileHeight); 317 Floor.Image = LoadImage("Roof"); 168 318 return Floor; 169 319 } … … 172 322 { 173 323 PhysicsObject Wall = PhysicsObject.CreateStaticObject(TileWidth, TileHeight); 324 Wall.Image = LoadImage("Wall"); 174 325 return Wall; 326 } 327 328 PhysicsObject CreateMetal() 329 { 330 PhysicsObject Metal = PhysicsObject.CreateStaticObject(TileWidth, TileHeight); 331 Metal.Image = LoadImage("Metal"); 332 return Metal; 333 } 334 335 PhysicsObject CreateBox() 336 { 337 PhysicsObject Box = PhysicsObject.CreateStaticObject(TileWidth, TileHeight); 338 Box.Image = LoadImage("Box"); 339 return Box; 340 } 341 PhysicsObject CreateGround() 342 { 343 PhysicsObject Ground = PhysicsObject.CreateStaticObject(TileWidth, TileHeight); 344 Ground.Image = LoadImage("Ground"); 345 return Ground; 346 } 347 348 PhysicsObject CreateDoor() 349 { 350 PhysicsObject Door = PhysicsObject.CreateStaticObject(TileWidth, TileHeight); 351 Door.Image = LoadImage("Door"); 352 return Door; 175 353 } 176 354 … … 184 362 } 185 363 364 PhysicsObject CreateSuperJump() 365 { 366 PhysicsObject SuperJump = PhysicsObject.CreateStaticObject(TileWidth, TileHeight); 367 SuperJump.IgnoresCollisionResponse = true; 368 SuperJump.IsVisible = false; 369 AddCollisionHandler(SuperJump, SuperJumpCollide); 370 return SuperJump; 371 } 372 186 373 PhysicsObject CreateRespawn() 187 374 { 188 PhysicsObject Respawn = PhysicsObject.CreateStaticObject( 50.0, 100.0);375 PhysicsObject Respawn = PhysicsObject.CreateStaticObject(TileWidth, TileHeight); 189 376 Respawn.IgnoresCollisionResponse = true; 190 Respawn.IsVisible = false;377 Respawn.IsVisible = true; 191 378 AddCollisionHandler(Respawn, RespawnCollision); 379 Respawn.Image = LoadImage("Flag"); 192 380 return Respawn; 381 } 382 383 PhysicsObject CreateMeleeSpawner() 384 { 385 PhysicsObject MeleeSpawner = PhysicsObject.CreateStaticObject(50.0, 100.0); 386 MeleeSpawner.IgnoresCollisionResponse = true; 387 MeleeSpawner.IsVisible = true; 388 Timer MeleeSpawnTimer = new Timer(); 389 MeleeSpawnTimer.Tag = MeleeSpawner; 390 MeleeSpawnTimer.Interval = 2.5; 391 MeleeSpawnTimer.Trigger += CreateMeleeAtMeleeSpawner; 392 Add(MeleeSpawnTimer); 393 MeleeSpawnTimer.Start(); 394 return MeleeSpawner; 193 395 } 194 396 … … 202 404 } 203 405 406 PhysicsObject CreateEnemyPit() 407 { 408 PhysicsObject EnemyPit = PhysicsObject.CreateStaticObject(50.0, 50.0); 409 EnemyPit.IgnoresCollisionResponse = true; 410 EnemyPit.IsVisible = false; 411 AddCollisionHandler(EnemyPit, EnemyPitCollide); 412 return EnemyPit; 413 } 414 415 #endregion 416 417 #region Collisions 204 418 void EnemyPlayerCollision(PhysicsObject Melee, PhysicsObject Target) 205 419 { … … 220 434 //if ((Target != Player1) && (Target != Player2)) 221 435 222 if ( Target.Tag.ToString() == "Melee")436 if ((Target.Tag.ToString() == "Melee") || (Target.Tag.ToString() == "Shooter")) 223 437 { 224 438 WProjectile.Destroy(); // Tuhotaan ammus … … 233 447 } 234 448 449 void EnemyLaserCollide(PhysicsObject WProjectile, PhysicsObject Target) 450 { 451 if (Target.Tag.ToString() == "Player") 452 { 453 WProjectile.Destroy(); 454 Death((PlatformCharacter)Target); 455 } 456 } 457 235 458 void PitCollide(PhysicsObject Pit, PhysicsObject Target) 236 459 { … … 242 465 { 243 466 Death(Player2); 467 } 468 } 469 470 void EnemyPitCollide(PhysicsObject EnemyPit, PhysicsObject Target) 471 { 472 if (Target.Tag.ToString() == "Melee") 473 { 474 Target.Destroy(); 244 475 } 245 476 } … … 255 486 } 256 487 488 void SuperJumpCollide(PhysicsObject SuperJump, PhysicsObject Target) 489 { 490 if (Target.Tag.ToString() == "Melee") 491 { 492 //Target.Push(new Vector(0,4000)); 493 Target.Hit(new Vector(0, 8000)); 494 //((PlatformCharacter)Target).Jump(JumpStr); 495 } 496 } 497 498 void RespawnCollision(PhysicsObject RespawnLoc, PhysicsObject Player) 499 { 500 if ((Player == Player1) || (Player == Player2)) 501 { 502 RespawnCoord = RespawnLoc.Position; 503 } 504 } 505 506 #endregion 257 507 258 508 void Death(PlatformCharacter Player) … … 268 518 } 269 519 Player1.Destroy(); 520 Player1.Weapon.Destroy(); 270 521 LifeP1.Value--; 271 522 if (LifeP1.Value == 0) … … 288 539 if ((Player1.IsDestroyed()) && (Player2.IsDestroyed())) 289 540 { 541 if ((LifeP1 == 0) && (LifeP2 == 0)) 542 { 543 GameOver(); 544 545 } 290 546 RespawnPlayers(RespawnCoord.X, RespawnCoord.Y + 10); 291 547 Camera.Follow(Player1); … … 295 551 } 296 552 553 private void GameOver() 554 { 555 ClearAll(); 556 MediaPlayer.Play("Carnival"); 557 Image bg = LoadImage("GameOver"); 558 Level.Background.Image = bg; 559 Level.Background.Size = new Vector(Screen.Width, Screen.Height); 560 Keyboard.Listen(Key.Enter, ButtonState.Pressed, StartGame, null); 561 562 } 563 564 297 565 void EnemyDeath(PhysicsObject Enemy) 298 566 { … … 306 574 if (LifeP1 > 0) 307 575 { 308 Player1 = CreatePlayer( );576 Player1 = CreatePlayer(1); 309 577 Player1.X = x + 30; 310 578 Player1.Y = y; … … 313 581 if (LifeP2 > 0) 314 582 { 315 Player2 = CreatePlayer( );583 Player2 = CreatePlayer(2); 316 584 Player2.X = x - 30; 317 585 Player2.Y = y; … … 329 597 } 330 598 331 void RespawnCollision(PhysicsObject RespawnLoc, PhysicsObject Player)332 {333 if ((Player == Player1) || (Player == Player2))334 {335 RespawnCoord = RespawnLoc.Position;336 }337 }338 339 599 PhysicsObject StartP1() 340 600 { 341 Player1 = CreatePlayer( );601 Player1 = CreatePlayer(1); 342 602 return Player1; 343 603 } … … 345 605 PhysicsObject StartP2() 346 606 { 347 Player2 = CreatePlayer( );607 Player2 = CreatePlayer(2); 348 608 return Player2; 349 609 } -
2010/24/danmarti/Vantaa 2001/Vantaa 2001.csproj
r942 r997 57 57 </PropertyGroup> 58 58 <ItemGroup> 59 <Reference Include="Jypeli2, Version= 1.0.0.0, Culture=neutral, processorArchitecture=x86">59 <Reference Include="Jypeli2, Version=2.1.9.0, Culture=neutral, processorArchitecture=x86"> 60 60 <SpecificVersion>False</SpecificVersion> 61 <HintPath>..\..\lib\ Jypeli2.dll</HintPath>61 <HintPath>..\..\lib\lib\Jypeli2.dll</HintPath> 62 62 </Reference> 63 63 <Reference Include="Microsoft.Xna.Framework, Version=3.1.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d" />
Note: See TracChangeset
for help on using the changeset viewer.