Time for action – shots colliding with tiles
Add the
checkShotWallImpacts()
method to the WeaponManager class:#region Collision Detection private static void checkShotWallImpacts(Sprite shot) { if (shot.Expired) { return; } if (TileMap.IsWallTile( TileMap.GetSquareAtPixel(shot.WorldCenter))) { shot.Expired = true; if (shot.Frame == 0) { EffectsManager.AddSparksEffect( shot.WorldCenter, shot.Velocity); } else { createLargeExplosion(shot.WorldCenter); } } } #endregion
Add the
createLargeExplosion()
method to the Effects Management Methods region of the WeaponManager class:private static void createLargeExplosion(Vector2 location) { EffectsManager.AddLargeExplosion( location + new Vector2(-10, -10)); EffectsManager.AddLargeExplosion( location + new Vector2(-10, 10)); EffectsManager.AddLargeExplosion( ...