IsAlive() public method

public IsAlive ( ) : bool
return bool
Example #1
0
        public void PlaceInWorld(uint index, uint x, uint y)
        {
            Player p = player[index];

            Debug.MyAssert(p.IsAlive());
            p.x   = (byte)x;
            p.y   = (byte)y;
            p.dir = (Direction)(index * 2);
            map.Set(p.x, p.y, (MapData)((int)MapData.kPlayer0 + index));
            p.state       = PlayerState.kNormal;
            p.arrow.alive = false;
        }
Example #2
0
        public void SetPlayerPositions()
        {
            byte x = 0;
            byte y = 0;

            if (!map.Find(ref x, ref y, MapData.kUp))
            {
                Debug.MyDebugBreak();
                x = 4;
                y = 4;
            }
            for (uint i = 0; i < numPlayers; i++)
            {
                Player p = player[i];
                if (p.IsAlive())
                {
                    byte px = x;
                    byte py = y;
                    MoveCoords(ref px, ref py, (Direction)(i * 2));
                    PlaceInWorld(i, px, py);
                }
            }
        }
Example #3
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;
            }
        }