Example #1
0
        public Robot(ADHDGame g, Stage st)
        {
            //init anims
            right = new Animation(new Rectangle(0, 206, Size.X, Size.Y), 9, rate, true);
            up = new Animation(new Rectangle(0, 103, Size.X, Size.Y), 9, rate, true);
            down = new Animation(new Rectangle(0, 0, Size.X, Size.Y), 9, rate, true);
            banjo = new Animation(new Rectangle(0, 618, Size.X, Size.Y), 9, 1.0f / 10.0f, false);
            banjoPlay = new Animation(new Rectangle(0, 721, Size.X, Size.Y), 9, 1.0f / 10.0f, true);
            die = new Animation(new Rectangle(0, 824, Size.X, Size.Y), 9, 1.0f / 10.0f, false);
            pushDown = new Animation(new Rectangle(0, 309, Size.X, Size.Y), 9, 1.0f / 20.0f, false);
            pushUp = new Animation(new Rectangle(0, 412, Size.X, Size.Y), 9, 1.0f / 20.0f, false);
            pushRight = new Animation(new Rectangle(0, 515, Size.X, Size.Y), 9, 1.0f / 20.0f, false);

            tex = g.Content.Load<Texture2D>("robot");
            batch = st.batch;
            stage = st;
            position = Stage.TileToPos(new Point(11, 17));
            currAnim = down;
            currAnim.Stop();
            Dir = Direction.Down;
            velocity = Vector2.Zero;
            flip = SpriteEffects.None;
            game = g;
            SnapToTile();
        }
Example #2
0
        public TitleScreen(ADHDGame g, SpriteBatch spb)
            : base(g,spb)
        {
            RobotActions.Instance.energy = 20;
            paper = false;
            mouse = false;
            game = g;
            sb = spb;
            titleSequence = new List<Texture2D>(40);
            gs = new GameplayScreen(g, spb);
            titleAnim = new Animation(new Rectangle(0, 0, 1024, 768), 40, 30, true);
            introNews = g.Content.Load<Texture2D>("newspaper_intro");
            space = g.Content.Load<Texture2D>("spaceBG");
            int i;
            for (i = 0; i < 40; i++)
            {
                titleSequence.Add(g.Content.Load<Texture2D>("titlescreen\\titlescreen" + (i+1).ToString()));
            }
            snoring = g.Content.Load<SoundEffect>("Snoring").CreateInstance();
            alarm = g.Content.Load<SoundEffect>("alarm_02").CreateInstance();

            alarm.IsLooped = true;
            alarm.Volume = 0.2f;
            snoring.IsLooped = true;
            snoring.Play();
        }
Example #3
0
        public void Update(GameTime time)
        {
            currAnim.Update(time);
            float t = (float)time.ElapsedGameTime.TotalSeconds;

            //scale down
            if (scaling)
            {
                scale -= 0.2f * t;
            }

            if (velocity != Vector2.Zero)
            {
                position += velocity * t;
                travelled += Math.Abs(velocity.X * t) + Math.Abs(velocity.Y * t);

                if (travelled >= dist)
                {
                    StopMove();
                    moving = false;
                }
            }
            if (!moving)
            {
                Direction onConveyor = OnConveyor();
                if (onConveyor != Direction.None)
                {
                    BeginMove(onConveyor, 1);
                }
            }
            if (RobotActions.Instance.energy <= 0 && game.GameScreen.endingTime <= 0.0f)
            {
                currAnim = die;
                currAnim.Play();
                game.GameScreen.End(EndScreen.Ending.Inaction, 4);
            }
        }
Example #4
0
 public void Rotate()
 {
     flip = SpriteEffects.None;
     switch (Dir)
     {
         case Direction.Left:
             flip = SpriteEffects.FlipHorizontally;
             currAnim = right;
             break;
         case Direction.Right:
             currAnim = right;
             break;
         case Direction.Up:
             currAnim = up;
             break;
         case Direction.Down:
             currAnim = down;
             break;
     }
 }
Example #5
0
        public void PlayPush()
        {
            switch (Dir)
            {
                case Direction.Left:
                    flip = SpriteEffects.FlipHorizontally;
                    currAnim = pushRight;
                    break;
                case Direction.Right:
                    currAnim = pushRight;
                    break;
                case Direction.Up:
                    currAnim = pushUp;
                    break;
                case Direction.Down:
                    currAnim = pushDown;
                    break;
            }

            currAnim.Play();
        }
Example #6
0
 public void BanjoPlay()
 {
     currAnim = banjoPlay;
     currAnim.Play();
 }