예제 #1
0
        public King() : base(QuickGameScene.Current, Textures.KingTexture)
        {
            DamageHandler = new PlayerDamageHandler(6, this);

            Position.Center = Scene.PlayerStart;
            this.AddGravity();

            Position.SetWidth(8, GameEngine.AnchorOrigin.Left);
            Position.SetHeight(24, GameEngine.AnchorOrigin.Top);

            var input = Input.GetInput(this.Scene);

            new PlayerControl(this, input);

            Animations.Add(AnimationKeys.Stand, this, TextureFlipBehavior.FlipWhenFacingLeft, 0);
            Animations.Add(AnimationKeys.Walk, this, TextureFlipBehavior.FlipWhenFacingLeft, 1, 2, 3, 4);
            Animations.Add(AnimationKeys.Jump, this, TextureFlipBehavior.FlipWhenFacingLeft, 5, 6);
            Animations.Add(AnimationKeys.Fall, this, TextureFlipBehavior.FlipWhenFacingLeft, 8);
            Animations.Add(AnimationKeys.Land, this, TextureFlipBehavior.FlipWhenFacingLeft, 7);
            Animations.Add(AnimationKeys.Attack, this, TextureFlipBehavior.FlipWhenFacingLeft, 10, 11, 12);

            Animations.Add(AnimationKeys.Climb, this, TextureFlipBehavior.FlipWhenFacingLeft, 18, 19, 20, 21);
            Animations.Add(AnimationKeys.ClimbStop, this, TextureFlipBehavior.FlipWhenFacingLeft, 18);

            new MovingPlatformPositionAdjuster <King>(this);
            WaterHelper.AddWaterPhysics(this);

            Scene.InterSceneActors.Add(this);

            //  DebugText.DebugWatch(this, Fonts.SmallFont, Scene.InterfaceLayer, t => t.Position.Center.X.ToString());
            //   DebugText.DebugWatch(this, Fonts.SmallFont, Scene.InterfaceLayer, t => t.Position.Center.Y.ToString());
        }
예제 #2
0
        protected override void LoadSceneContent()
        {
            ParallaxLayer.FixedDisplayable = new IDisplayable[]
            {
                new SimpleGraphic(new Vector2(150, 0), new Sprite(Textures.TreeTexture), ParallaxLayer),
                new SimpleGraphic(new Vector2(150, 64), new Sprite(Textures.TreeTexture), ParallaxLayer)
            };

            MapFromImage.Create(this);

            CollisionManager = new QuickGameCollisionManager(this);


            SolidLayer.CollidableObjects.Add(TileMap);

            Player = new King();
            new Fairy(Player);

            CameraCenter = Player;

            new Interface(this);
            NeededSounds.AddRange(Sounds.GetAllSounds());

            new Spike(this);
            new Spring(this);

            new WaterMover(WaterLayer);

            WaterHelper.AddWaterOverlays(WaterLayer, SolidLayer);
            new LadderCollisionDetector(TileMap);

            var editor = new LiveEditor(this);

            new PauseHandler();

            // var sh = new ShopHandler(Input.GetInput(this),this);
            //new Sign().SetShopHandler(sh).MoveTo(200, 50);
            //new Chest().SetShopHandler(sh).MoveTo(216, 50);
            //new Elf().SetShopHandler(sh).MoveTo(180, 50).Direction = Direction.Left;

            new MapSaver().LoadFromDisk(this);

            //DebugText.DebugWatch(this, Fonts.SmallFont, InterfaceLayer, s => "O=" + s.SolidLayer.CollidableObjects.Count().ToString());
            //DebugText.DebugWatch(this, Fonts.SmallFont, InterfaceLayer, s => "F=" + s.SolidLayer.CollidableObjects.OfType<FrozenObject>().Count().ToString());
            //DebugText.DebugWatch(this, Fonts.SmallFont, InterfaceLayer, s => "C=" + s.SolidLayer.CollidableObjects.OfType<Coin>().Count().ToString());
        }
예제 #3
0
        public Elf() : base(QuickGameScene.Current, Textures.ElfTexture)
        {
            this.AddGravity();

            Position.SetWidth(8, GameEngine.AnchorOrigin.Left);
            Position.SetHeight(24, GameEngine.AnchorOrigin.Top);

            Animations.Add(AnimationKeys.Stand, this, TextureFlipBehavior.FlipWhenFacingLeft, 0, 0, 0, 7, 7, 7);
            Animations.Add(AnimationKeys.Walk, this, TextureFlipBehavior.FlipWhenFacingLeft, 1, 2, 3, 4);
            Animations.Add(AnimationKeys.Jump, this, TextureFlipBehavior.FlipWhenFacingLeft, 5, 6);
            Animations.Add(AnimationKeys.Fall, this, TextureFlipBehavior.FlipWhenFacingLeft, 8);
            Animations.Add(AnimationKeys.Land, this, TextureFlipBehavior.FlipWhenFacingLeft, 7);
            Animations.Add(AnimationKeys.Attack, this, TextureFlipBehavior.FlipWhenFacingLeft, 10, 11, 12);

            new AnimationController <Elf>(this, Condition.False, Condition.False);
            WaterHelper.AddWaterPhysics(this);

            //  new ElfController(this);
            new PlatformerPathFollowerBehavior(this, Scene.SinglePathPoints, new QuickGameNearbyTileChecker(this, Scene.TileMap), Scene.TileMap);
            Scene.InterSceneActors.Add(this);
        }