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