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;
        }
Esempio n. 2
0
 public override void OnDestroy()
 {
     if (QRandom.Number(1, 4) > 1)
     {
         Instantiate(new DroppableItem(), Position);
     }
 }
Esempio n. 3
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;
 }
Esempio n. 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;
 }
Esempio n. 5
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));
        }
Esempio n. 6
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;
        }
Esempio n. 7
0
        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;
        }
Esempio n. 8
0
 public void NewLocation()
 {
     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));
 }