Exemple #1
0
        public PlayScreen2()
        {
            freeGameObjects = new List<GameObj>();
            gameObjects = new Dictionary<int, List<GameObj>>();
            roadObjects = new GameObj[6];

            LanePositionY = new Dictionary<int, int>();
            accState = AccelerateState.DEACC;
        }
Exemple #2
0
        public override bool HandleTouch(TouchCollection tc)
        {
            int lowerLeft = -1;
            int upperLeft = -1;
            int lowerRight = -1;
            int upperRight = -1;

            for (int i = 0; i < tc.Count; i++)
            {
                if (tc[i].Position.X < 400) // left
                {
                    if (tc[i].Position.Y < 240) // top
                    {
                        upperLeft = i;
                    }
                    else // bottom
                    {
                        lowerLeft = i;
                    }
                }
                else // right
                {
                    if (tc[i].Position.Y < 240) // top
                    {
                        upperRight = i;
                    }
                    else // bottom
                    {
                        lowerRight = i;
                    }
                }
            }

            if (lowerLeft > -1)
            {
                TouchLocation tl = tc[lowerLeft];
                if (tl.State == TouchLocationState.Pressed)
                {
                    accState = AccelerateState.ACC;
                }
                else if (tl.State == TouchLocationState.Released)
                {
                    accState = AccelerateState.DEACC;
                }
            }

            if (upperRight > -1)
            {
                TouchLocation tl = tc[upperRight];

                if (tl.State == TouchLocationState.Released)
                {
                    skateObj.StartJump();
                }
            }

            if (lowerRight > -1)
            {
                TouchLocation tl = tc[lowerRight];
                if (tl.State == TouchLocationState.Released)
                {
                    MoveSkaterLane(tl.Position.Y > 400 ? -1 : 1);

                }
            }

            return true;
        }