Beispiel #1
0
 // Called when this platform has been hit by the player.
 public void OnContact(Player contactBy)
 {
     hit = true;
        Game.PlaySound(crackSound);
 }
Beispiel #2
0
 public void OnContact(Player contactBy)
 {
     contactBy.OnKilled(null);
 }
Beispiel #3
0
        // 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);
        }
Beispiel #4
0
        // Called when a gem is collected.
        private void OnGemCollected(Gem gem, Player collectedBy)
        {
            score += Gem.PointValue;

            gem.OnCollected(collectedBy);
        }
Beispiel #5
0
 // Called when this gem has been collected by a player and removed from the level.
 public void OnCollected(Player collectedBy)
 {
     Game.PlaySound(collectedSound);
 }