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;
        }
Example #2
0
        public void OnStart(QGetContent content)
        {
            Sprite          = new QSprite(this, "cavern_wall");
            Sprite.Origin   = new QVec(8);
            Sprite.Layer    = 1f;
            Sprite.Color   *= 0.4f;
            Transform.Scale = new QVec(4);

            QRect wall = Scene.MegaTexture["cavern_biome"].Split(16, 16)[1];

            using (var layer2 = content.Texture("map1_3").GetPartialTexture(new QRect(0, 0, 128, 128)))
            {
                OutsideTiles = QMapTools.CreateSpriteLayer(layer2, Transform.Position, new QVec(16, 16) * Transform.Scale, color =>
                {
                    if (color == new QColor(60, 45, 30))
                    {
                        return(wall);
                    }
                    return(QRect.Empty);
                });

                InsideTiles = QMapTools.CreateSpriteLayer(layer2, Transform.Position, new QVec(16, 16) * Transform.Scale, color =>
                {
                    if (color == new QColor(134, 97, 61))
                    {
                        return(wall);
                    }
                    return(QRect.Empty);
                });
            }
        }
Example #3
0
 public void OnStart(QGetContent get)
 {
     Sprite         = new QSprite(this, get.TextureSource("BryanStuff1").Split(32, 32)[7]);
     Sprite.Offset += new QVec(2, 0);
     Sprite.Scale   = QVec.One * 2;
     Body           = Physics.CreateCircle(this, PotionRadius, 5);
 }
Example #4
0
 public override void OnStart(QGetContent get)
 {
     Sprite       = new QSprite(this, get.TextureSource(Name));
     Sprite.Color = QRandom.Color();
     body         = Physics.CreateCircle(this, Radius);
     body.ApplyForce(DirectionOfMovement);
     body.IsBullet = true;
 }
Example #5
0
 public override void OnStart(QGetContent get)
 {
     sprite       = new QSprite(this, get.TextureSource(Name));
     sprite.Color = QRandom.Color();
     body         = Physics.CreateRectangle(this, Width, Height);
     body.ApplyForce(DirectionOfMovement);
     body.IsBullet = true;
 }
Example #6
0
        public override void OnStart(QGetContent get)
        {
            sprite     = new QSprite(this, "snakeHead");
            CurrentDir = SnakeDirection.Down;
            Coroutine.Start(SnakeMove());

            fruit = GetBehavior <Fruit>("Fruit");
            Scene.SpriteRenderer.ClearColor = QColor.Black;
        }
        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;
        }
Example #8
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;
        }
Example #9
0
        public void OnStart(QGetContent get)
        {
            var floorTiles = get.TextureSource("cavern_biome").Split(16, 16);

            sprite        = new QSprite(this, floorTiles[1]);
            sprite.Scale  = QVec.One * 4.01f;
            body          = Physics.CreateRectangle(this, sprite.Width, sprite.Height, 1, QBodyType.Static);
            body.Friction = 0.2f;
            body.IsCCD    = false;
        }
Example #10
0
        public override void OnStart(QGetContent get)
        {
            int Color() => QRandom.Number(1, 255);

            sprite             = new QSprite(this, "circle");
            sprite.Color       = new QColor(Color(), Color(), Color());
            Transform.Position = new QVec(
                QRandom.Number(Camera.Position.X - Window.Width / 2f, Camera.Position.X + Window.Width / 2f),
                QRandom.Number(Camera.Position.Y - Window.Height / 2f, Camera.Position.Y + Window.Height / 2f));
        }
Example #11
0
        public override void OnStart(QGetContent get)
        {
            int R() => QRandom.Number(1, 255);

            sprite        = new QSprite(this, Name);
            sprite.Color  = new QColor(R(), R(), R());
            body          = Physics.CreateRectangle(this, sprite.Width, sprite.Height, 1, QBodyType.Static);
            body.Friction = 0.2f;
            body.IsCCD    = false;
        }
        public void OnStart(QGetContent get)
        {
            Sprite       = new QSprite(this, get.TextureSource(Name));
            Sprite.Color = QColor.Black;

            Body                  = Physics.CreateCircle(this, Radius, 1, QBodyType.Static);
            Body.IsSensor         = true;
            Body.OnCollisionStay += OnCollisionStay;

            p = GetBehavior <Player>();
        }
