// Called when this platform has been hit by the player. public void OnContact(Player contactBy) { hit = true; Game.PlaySound(crackSound); }
public void OnContact(Player contactBy) { contactBy.OnKilled(null); }
// Instantiates a player, puts him in the level, and remembers where to put him when he is resurrected. private Tile LoadStartTile(int x, int y) { if (Player != null) throw new NotSupportedException("A level may only have one starting point."); start = RectangleExtensions.GetBottomCenter(GetBounds(x, y)); // Loading main world after finishing or quiting a level if (Level.IsMainWorld && LoadMainWorldFromLevel) player = new Player(this, LastMainLevelCheckPoint); // Loading main world at beginning of game else if (Level.IsMainWorld) { LastMainLevelCheckPoint = start; player = new Player(this, LastMainLevelCheckPoint); } // Loading a normal level (from main world) else { lastCheckPoint = start; player = new Player(this, lastCheckPoint); } return new Tile(null, TileCollision.Passable); }
// Called when a gem is collected. private void OnGemCollected(Gem gem, Player collectedBy) { score += Gem.PointValue; gem.OnCollected(collectedBy); }
// Called when this gem has been collected by a player and removed from the level. public void OnCollected(Player collectedBy) { Game.PlaySound(collectedSound); }