Пример #1
0
        public bool moveStudent(Checkpoint[] ch)
        {
            Random r = new Random();
            int ofset = r.Next(1, 39);
            if (checkpoint == ch.Count())
            {
                return false;
            }
            string newimg;
            switch (direction)
            {
                case 1:
                    position.y -= speed;
                    centerPosition.y -= speed;
                    if (position.y < ch[checkpoint].value+ofset)
                    {
                        direction = ch[checkpoint].coordinate;
                        checkpoint++;
                    }
                    break;

                case 2:
                    position.x += speed;
                    centerPosition.x += speed;
                    if (position.x > ch[checkpoint].value + ofset)
                    {
                        direction = ch[checkpoint].coordinate;
                        checkpoint++;
                        newimg = imgS[0] + "4";
                        setImage(newimg);
                    }
                    break;

                case 3:
                    position.y += speed;
                    centerPosition.y += speed;
                    if (position.y > ch[checkpoint].value + ofset)
                    {
                        direction = ch[checkpoint].coordinate;
                        checkpoint++;

                    }
                    break;

                case 4:
                    position.x -= speed;
                    centerPosition.x -= speed;
                    if (position.x < ch[checkpoint].value + ofset)
                    {
                        direction = ch[checkpoint].coordinate;
                        checkpoint++;
                        newimg = imgS[0] + "2";
                        setImage(newimg);
                    }
                    break;
            }
            return true;
        }
Пример #2
0
 public Stage(Point startPosition, Checkpoint[] checkpoints, int numCP, int classes, int spc,int startingCash, int studentHealth,int studentSpeed)
 {
     this.studentSpeed = studentSpeed;
     this.checkpoints = checkpoints;
     this.startPosition = startPosition;
     this.numCP = numCP;
     this.classes = classes;
     this.startingCash = startingCash;
     this.studentsPerClas = spc;
     this.studentHealth = studentHealth;
 }