Beispiel #1
0
 public World()
 {
     for(uint i = 0; i < player.Length; i++)
     {
     player[i] = new Player();
     }
 }
Beispiel #2
0
 public void DoArrowMove(Player p, bool isFirstMove)
 {
     if(!p.arrow.alive)
     {
     return;
     }
     byte x = p.arrow.x;
     byte y = p.arrow.y;
     if(!isFirstMove)
     {
     map.Set(x, y, MapData.kSpace);
     }
     MoveCoords(ref x, ref y, p.arrow.dir);
     MapData d = map.Get(x,y);
     if(Arrow.CanHit(d))
     {
     switch(d)
     {
     case MapData.kBomb:
         DoSmartBomb();
         map.Set(x, y, MapData.kSpace);
         break;
     case MapData.kGhost: goto common;
     case MapData.kSmiley: goto common;
     case MapData.kBig: goto common;
     case MapData.kGen1: goto common;
     case MapData.kGen2: goto common;
     case MapData.kGen3:
             common:
         map.Set(x, y, MapData.kSpace);
         break;
     case MapData.kHeart:
         {
             bool foundPlayer = false;
             for(uint i = 0; i < numPlayers; i++)
             {
                 Player p2 = player[i];
                 if(!p2.IsAlive())
                 {
                     p2.health = 9;
                     p2.state = PlayerState.kNormal;
                     PlaceInWorld(i, x, y);
                     foundPlayer = true;
                     break;
                 }
             }
             if(!foundPlayer)
             {
                 map.Set(x, y, MapData.kBig);
             }
         }
         break;
     default:
         Debug.MyDebugBreak();
         break;
     }
     p.arrow.alive = false;
     }
     else if(Arrow.CanGo(d))
     {
     p.arrow.x = x;
     p.arrow.y = y;
     int rotatedDir = ((int)(p.arrow.dir + 3) & 7); // Because font is screwed up
     map.Set(x, y, (MapData) (MapData.kArrow0 + rotatedDir));
     }
     else
     {
     p.arrow.alive = false;
     }
 }