예제 #1
0
파일: InvisBlock.cs 프로젝트: mbos14/GTFO
 //is called only for new collisions
 private void OnCollisionEnter(Enemy other)
 {
     if (other._state == EnemyState.hit)
     {
         other._state = EnemyState.walk;
         if (other.directionHit == PlayerDirection.left)
         {
             while (HitTest(other))
             {
                 x -= 10;
             }
         }
         else if (other.directionHit == PlayerDirection.right)
         {
             while (HitTest(other))
             {
                 x += 10;
             }
         }
         else if (other.directionHit == PlayerDirection.up)
         {
             while (HitTest(other))
             {
                 y -= 10;
             }
         }
         else if (other.directionHit == PlayerDirection.down)
         {
             while (HitTest(other))
             {
                 y += 10;
             }
         }
     }
     other._state = EnemyState.walk;
     other.TurnAround();
 }
예제 #2
0
 //read a single Tiled Object
 private void interpretObject(TiledObject tiledObject)
 {
     //create an enemy
     Enemy enemy = new Enemy(tiledObject);
     AddChild(enemy);
 }