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

            RB.SpriteSheetSetup(0, "Demos/DemoReel/Sprites", new Vector2i(16, 16));
            RB.SpriteSheetSet(0);

            RB.SpriteSheetSetup(1, "Demos/DemoReel/Ghost", new Vector2i(104, 106));

            mMap = RB.MapLoadTMX("Demos/DemoReel/Tilemap");

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

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

            var demo = (DemoReel)RB.Game;

            RB.ShaderSetup(0, "Demos/DemoReel/WavyMaskShader");

            RB.SpriteSheetSetup(2, RB.DisplaySize);
            RB.SpriteSheetSetup(3, RB.DisplaySize);

            mBouncePos = new Vector2(RB.DisplaySize.width * 0.5f, RB.DisplaySize.height * 0.55f);
            mVelocity  = mSpeed;
        }
Example #2
0
        /// <summary>
        /// Handle scene entry
        /// </summary>
        public override void Enter()
        {
            base.Enter();

            RB.SpriteSheetSetup(0, "Demos/DemoReel/Sprites", new Vector2i(16, 16));
            RB.SpriteSheetSet(0);

            mMap = RB.MapLoadTMX("Demos/DemoReel/Tilemap");

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

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

            if (mStyle == RB.PixelStyle.Wide)
            {
                RB.DisplayModeSet(new Vector2i(640 / 2, 360), mStyle);
            }
            else
            {
                RB.DisplayModeSet(new Vector2i(640, 360 / 2), mStyle);
            }
        }
Example #3
0
        private bool LoadMap()
        {
            mTitleMap = RB.MapLoadTMX("Demos/SuperFlagRun/TitleMap");
            mGameMap  = RB.MapLoadTMX("Demos/SuperFlagRun/GameMap");

            if (mTitleMap != null)
            {
                RB.MapLoadTMXLayer(mTitleMap, "Terrain", SuperFlagRun.MAP_LAYER_TITLE_TERRAIN);
                RB.MapLoadTMXLayer(mTitleMap, "Deco", SuperFlagRun.MAP_LAYER_TITLE_DECO);
                RB.MapLoadTMXLayer(mTitleMap, "Sky", SuperFlagRun.MAP_LAYER_TITLE_SKY);
            }

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

            RB.MapLayerSpriteSheetSet(SuperFlagRun.MAP_LAYER_TITLE_TERRAIN, SPRITESHEET_TERRAIN);
            RB.MapLayerSpriteSheetSet(SuperFlagRun.MAP_LAYER_TITLE_DECO, SPRITESHEET_DECO);
            RB.MapLayerSpriteSheetSet(SuperFlagRun.MAP_LAYER_TITLE_SKY, SPRITESHEET_DECO);

            RB.MapLayerSpriteSheetSet(SuperFlagRun.MAP_LAYER_SKY, SPRITESHEET_DECO);
            RB.MapLayerSpriteSheetSet(SuperFlagRun.MAP_LAYER_CLOUDS, SPRITESHEET_DECO);
            RB.MapLayerSpriteSheetSet(SuperFlagRun.MAP_LAYER_TERRAIN, SPRITESHEET_TERRAIN);
            RB.MapLayerSpriteSheetSet(SuperFlagRun.MAP_LAYER_BACKGROUND, SPRITESHEET_DECO);

            RB.SpriteSheetSet(SuperFlagRun.SPRITESHEET_TERRAIN);

            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 <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);
        }
Example #4
0
        /// <summary>
        /// Handle scene entry
        /// </summary>
        public override void Enter()
        {
            base.Enter();

            RB.SpriteSheetSetup(0, "Demos/DemoReel/Sprites", new Vector2i(16, 16));
            RB.SpriteSheetSet(0);

            mMap = RB.MapLoadTMX("Demos/DemoReel/TilemapProps");

            if (mMap != null)
            {
                RB.MapLoadTMXLayer(mMap, "Clouds", 1);
                RB.MapLoadTMXLayer(mMap, "Decoration", 2);
                RB.MapLoadTMXLayer(mMap, "Terrain", 3);
            }
        }
