Skip to content

Instantly share code, notes, and snippets.

@steveturner
Created August 29, 2011 04:06
Show Gist options
  • Save steveturner/1177756 to your computer and use it in GitHub Desktop.
Save steveturner/1177756 to your computer and use it in GitHub Desktop.
The Game Changer: You can't die?
/// <summary>
/// Set up all of the objects for the level. Very Important!
/// </summary>
///
void _checkLevel()
{
if (_playerGroup.FindObject("Player1", false) == null && _playerGroup.FindObject("Player2", false) != null)
{
if (_playerCountdownToSpawn > 0f)
{
_playerCountdownToSpawn -= 1.0f;
}
if (_playerCountdownToSpawn <= 0f)
{
T2DSceneObject playerloc2 = (T2DSceneObject)_playerGroup.FindObject("Player2", false);
Vector2 playerlocat2 = playerloc2.Position;
SinglePlayerLevel.Instance._playerGroup.ExplicitCreate(0, _playerGroup.GetPlayerIndex(playerloc2), MyGame.TankTypes.Light, false, Convert.ToInt32(playerlocat2.X) + 10, Convert.ToInt32(playerlocat2.Y));
_playerGroup.FindObject("Player1", false).Components.FindComponent<PlayerControlComponent>().setavailableWeapons("Pistol");
_playerGroup.FindObject("Player1", false).Components.FindComponent<PlayerControlComponent>().setweaponType("Pistol");
_playerGroup.SetAllPlayerInput(true);
_playerCountdownToSpawn = 300.0f;
}
}
if (_playerGroup.FindObject("Player2", false) == null && _playerGroup.FindObject("Player1", false) != null)
{
if (_playerCountdownToSpawn > 0f)
{
_playerCountdownToSpawn -= 1.0f;
}
if (_playerCountdownToSpawn <= 0f)
{
T2DSceneObject playerloc1 = (T2DSceneObject)_playerGroup.FindObject("Player1", false);
Vector2 playerlocat1 = playerloc1.Position;
SinglePlayerLevel.Instance._playerGroup.ExplicitCreate(1, _playerGroup.GetPlayerIndex(playerloc1), MyGame.TankTypes.Light, false, Convert.ToInt32(playerlocat1.X) + 10, Convert.ToInt32(playerlocat1.Y));
_playerGroup.FindObject("Player2", false).Components.FindComponent<PlayerControlComponent>().setavailableWeapons("Scythe");
_playerGroup.FindObject("Player2", false).Components.FindComponent<PlayerControlComponent>().setavailableWeapons("GrapHook");
_playerGroup.FindObject("Player2", false).Components.FindComponent<PlayerControlComponent>().setweaponType("GrapHook");
_playerGroup.SetAllPlayerInput(true);
_playerCountdownToSpawn = 300.0f;
}
}
if (_playerGroup.GetNumObjects() <= 0)
{
GUITextStyle textStyle = new GUITextStyle();
textStyle.SizeToText = true;
textStyle.FontType = "arial22";
if (_splash == null)
{
_splash = (T2DSceneObject)GameData.Instance.GetBattleground(5).Clone();
_splash.Size = new Vector2(1280, 1024);
_splash.Layer = 2;
_splash.Position = _sceneCam.Position;
TorqueObjectDatabase.Instance.Register(_splash);
GameData.Instance.StopMenuMusic();
GameData.Instance.StartMenuMusic("Death Music 1");
}
}
if (_aiPlayerGroup.FindObject("Chromoth", false) == null)
{
if (_levelnumber == 3)
{
_levelSplash = (T2DSceneObject)GameData.Instance.GetBattleground(6).Clone();
_levelSplash.Size = new Vector2(1280, 1024);
_levelSplash.Position = _sceneCam.Position;
_levelSplash.Visible = true;
_levelSplash.Layer = 0;
_CountdownToSplash = 900.0f;
TorqueObjectDatabase.Instance.Register(_levelSplash);
// GameData.Instance.StartMenuMusic("music1");
}
}
if (_levelSplash.Visible == true)
{
_CountdownToSplash -= 1.0f;
}
if (_CountdownToSplash <= 0.0f)
{
_levelSplash.Visible = false;
if (_levelnumber == 3)
{
GameData.Instance.StartMenuMusic("Boss Music 1");
}
else
{
GameData.Instance.StartMenuMusic("music1");
}
// TorqueObjectDatabase.Instance.Unregister(_levelSplash);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment