Browse Source

add simple crash logic

master
parent
commit
efd01c6586
  1. 15
      theGame/Game.cs

15
theGame/Game.cs

@ -67,6 +67,21 @@ namespace theGame
rocks[i].positionX--; rocks[i].positionX--;
} }
int deleted_rock_index = -1;
for (int i = 0; i < rocks.Count; i++)
{
if (rocks[i].positionX == playerCraft.positionX && rocks[i].positionY == playerCraft.positionY)
{
deleted_rock_index = i;
playerCraft.Health = playerCraft.Health - 15;
}
}
if (deleted_rock_index >= 0)
{
rocks.RemoveAt(deleted_rock_index);
}
} }
} }
} }

Loading…
Cancel
Save