/// <summary>
        /// Handle scene entry
        /// </summary>
        public override void Enter()
        {
            base.Enter();

            mSpriteSheet1.Load("Demos/DemoReel/Sprites");
            mSpriteSheet1.grid = new SpriteGrid(new Vector2i(16, 16));
            RB.SpriteSheetSet(mSpriteSheet1);

            mMap.Load("Demos/DemoReel/Tilemap");

            if (mMap != null)
            {
                mMapSize = mMap.size;

                mMap.LoadLayer("Clouds", 0);
                mMap.LoadLayer("Decoration", 1);
                mMap.LoadLayer("Terrain", 2);

                RB.MapLayerSpriteSheetSet(0, mSpriteSheet1);
                RB.MapLayerSpriteSheetSet(1, mSpriteSheet1);
                RB.MapLayerSpriteSheetSet(2, mSpriteSheet1);
            }

            if (mStyle == RB.PixelStyle.Wide)
            {
                RB.DisplayModeSet(new Vector2i(640 / 2, 360), mStyle);
            }
            else
            {
                RB.DisplayModeSet(new Vector2i(640, 360 / 2), mStyle);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handle scene entry
        /// </summary>
        public override void Enter()
        {
            base.Enter();

            spriteSheet1.Load("Demos/DemoReel/Sprites");
            spriteSheet1.grid = new SpriteGrid(new Vector2i(16, 16));

            spriteSheet2.Load("Demos/DemoReel/Ghost");
            spriteSheet2.grid = new SpriteGrid(new Vector2i(104, 106));

            RB.SpriteSheetSet(spriteSheet1);

            mMap.Load("Demos/DemoReel/Tilemap");

            if (mMap != null)
            {
                mMap.LoadLayer("Decoration", 0);
                mMap.LoadLayer("Terrain", 1);

                RB.MapLayerSpriteSheetSet(0, spriteSheet1);
                RB.MapLayerSpriteSheetSet(1, spriteSheet1);
            }

            var demo = (DemoReel)RB.Game;

            shader1.Load("Demos/DemoReel/WavyMaskShader");

            spriteSheet3.Create(RB.DisplaySize);
            spriteSheet4.Create(RB.DisplaySize);

            mBouncePos = new Vector2(RB.DisplaySize.width * 0.5f, RB.DisplaySize.height * 0.55f);
            mVelocity  = mSpeed;
        }
Exemplo n.º 3
0
        private bool LoadMap()
        {
            mTitleMap.Load("Demos/SuperFlagRun/TitleMap");
            mGameMap.Load("Demos/SuperFlagRun/GameMap");

            if (mTitleMap != null && mTitleMap.status == RB.AssetStatus.Ready)
            {
                mTitleMap.LoadLayer("Terrain", SuperFlagRun.MAP_LAYER_TITLE_TERRAIN);
                mTitleMap.LoadLayer("Deco", SuperFlagRun.MAP_LAYER_TITLE_DECO);
                mTitleMap.LoadLayer("Sky", SuperFlagRun.MAP_LAYER_TITLE_SKY);
            }

            if (mGameMap != null)
            {
                mGameMap.LoadLayer("Sky", SuperFlagRun.MAP_LAYER_SKY);
                mGameMap.LoadLayer("Clouds", SuperFlagRun.MAP_LAYER_CLOUDS);
                mGameMap.LoadLayer("Terrain", SuperFlagRun.MAP_LAYER_TERRAIN);
                mGameMap.LoadLayer("Background", SuperFlagRun.MAP_LAYER_BACKGROUND);
            }

            RB.MapLayerSpriteSheetSet(SuperFlagRun.MAP_LAYER_TITLE_TERRAIN, assets.spriteSheetTerrain);
            RB.MapLayerSpriteSheetSet(SuperFlagRun.MAP_LAYER_TITLE_DECO, assets.spriteSheetDeco);
            RB.MapLayerSpriteSheetSet(SuperFlagRun.MAP_LAYER_TITLE_SKY, assets.spriteSheetDeco);

            RB.MapLayerSpriteSheetSet(SuperFlagRun.MAP_LAYER_SKY, assets.spriteSheetDeco);
            RB.MapLayerSpriteSheetSet(SuperFlagRun.MAP_LAYER_CLOUDS, assets.spriteSheetDeco);
            RB.MapLayerSpriteSheetSet(SuperFlagRun.MAP_LAYER_TERRAIN, assets.spriteSheetTerrain);
            RB.MapLayerSpriteSheetSet(SuperFlagRun.MAP_LAYER_BACKGROUND, assets.spriteSheetDeco);

            RB.SpriteSheetSet(assets.spriteSheetTerrain);

            if (mGameMap != null)
            {
                mGameMapSize = mGameMap.size;

                // Convert TMXProperties to simple ColliderInfo.ColliderType, for faster access
                for (int x = 0; x < mGameMapSize.width; x++)
                {
                    for (int y = 0; y < mGameMapSize.height; y++)
                    {
                        var tilePos   = new Vector2i(x, y);
                        var tileProps = RB.MapDataGet <TMXMapAsset.TMXProperties>(MAP_LAYER_TERRAIN, tilePos);
                        if (tileProps != null)
                        {
                            RB.MapDataSet <ColliderInfo.ColliderType>(MAP_LAYER_TERRAIN, tilePos, (ColliderInfo.ColliderType)tileProps.GetInt("ColliderType"));
                        }
                        else
                        {
                            RB.MapDataSet <ColliderInfo.ColliderType>(MAP_LAYER_TERRAIN, tilePos, ColliderInfo.ColliderType.NONE);
                        }
                    }
                }
            }

            return(true);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Handle scene entry
        /// </summary>
        public override void Enter()
        {
            base.Enter();

            mSpriteSheet1.Load("Demos/DemoReel/Sprites");
            mSpriteSheet1.grid = new SpriteGrid(new Vector2i(16, 16));
            RB.SpriteSheetSet(mSpriteSheet1);

            mMap.Load("Demos/DemoReel/Tilemap");

            RB.MapLayerSpriteSheetSet(0, mSpriteSheet1);

            mMap.LoadLayer("Clouds", 1, mSpriteSheet1);
            mMap.LoadLayer("Decoration", 2, mSpriteSheet1);
            mMap.LoadLayer("Terrain", 3, mSpriteSheet1);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Handle scene entry
        /// </summary>
        public override void Enter()
        {
            base.Enter();

            mSpriteSheet1.Load("Demos/DemoReel/Sprites");
            mSpriteSheet1.grid = new SpriteGrid(new Vector2i(16, 16));
            RB.SpriteSheetSet(mSpriteSheet1);

            RB.EffectReset();

            mMap.Load("Demos/DemoReel/Tilemap");

            RB.MapLayerSpriteSheetSet(0, mSpriteSheet1);
            RB.MapLayerSpriteSheetSet(1, mSpriteSheet1);
            RB.MapLayerSpriteSheetSet(2, mSpriteSheet1);

            if (mMap != null)
            {
                mMapSize = mMap.size;

                mMap.LoadLayer("Clouds", 0);
                mMap.LoadLayer("Decoration", 1);
                mMap.LoadLayer("Terrain", 2);
            }

            mEffectNames[(int)RB.Effect.Scanlines]       = "Scanlines";
            mEffectNames[(int)RB.Effect.Noise]           = "Noise";
            mEffectNames[(int)RB.Effect.Desaturation]    = "Desaturation";
            mEffectNames[(int)RB.Effect.Curvature]       = "Curvature";
            mEffectNames[(int)RB.Effect.Slide]           = "Slide";
            mEffectNames[(int)RB.Effect.Wipe]            = "Wipe";
            mEffectNames[(int)RB.Effect.Shake]           = "Shake";
            mEffectNames[(int)RB.Effect.Zoom]            = "Zoom";
            mEffectNames[(int)RB.Effect.Rotation]        = "Rotation";
            mEffectNames[(int)RB.Effect.ColorFade]       = "ColorFade";
            mEffectNames[(int)RB.Effect.ColorTint]       = "ColorTint";
            mEffectNames[(int)RB.Effect.Negative]        = "Negative";
            mEffectNames[(int)RB.Effect.Pixelate]        = "Pixelate";
            mEffectNames[(int)RB.Effect.Pinhole]         = "Pinhole";
            mEffectNames[(int)RB.Effect.InvertedPinhole] = "InvertedPinhole";
            mEffectNames[(int)RB.Effect.Fizzle]          = "Fizzle";
        }
        /// <summary>
        /// Handle scene entry
        /// </summary>
        public override void Enter()
        {
            base.Enter();

            mSpriteSheet1.Load("Demos/DemoReel/Sprites");
            mSpriteSheet1.grid = new SpriteGrid(new Vector2i(16, 16));
            RB.SpriteSheetSet(mSpriteSheet1);

            RB.EffectReset();

            mMap.Load("Demos/DemoReel/Tilemap");

            if (mMap != null)
            {
                mMap.LoadLayer("Decoration", 0);
                mMap.LoadLayer("Terrain", 1);

                RB.MapLayerSpriteSheetSet(0, mSpriteSheet1);
                RB.MapLayerSpriteSheetSet(1, mSpriteSheet1);
            }

            mShader1.Load("Demos/DemoReel/PresentRippleShader");
        }
        /// <summary>
        /// Handle scene entry
        /// </summary>
        public override void Enter()
        {
            base.Enter();

            spriteSheet1.Load("Demos/DemoReel/Sprites");
            spriteSheet1.grid = new SpriteGrid(new Vector2i(16, 16));

            spriteSheet2.Load("Demos/DemoReel/Water");
            spriteSheet2.grid = new SpriteGrid(new Vector2i(16, 16));

            mMap.Load("Demos/DemoReel/TilemapOcean");

            if (mMap != null)
            {
                mMap.LoadLayer("Clouds", 1);
                mMap.LoadLayer("Terrain", 2);
                mMap.LoadLayer("Fish", 3);

                RB.MapLayerSpriteSheetSet(1, spriteSheet1);
                RB.MapLayerSpriteSheetSet(2, spriteSheet1);
                RB.MapLayerSpriteSheetSet(3, spriteSheet1);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Update
        /// </summary>
        public override void Update()
        {
            base.Update();

            if (spriteSheet1.status == RB.AssetStatus.Ready &&
                spriteSheet2.status == RB.AssetStatus.Ready &&
                spriteSheet3.status == RB.AssetStatus.Ready &&
                !mSpritePackPostLoadDone)
            {
                RB.SpriteSheetSet(spriteSheet1);

                mSpriteHero1         = RB.PackedSpriteGet("Characters/Hero1");
                mSpriteHero2         = RB.PackedSpriteGet("Characters/Hero2");
                mSpriteDirtCenter    = RB.PackedSpriteGet("Terrain/DirtCenter");
                mSpriteDirtSide      = RB.PackedSpriteGet("Terrain/DirtSide");
                mSpriteGrassTop      = RB.PackedSpriteGet("Terrain/GrassTop");
                mSpriteGrassTopRight = RB.PackedSpriteGet("Terrain/GrassTopRight");
                mSpriteWater         = RB.PackedSpriteGet("Terrain/Water");

                RB.MapSpriteSet(0, new Vector2i(0, 0), mSpriteGrassTopRight, RB.FLIP_H);
                RB.MapSpriteSet(0, new Vector2i(1, 0), mSpriteGrassTop);
                RB.MapSpriteSet(0, new Vector2i(2, 0), mSpriteGrassTop);
                RB.MapSpriteSet(0, new Vector2i(3, 0), mSpriteGrassTopRight);

                RB.MapSpriteSet(0, new Vector2i(0, 1), mSpriteDirtSide, RB.FLIP_H);
                RB.MapSpriteSet(0, new Vector2i(1, 1), mSpriteDirtCenter);
                RB.MapSpriteSet(0, new Vector2i(2, 1), mSpriteDirtCenter);
                RB.MapSpriteSet(0, new Vector2i(3, 1), mSpriteDirtSide);

                RB.MapLayerSpriteSheetSet(0, spriteSheet1);

                mNineSlice = new NineSlice("Other/NinesliceTopLeft", "Other/NinesliceTop", "Other/NinesliceMiddle");

                var glyphs = new List <string>();
                for (int i = 0; i <= 9; i++)
                {
                    glyphs.Add("Font/" + i);
                }

                glyphs.Add("Font/colon");

                List <char> chars = new List <char>();
                for (char c = '0'; c <= '9'; c++)
                {
                    chars.Add(c);
                }

                chars.Add(':');

                font.Setup(chars, glyphs, spriteSheet1, 1, 1, true);

                var mapping = new string[16];
                for (int i = 0; i < 16; i++)
                {
                    mapping[i] = "Terrain/Tiny" + i;
                }

                mMap.Load("Demos/DemoReel/TinyMap");
                mMap.LoadLayer("Terrain", 1, mapping);
                RB.MapLayerSpriteSheetSet(1, spriteSheet3);

                mSpritePackPostLoadDone = true;
            }
        }