Пример #1
0
        private Animator CreateHandsAnimator()
        {
            var hand_right = GeneratedContent.Create_recycle_mantis_HandsDown(-300, 50 + TEXTURE_ANCOR_Y_BONUS, 0.80f, (int)(390 * 1.4f), (int)(320 * 1.4f), true);
            var hand_left  = GeneratedContent.Create_recycle_mantis_HandsDown(380, 50 + TEXTURE_ANCOR_Y_BONUS, 0.80f, (int)(390 * 1.4f), (int)(320 * 1.4f));

            var hand_air_right = GeneratedContent.Create_recycle_mantis_HandsUp(200, -300 + TEXTURE_ANCOR_Y_BONUS, 0.80f, (int)(390 * 1.4f), (int)(320 * 1.4f), true);
            var hand_air_left  = GeneratedContent.Create_recycle_mantis_HandsUp(-100, -300 + TEXTURE_ANCOR_Y_BONUS, 0.80f, (int)(390 * 1.4f), (int)(320 * 1.4f));

            var Animator = new Animator(new AnimationTransitionOnCondition(
                                            new Animation[] {
                hand_right
                , hand_air_left
                , hand_air_right
            }
                                            , hand_left
                                            , () =>
                                            AnimationFacingRight == false &&
                                            Inputs.Action1Down == false &&
                                            GrabbedPaper == null)
                                        , new AnimationTransitionOnCondition(
                                            new Animation[] {
                hand_left
                , hand_air_left
                , hand_air_right
            }
                                            , hand_right, () => AnimationFacingRight && (Inputs.Action1Down == false && GrabbedPaper == null))
                                        , new AnimationTransitionOnCondition(
                                            new Animation[] {
                hand_right
                , hand_left
                , hand_air_right
            }
                                            , hand_air_left, () => AnimationFacingRight == false && (Inputs.Action1Down || GrabbedPaper != null))
                                        , new AnimationTransitionOnCondition(
                                            new Animation[] {
                hand_right
                , hand_left
                , hand_air_left
            }
                                            , hand_air_right, () => AnimationFacingRight && (Inputs.Action1Down || GrabbedPaper != null))
                                        );

            return(Animator);
        }
Пример #2
0
        public ButtonAnimation(int X, int Y, int Width, int Height, Func <bool> Pressed)
        {
            this.X       = X;
            this.Y       = Y;
            this.Width   = Width;
            this.Height  = Height;
            this.Pressed = Pressed;

            var offsetX = (Width / 100) * 5;
            var offsetY = (Height / 100) * 5;

            var z = 0.8f;

            buttonUp = GeneratedContent.Create_touch_inputs_button(-offsetX, -offsetY, z, Width + offsetX, Height + offsetY);
            buttonUp.ChangeColor(new Color(253, 205, 1));
            buttonDown = GeneratedContent.Create_touch_inputs_button_pressed(0, 0, z, Width, Height);
            buttonDown.ChangeColor(new Color(253, 205, 1));

            Current = buttonUp;
        }
Пример #3
0
        public Paper()
        {
            Width         = SIZE;
            Height        = SIZE;
            UpdateHandler = new UpdateGroup(
                new AffectedByGravity(this)
                , new LimitSpeed(this, 100, 80)
                );

            CollisionHandler =
                new CollisionHandlerGroup(
                    new StopsWhenBotCollidingWith <IPaperMovementBlocker>(this, AudiosToPlay.Add)
                    , new StopsWhenRightCollidingWith <IPaperMovementBlocker>(this)
                    );

            Animation = GeneratedContent.Create_trash_bag_Trash(
                -(int)(SIZE * 0.1f)
                , -(int)(SIZE * 0.2f)
                , 0.83f
                , (int)(SIZE * 1.2f)
                , (int)(SIZE * 1.2f));
        }
Пример #4
0
        protected override void LoadContent()
        {
            font        = Content.Load <SpriteFont>("Score");
            spriteBatch = new SpriteBatch(GraphicsDevice);

            GeneratedContent = new GeneratedContent();
            Audios.Add("jump", Content.Load <SoundEffect>("jump"));
            Audios.Add("landing", Content.Load <SoundEffect>("landing"));
            Audios.Add("death", Content.Load <SoundEffect>("death"));
            Audios.Add("explosion", Content.Load <SoundEffect>("explosion"));
            Audios.Add("grab", Content.Load <SoundEffect>("grab"));

            GeneratedContent.Load(Content);

            var pixel = new Texture2D(GraphicsDevice, 1, 1, false, SurfaceFormat.Color);

            pixel.SetData(new[] { Color.White });
            GeneratedContent.Textures.Add("pixel", pixel);

            gameloop = new GameRunner(World.Update);
            gameloop.Start();
            StartGame();
        }
Пример #5
0
        public static SimpleAnimation CreateAnimation(Direction Direction)
        {
            var bonus = 20;
            var tx    = -World.SPACE_BETWEEN_THINGS * bonus;
            var ty    = -World.SPACE_BETWEEN_THINGS * bonus;
            var tz    = 0.9f;
            var tw    = SIZE + World.SPACE_BETWEEN_THINGS * bonus;
            var th    = SIZE + World.SPACE_BETWEEN_THINGS * bonus;

            SimpleAnimation Animation;

            if (Direction == Direction.Center)
            {
                Animation = GeneratedContent.Create_background_wall_center(tx, ty, tz, tw, th);
            }
            else if (Direction == Direction.Left)
            {
                Animation = GeneratedContent.Create_background_wall_left(tx, ty, tz, tw, th);
            }
            else if (Direction == Direction.Right)
            {
                Animation = GeneratedContent.Create_background_wall_right(tx, ty, tz, tw, th);
            }
            else if (Direction == Direction.Top)
            {
                Animation = GeneratedContent.Create_background_wall_top(tx, ty, tz, tw, th);
            }
            else
            {
                Animation = GeneratedContent.Create_background_wall_bot(tx, ty, tz, tw, th);
            }

            Animation.ChangeColor(new Color(158, 165, 178));

            return(Animation);
        }
Пример #6
0
        private void CreateBlocks(int rowNumber, int colNumber)
        {
            //remove left wall? let the player fall?
            var cellsize = 1000 + World.SPACE_BETWEEN_THINGS;

            for (int i = 1; i < rowNumber; i++)
            {
                World.Add(new Block(Direction.Top)
                {
                    X = i * cellsize,
                    Y = cellsize
                });
            }

            for (int i = 1; i <= colNumber; i++)
            {
                World.Add(new Block(i == 1 || i == colNumber ? Direction.Center : Direction.Left)
                {
                    X = 0,
                    Y = i * cellsize
                });
            }

            for (int i = 1; i < rowNumber; i++)
            {
                World.Add(new Block(Direction.Bot)
                {
                    X = i * cellsize,
                    Y = cellsize * colNumber
                });
            }

            for (int i = 1; i <= colNumber; i++)
            {
                if (i == 2)
                {
                    World.Add(new InvisibleBlock()
                    {
                        X = cellsize * rowNumber,
                        Y = i * cellsize
                    });
                    continue;
                }

                World.Add(new Block(i == 1 || i == colNumber ? Direction.Center : Direction.Right)
                {
                    X = cellsize * rowNumber,
                    Y = i * cellsize
                });
            }

            var backgrond = GeneratedContent.Create_background_wall_center(
                0
                , cellsize * 6
                , 1
                , cellsize * 14
                , cellsize * 4);

            backgrond.ChangeColor(new Color(158, 165, 178));
            World.Add(backgrond);
        }