コード例 #1
0
        public override void OnStart(QGetContent content)
        {
            Frames = Scene.MegaTexture["cavern_biome"].Split(16, 16);
            Tile   = Frames[0];

            Sprite          = new QSprite(this, Tile);
            Sprite.Color    = QColor.DarkKhaki;
            Sprite.Layer    = 100f;
            Transform.Scale = new QVec(4);

            int random = QRandom.Range(1, 10);

            if (random == 1)
            {
                Mushroom = Frames[2];
            }
            else if (random == 2)
            {
                Mushroom = Frames[3];
            }
            else if (random == 3)
            {
                Mushroom = Frames[4];
            }
            else
            {
                Mushroom = QRect.Empty;
            }

            body          = World.CreateRectangle(this, 14 * 4, 14 * 4, 1f, Transform.Position, 0, QBodyType.Static);
            body.Friction = 6f;
        }
コード例 #2
0
        public void OnStart(QGetContent content)
        {
            Sprite.Source   = Scene.MegaTexture["cavern_biome"].Split(16, 16)[0];
            Sprite.Origin   = new QVec(8);
            Transform.Scale = new QVec(4);

            body = World.CreateRectangle(this, 16 * 4, 16 * 4, 1f, Transform.Position, 0, QBodyType.Static);
        }
コード例 #3
0
        public override void OnStart(QGetContent content)
        {
            Sprite          = new QSprite(this, Scene.MegaTexture["cavern_biome"].Split(16, 16)[1]);
            Sprite.Color    = QColor.DarkKhaki;
            Transform.Scale = new QVec(4);

            body          = World.CreateRectangle(this, 15 * 4, 15 * 4, 1f, Transform.Position, 0, QBodyType.Static);
            body.Friction = 0;
        }
コード例 #4
0
        public void OnStart(QGetContent content)
        {
            StateOfThePlayer = PlayerState.Moving;

            //Instantiate(SwordCollision = new SwordAttackCollider());

            Health = HealthMax;

            Instantiate(new PlayerHealth());

            //Spawner = GetComponent<PlayerSpawner>("PlayerSpawner");

            AttackFrames      = Scene.MegaTexture["SwordAttack2"].Split(32, 32);
            Frames            = Scene.MegaTexture["BryanSpriteSheet"].Split(32, 32);
            HearthSource      = Scene.MegaTexture["BryanStuff1"].Split(32, 32)[21];
            EmptyHealthSource = Scene.MegaTexture["BryanStuff1"].Split(32, 32)[22];

            Sprite       = new QSprite(this, Frames[0]);
            Sprite.Layer = 5f;

            Transform.Scale = new QVec(4);

            const float attackTime = 0.1f;

            Left        = new QAnimation(Frames, 0.1f, 12, 16);
            Right       = new QAnimation(Frames, 0.1f, 4, 8);
            AttackRight = new QAnimation(AttackFrames, attackTime, 1, 5)
            {
                Loop = false
            };
            AttackLeft = new QAnimation(AttackFrames, attackTime, 7, 11)
            {
                Loop = false
            };
            Current = Right;

            //			Rigibody = QBody.Capsule(
            //				27 * Sprite.Scale.Y,
            //				(15 * Sprite.Scale.X) / 2f, 20,
            //				(15 * Sprite.Scale.X) / 2f, 20, 1f,
            //				Position, this);
            Rigibody = World.CreateCapsule(this, 27 * Transform.Scale.Y, (15 * Transform.Scale.X) / 2f, 20, Transform.Position, 0, QBodyType.Dynamic);

            Rigibody.IsIgnoreCcd   = true;
            Rigibody.FixedRotation = true;
            Rigibody.Friction      = 1f;

            //Rigibody.OnCollision += OnCollision;

            World.Gravity   = new QVec(0, 20f);
            Camera.Position = Transform.Position;            // = Spawner.Transform.Position;

            MoveLeft  = true;
            MoveRight = true;
            TimeInAir = 0;
        }
コード例 #5
0
        public void OnStart(QGetContent content)
        {
            Sprite.Source   = Scene.MegaTexture["Grass"].Split(16, 16)[0];
            Sprite.Layer    = 1f;
            Sprite.Origin   = new QVec(8);
            Transform.Scale = new QVec(4);

            //Position = topos * Sprite.Scale * new Vector2(16);
            body = World.CreateRectangle(this, Transform.Scale.X * 16, Transform.Scale.X * 16, 1f, Transform.Position, 0, QBodyType.Static);
        }
コード例 #6
0
ファイル: Slime.cs プロジェクト: Quincy9000/QEngine.Framework
        public void OnStart(QGetContent content)
        {
            var frame = Scene.MegaTexture["slime"].Split(32, 32);

            SlimeIdle = new QAnimation(frame, 0.5f, 0, 1);

            Sprite.Origin = new QVec(16);

            body            = World.CreateRectangle(this, 32 * 4, 32 * 4, 1f, Transform.Position, 0);
            body.AllowSleep = false;
        }
コード例 #7
0
        public void OnStart(QGetContent content)
        {
            Sprite        = new QSprite(this, Scene.MegaTexture["circleAttackCollider"]);
            Sprite.Origin = Sprite.Source.Center;
            Sprite.Color  = new QColor(255, 255, 255, 200);

            p = GetComponent <Player>("Player");

            body = World.CreateCircle(this, Radius, 1, Transform.Position, QBodyType.Static);            //QBody.Circle(Radius, 1f, userData: this);
            //body.OnCollision += OnCollision;
            body.AllowSleep = false;
            //body.IgnoreCollisionWith(p.body); //dont seem to have this anymore yet

            Transform.Position = p.Transform.Position + new QVec(distanceFromPlayer, 0);
        }
コード例 #8
0
        public override void OnStart(QGetContent content)
        {
            Health = MaxHealth;

            Frames = Scene.MegaTexture["BryanStuff1"].Split(32, 32);

            bs = GetComponent <BatSpawner>(spawnerId);
            p  = GetComponent <Player>("Player");

            Sprite          = new QSprite(this, Frames[28]);
            Transform.Scale = new QVec(4);
            Sprite.Origin   = new QVec(16);

            BatFlap = new QAnimation(Frames, 0.1f, 28, 30);

            spawnerPosition = Transform.Position = bs.Transform.Position;

            body = World.CreateRectangle(this, 13 * Transform.Scale.X, 13 * Transform.Scale.Y, 1f, Transform.Position, 0);
            body.IgnoreGravity = true;
            body.FixedRotation = true;
            body.LinearDamping = 10f;
        }