Example #13
0
        public override void OnStart(QGetContent get)
        {
            Square = get.Texture("penis");
            font   = get.Font("arial");
            euro   = get.Texture("asdf");

            Arial  = new QLabel(font);
            sprite = new QSprite(this, "penis");
            Instantiate(new QDemoObject2());

            Console.Label = Arial;
            Console.Color = QColor.DarkGoldenrod;

            Coroutine.Start(Thing());
        }
        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);
        }
        public void OnStart(QGetContent content)
        {
            var cavernBiomes = content.TextureSource("cavern_biome").Split(16, 16);

            Sprite       = new QSprite(this, cavernBiomes[0]);
            Sprite.Scale = QVec.One * 4;

            BackgroundTiles = QMapTools.CreateSpriteLayer(content, "biomeMapBack", QVec.Zero, QVec.One * 64, c =>
            {
                if (c == new QColor(60, 45, 30))
                {
                    return(cavernBiomes[1]);
                }
                return(QRect.Empty);
            });

            LevelTiles = QMapTools.CreateSpriteLayer(content, "biomeMapBack", QVec.Zero, QVec.One * 64, c =>
            {
                if (c == new QColor(134, 97, 61))
                {
                    return(cavernBiomes[1]);
                }
                return(QRect.Empty);
            });

//			tiles = QMapTools.CreateSpriteLayer(content, "biomeMapBack", QVec.Zero, QVec.One * 64, c =>
//			{
//				if(c == new QColor(60, 45, 30))
//				{
//					return cavernBiomes[1];
//				}
//				if(c == new QColor(134, 97, 61))
//				{
//					return cavernBiomes[1];
//				}
//				return QRect.Empty;
//			});
//
//			var b = content.Texture("biomeMapBack").Bounds;
//			//quad = new QQuad(new QRect(0,0, b.Width * 64, b.Height * 64));
//			quad = new QQuad(new QRect(0,0, b.Width * 64, b.Height * 64));
//
//			for(int i = 0; i < tiles.Count; i++)
//			{
//				quad.Insert(new QRect(tiles[i].Position, tiles[i].Source.Size));
//			}
        }
        public void OnStart(QGetContent get)
        {
            var floorTiles = get.TextureSource("cavern_biome").Split(16, 16);

            sprite = new QSprite(this, floorTiles[0]);
            //Randomly decide to put mushroom on floor tile
            if (QRandom.Number(1, 10) > 6)
            {
                mushroomSprite       = new QSprite(this, floorTiles[QRandom.Number(2, 4)]);
                mushroomSprite.Scale = QVec.One * 4f;
            }
            sprite.Scale     = QVec.One * 4f;
            body             = Physics.CreateRectangle(this, sprite.Width, sprite.Height, 1, QBodyType.Static);
            body.Friction    = 0.1f;
            body.IsCCD       = true;
            body.Restitution = 0f;
        }
Example #17
0
        public override void OnStart(QGetContent get)
        {
            spawnerPosition = Transform.Position;

            Health = MaxHealth;

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

            player = GetBehavior <Player>("Player");

            Sprite        = new QSprite(this, Frames[28]);
            Sprite.Scale  = new QVec(4);
            Sprite.Effect = QRenderEffects.FlipVertically;
            Sprite.Source = Frames[30];

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

            body = Physics.CreateRectangle(this, Sprite.Width / 3f, Sprite.Height / 3f, 5);
            body.IgnoreGravity = true;
            body.FixedRotation = true;
            body.LinearDamping = 10f;
        }
Example #18
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;
        }
Example #19
0
 public override void OnStart(QGetContent get)
 {
     sprite = new QSprite(this, "fruit");
 }