Example #5
0
        /// <summary>
        /// Handle scene entry
        /// </summary>
        public override void Enter()
        {
            base.Enter();

            RB.SpriteSheetSetup(0, "Demos/DemoReel/Sprites", new Vector2i(16, 16));
            RB.SpriteSheetSet(0);

            RB.EffectReset();

            mMap = RB.MapLoadTMX("Demos/DemoReel/Tilemap");

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

            RB.ShaderSetup(0, "Demos/DemoReel/PresentRippleShader");
        }
Example #6
0
    public void loadMapFiles(string mapName)
    {
        Vector2i mapDestPos     = new Vector2i(0, 0);
        Vector2i sourceChunkPos = new Vector2i(0, 0);
        // Load map
        var    map  = RB.MapLoadTMX(mapName);
        string path = "Assets/RetroBlit/Resources/map/map-data.json";

        StreamReader reader     = new StreamReader(path);
        String       rawmapdata = reader.ReadToEnd();

        reader.Close();
        // Load json map info and iterate through each object loading the layers from top to bottom //TODO
        LayerMaps layerMaps = Mapper.deserialize <LayerMaps>(rawmapdata);

        foreach (LayerMap m in layerMaps.allMaps)
        {
            RB.MapLoadTMXLayer(map, m.map_layer_name, m.layer);
            RB.SpriteSheetSetup(m.layer, m.sprite_sheet, new Vector2i(32, 32));
            RB.MapLayerSpriteSheetSet(m.layer, m.layer);
        }

        var objects = map.objectGroups[layerMaps.objectLayerName].objects;

        foreach (var curObj in objects)
        {
            //  Make a new badguy for this object
            BadGuy curBadGuy = new BadGuy(curObj.rect.x, curObj.rect.y);
            curBadGuy.size = new Vector2i(16, 16);

            badGuys.Add(curBadGuy);
        }

        // You can load a spritesheet here
        RB.SpriteSheetSetup(0, "MyGame/MySprites", new Vector2i(16, 16));
        RB.SpriteSheetSet(0);

        mapLayers = layerMaps.allMaps;
        mapSize   = map.size * 32;
    }
Example #7
0
        /// <summary>
        /// Handle scene entry
        /// </summary>
        public override void Enter()
        {
            base.Enter();

            RB.SpriteSheetSetup(0, "Demos/DemoReel/Sprites", new Vector2i(16, 16));
            RB.SpriteSheetSet(0);

            RB.EffectReset();

            mMap = RB.MapLoadTMX("Demos/DemoReel/Tilemap");

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

                RB.MapLoadTMXLayer(mMap, "Clouds", 0);
                RB.MapLoadTMXLayer(mMap, "Decoration", 1);
                RB.MapLoadTMXLayer(mMap, "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";
        }
Example #8
0
        /// <summary>
        /// Handle scene entry
        /// </summary>
        public override void Enter()
        {
            base.Enter();

            RB.SpriteSheetSetup(0, "Demos/DemoReel/DemoSpritePack", new Vector2i(16, 16));
            RB.SpriteSheetSetup(1, "Demos/DemoReel/Sprites", new Vector2i(16, 16));
            RB.SpriteSheetSetup(2, "Demos/DemoReel/DemoSpritePack", new Vector2i(8, 8));
            RB.SpriteSheetSet(0);

            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");

            if (mSpriteHero1.Size.x == 0)
            {
                mBadSpritepack = true;
                return;
            }

            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);

            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(':');

            RB.FontSetup(0, chars, glyphs, 0, 1, 1, true);

            var mapping = new string[16];

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

            var tinyMap = RB.MapLoadTMX("Demos/DemoReel/TinyMap");

            RB.MapLoadTMXLayer(tinyMap, "Terrain", 1, mapping);
            RB.MapLayerSpriteSheetSet(1, 2);
        }