示例#1
0
文件: Bird.cs 项目: EkoGame/EkoGame
        public Bird(GameWorld gameWorld)
            : base(gameWorld)
        {
            Graphic.LoadContent("gfx/background/bird");
            Graphic.Layer = 0.02f;

            TextureAtlas textureAtlas = new TextureAtlas(Graphic.Texture, 42, 30);
            _flyAnimation = textureAtlas.GetAnimation(0, 10);
            _flyAnimation.FrameRate = 24;
            _flyAnimation.IsRepeating = true;
            _animationPlayer.Play(_flyAnimation);
        }
示例#2
0
        public Mushroom(Vector2 force, GameWorld gameWorld)
            : base(gameWorld)
        {
            _force = force;
            Graphic.LoadContent("gfx/object/dynamic/mushroom");
            Graphic.Layer = 0.9f;
            Graphic.Offset = new Vector2(Graphic.Texture.Width / 2 - 69, Graphic.Texture.Height / 2 - 55);

            TextureAtlas textureAtlas = new TextureAtlas(Graphic.Texture, 138, 111);
            _bounceAnimation = textureAtlas.GetAnimation(0, 16);
            _bounceAnimation.FrameRate = 24;
            _animationPlayer.Play(_bounceAnimation);

            Body = BodyFactory.CreateCircle(gameWorld.PhysicalWorld, 1.0f, 1.0f);
            Body.BodyType = BodyType.Static;
            Body.OnCollision += Body_OnCollision;
        }