コード例 #1
0
 public ParticleEmitter(GSPlay gsPlay, AnimatedSprite particle, Vector2 position)
 {
     this.gsPlay = gsPlay;
     this.particle = particle;
     this.position = position;
     spawnCounter = Mathness.RandomNumber(0, spawnRate);
 }
コード例 #2
0
ファイル: GSPlay.cs プロジェクト: jacobnelson/WorldsApart
        public void AddSpinningFireParticle(Vector2 position)
        {
            float angle = Mathness.RandomNumber(0, (float)Math.PI * 2);

            AnimatedSprite particle2 = new AnimatedSprite(LoadTexture("GameObjects/orangeFire"), position);
            CircularEmitter pe2 = AddCircularEmitter(particle2, position);
            pe2.fadeInOut = true;
            pe2.startAlpha = 0;
            pe2.endAlpha = 128;
            pe2.startScale = 3;
            pe2.endScale = 4;
            pe2.spawnRate = 1;
            pe2.color = Color.Orange;
            pe2.randomDisplacement = new Vector2(10, 8);
            pe2.randomSpeedX = new Vector2(-.25f, .25f);
            pe2.randomSpeedY = new Vector2(-.6f, -.4f);
            pe2.life = 30;
            pe2.selfIlluminated = true;
            pe2.angle = angle;

            AnimatedSprite particle3 = new AnimatedSprite(LoadTexture("GameObjects/orangeFire"), position);
            CircularEmitter pe3 = AddCircularEmitter(particle3, position);
            pe3.fadeInOut = true;
            pe3.startAlpha = 0;
            pe3.endAlpha = 128;
            pe3.startScale = 3;
            pe3.endScale = 4;
            pe3.spawnRate = 1;
            pe3.color = Color.Orange;
            pe3.randomDisplacement = new Vector2(10, 8);
            pe3.randomSpeedX = new Vector2(-.25f, .25f);
            pe3.randomSpeedY = new Vector2(-.6f, -.4f);
            pe3.life = 30;
            pe3.selfIlluminated = true;
            pe3.angle = (float)Math.PI;

            AnimatedSprite particle = new AnimatedSprite(LoadTexture("GameObjects/whiteFire"), position);
            CircularEmitter pe = AddCircularEmitter(particle, position);
            pe.startAlpha = 0;
            pe.endAlpha = 255;
            pe.fadeInOut = true;
            pe.startScale = 2f;
            pe.endScale = 2.5f;
            pe.spawnRate = 5;
            pe.life = 40;
            pe.color = new Color(255, 242, 93);
            pe.randomDisplacement = new Vector2(5, 5);
            pe.selfIlluminated = true;
            pe.angle = angle;

            AnimatedSprite particle4 = new AnimatedSprite(LoadTexture("GameObjects/whiteFire"), position);
            CircularEmitter pe4 = AddCircularEmitter(particle4, position);
            pe4.startAlpha = 0;
            pe4.endAlpha = 255;
            pe4.fadeInOut = true;
            pe4.startScale = 2f;
            pe4.endScale = 2.5f;
            pe4.spawnRate = 5;
            pe4.life = 40;
            pe4.color = new Color(255, 242, 93);
            pe4.randomDisplacement = new Vector2(5, 5);
            pe4.selfIlluminated = true;
            pe4.angle = (float)Math.PI;
        }
コード例 #3
0
ファイル: GSPlay.cs プロジェクト: jacobnelson/WorldsApart
        public void AddFireParticle(Vector2 position)
        {
            AnimatedSprite particle2 = new AnimatedSprite(LoadTexture("GameObjects/orangeFire"), position);
            ParticleEmitter pe2 = AddEmitter(particle2, position);
            pe2.fadeInOut = true;
            pe2.startAlpha = 0;
            pe2.endAlpha = 128;
            pe2.startScale = 3;
            pe2.endScale = 4;
            pe2.spawnRate = 1;
            pe2.color = Color.Orange;
            pe2.randomDisplacement = new Vector2(10, 8);
            pe2.randomSpeedX = new Vector2(-.25f, .25f);
            pe2.randomSpeedY = new Vector2(-.6f, -.4f);
            pe2.life = 30;
            pe2.selfIlluminated = true;

            AnimatedSprite particle = new AnimatedSprite(LoadTexture("GameObjects/whiteFire"), position);
            ParticleEmitter pe = AddEmitter(particle, position);
            pe.startAlpha = 0;
            pe.endAlpha = 255;
            pe.fadeInOut = true;
            pe.startScale = 2f;
            pe.endScale = 2.5f;
            pe.spawnRate = 40;
            pe.life = 180;
            pe.color = new Color(255, 242, 93);
            pe.randomDisplacement = new Vector2(5, 5);
            pe.selfIlluminated = true;
        }
コード例 #4
0
ファイル: GSPlay.cs プロジェクト: jacobnelson/WorldsApart
 public ParticleEmitter AddEmitter(AnimatedSprite image, Vector2 position)
 {
     ParticleEmitter emitter = new ParticleEmitter(this, image, position);
     emitterList.Add(emitter);
     return emitter;
 }
コード例 #5
0
ファイル: GSPlay.cs プロジェクト: jacobnelson/WorldsApart
 public CircularEmitter AddCircularEmitter(AnimatedSprite image, Vector2 position)
 {
     CircularEmitter emitter = new CircularEmitter(this, image, position);
     emitterList.Add(emitter);
     return emitter;
 }
コード例 #6
0
ファイル: GSPlay.cs プロジェクト: jacobnelson/WorldsApart
 public Particle AddAnimatedParticle(AnimatedSprite image, Vector2 position, Vector2 speed)
 {
     Particle p = new Particle(image.texture, position);
     p.SetAnimationStuff(image.minRow, image.minCol, image.rows, image.cols, image.cellW, image.cellH, image.frames, image.animationCounter);
     p.speed = speed;
     particleList.Add(p);
     return p;
 }
コード例 #7
0
        public FinalBridge(GSPlay gsPlay)
            : base(gsPlay)
        {
            levelDataTexture = gsPlay.LoadTexture("Levels/bridge");

            //player1Pos = GridToPosition(79, 44);
            player2Pos = GridToPosition(6, 44);
            player1Pos = GridToPosition(131, 44);

            hasPortal = false;

            //portalPos = GridToPosition(681, 20);
            //pItemPos = GridToPosition(672

            SetupLevel();

            rightLimit = levelWidth;

            Vector2 bgPosition = new Vector2(-400, -400);
            SpriteIMG bg1 = new SpriteIMG(gsPlay.LoadTexture("BGs/mountainBackdropBaseBoth"), bgPosition);
            bg1.scale = new Vector2(1.5f);
            gsPlay.AddParallax(bg1, .1f);
            bgPosition = new Vector2(-600, -380);
            SpriteIMG bg2 = new SpriteIMG(gsPlay.LoadTexture("BGs/mountainBackdropOverlayBoth"), bgPosition);
            bg2.scale = new Vector2(2);
            gsPlay.AddParallax(bg2, .2f);

            for (int x = 1; x <= 5; x++)
            {
                for (int y = 1; y <= 2; y++)
                {
                    if (x == 5 && y == 1) continue;

                    SpriteIMG matte = new SpriteIMG(gsPlay.LoadTexture("BGs/bridgeMatte" + x + "x" + y), new Vector2(1024 * (x - 1) - 1078, 1024 * (y - 1) - 100));
                    gsPlay.AddParallax(matte, .5f);

                }
            }

            for (int x = 1; x <= 5; x++)
            {
                for (int y = 1; y <= 3; y++)
                {
                    string fgName = "LevelTiles/Bridge/bridgeFG" + x + "x" + y;
                    if (File.Exists("Content/" + fgName + ".xnb"))
                    {
                        SpriteIMG fg = gsPlay.AddFrontFGTile(gsPlay.LoadTexture(fgName), new Vector2(1024 * (x - 1), 1024 * (y - 1)));
                        fg.origin = Vector2.Zero;
                    }

                    string bgName = "LevelTiles/Bridge/bridgeBG" + x + "x" + y;
                    if (File.Exists("Content/" + bgName + ".xnb"))
                    {
                        SpriteIMG bg = gsPlay.AddBackFGTile(gsPlay.LoadTexture(bgName), new Vector2(1024 * (x - 1), 1024 * (y - 1)));
                        bg.origin = Vector2.Zero;
                    }

                }
            }

            for (int x = 1; x <= 5; x++)
            {
                SpriteIMG cloud = gsPlay.AddFrontFGTile(gsPlay.LoadTexture("LevelTiles/Bridge/clouds" + x + "x1"), new Vector2(1024 * (x - 1), 0));
                cloud.illuminatingAllTheTime = true;
                cloud.origin = Vector2.Zero;
            }

            Vector2 bridgePos = new Vector2(2160, 613.5f);
            gsPlay.AddFrontFGTile(gsPlay.LoadTexture("GameObjects/bridgeFull"), bridgePos);

            atmosphereLight = new Color(100, 100, 100);

            PointLight sun1 = gsPlay.AddPointLight(Art.whitePixel, GridToPosition(0, 0) + new Vector2(0, -200), new Vector2(2048, 1850));
            PointLight sun2 = gsPlay.AddPointLight(Art.whitePixel, GridToPosition(32, 0) + new Vector2(0, -200), new Vector2(2048, 1850));
            PointLight sun3 = gsPlay.AddPointLight(Art.whitePixel, GridToPosition(64, 0) + new Vector2(0, -200), new Vector2(2048, 1850));
            PointLight sun4 = gsPlay.AddPointLight(Art.whitePixel, GridToPosition(96, 0) + new Vector2(0, -200), new Vector2(2048, 1850));
            PointLight sun5 = gsPlay.AddPointLight(Art.whitePixel, GridToPosition(128, 0) + new Vector2(0, -200), new Vector2(2048, 1850));
            sun1.screenCull = false;
            sun2.screenCull = false;
            sun3.screenCull = false;
            sun4.screenCull = false;
            sun5.screenCull = false;

            finalField = gsPlay.AddBackFGTile(gsPlay.LoadTexture("Cutscene/finalField"), new Vector2(2175, 451));
            finalField.visible = false;

            Vector2 introPos = GridToPosition(41, 25) + new Vector2(0, 20);
            player1Ending = new AnimatedSprite(gsPlay.LoadTexture("Cutscene/cutscenePlayers"), introPos);
            player2Ending = new AnimatedSprite(gsPlay.LoadTexture("Cutscene/cutscenePlayers"), introPos);
            player1Ending.SetAnimationStuff(1, 1, 6, 8, 256, 256, 4, 12);
            player2Ending.SetAnimationStuff(1, 5, 6, 8, 256, 256, 4, 12);
            player1Ending.SetPlayerMode(PlayerObjectMode.One);
            player2Ending.SetPlayerMode(PlayerObjectMode.Two);
            gsPlay.frontFGList.Add(player1Ending);
            gsPlay.frontFGList.Add(player2Ending);
            player1Ending.visible = false;
            player2Ending.visible = false;

            player1FadeFrame = new AnimatedSprite(gsPlay.LoadTexture("player1Ideal"), Vector2.Zero);
            player2FadeFrame = new AnimatedSprite(gsPlay.LoadTexture("player2Ideal"), Vector2.Zero);
            player1FadeFrame.SetAnimationStuff(1, 1, 1, 6, 256, 256, 6, 8);
            player2FadeFrame.SetAnimationStuff(1, 1, 1, 6, 256, 256, 6, 8);
            player1FadeFrame.SetPlayerMode(PlayerObjectMode.Two);
            player2FadeFrame.SetPlayerMode(PlayerObjectMode.One);
            gsPlay.frontFGList.Add(player1FadeFrame);
            gsPlay.frontFGList.Add(player2FadeFrame);
            player1FadeFrame.visible = false;
            player2FadeFrame.visible = false;

            TriggerArea update = gsPlay.AddTriggerArea(new EventTrigger(this, 99), Art.smoke, Vector2.Zero);
            update.visible = false;
            gsPlay.AddTriggerArea(new EventTrigger(this, 0), gsPlay.LoadTexture("bridgeBreakTrigger"), GridToPosition(67, 50) + new Vector2(16, 0)).visible = false;

            AudioManager.PlayMusic("Bridge");
        }
コード例 #8
0
ファイル: Level.cs プロジェクト: jacobnelson/WorldsApart
        public void SetupLevel()
        {
            Color[] color1D = new Color[levelDataTexture.Width * levelDataTexture.Height];
            levelDataTexture.GetData(color1D);
            Color[,] colorData = new Color[levelDataTexture.Width, levelDataTexture.Height];
            for (int x = 0; x < levelDataTexture.Width; x++)
                for (int y = 0; y < levelDataTexture.Height; y++)
                    colorData[x, y] = color1D[x + y * levelDataTexture.Width];

            levelWidth = levelDataTexture.Width * collisionSize;
            levelHeight = levelDataTexture.Height * collisionSize;
            deathHeight = levelHeight;
            levelGridSize = new Point(levelDataTexture.Width, levelDataTexture.Height);
            environmentData = new EnvironmentData[levelDataTexture.Width, levelDataTexture.Height];
            for (int x = 0; x < levelDataTexture.Width; x++)
            {
                for (int y = 0; y < levelDataTexture.Height; y++)
                {
                    if (colorData[x, y] == Color.Black)
                    {
                        environmentData[x, y] = new EnvironmentData(true);
                        if (renderCollision)
                        {
                            SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/tile"), GridToPosition(new Point(x, y)));
                            tile.origin = Vector2.Zero;
                            gsPlay.backFGList.Add(tile);
                            gsPlay.AddGroundTile(GridToPosition(new Point(x, y)) + new Vector2(16, 16));
                        }
                    }
                    else if (colorData[x, y] == new Color(0, 0, 255))
                    {
                        environmentData[x, y] = new EnvironmentData(FrictionType.Ice);
                        SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/tile"), GridToPosition(new Point(x, y)));
                        tile.origin = Vector2.Zero;
                        tile.color = new Color(0, 0, 255);
                        gsPlay.backFGList.Add(tile);
                    }
                    else if (colorData[x, y] == new Color(0, 255, 0))
                    {
                        environmentData[x, y] = new EnvironmentData(new Vector2(0, -1f));
                        gsPlay.AddWindEmitter(GridToPosition(x, y) + new Vector2(8, 32), new Vector2(0, -2));
                        //SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/airCurrentUp"), GridToPosition(new Point(x, y)));
                        //tile.origin = Vector2.Zero;
                        //tile.alpha = 128;
                        //gsPlay.backFGList.Add(tile);
                    }
                    else if (colorData[x, y] == new Color(255, 0, 0))
                    {
                        environmentData[x, y] = new EnvironmentData(new Vector2(0, 1f));
                        gsPlay.AddWindEmitter(GridToPosition(x, y) + new Vector2(16, -16), new Vector2(0, 2));
                        //SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/airCurrentDown"), GridToPosition(new Point(x, y)));
                        //tile.origin = Vector2.Zero;
                        //tile.scale = new Vector2(2);
                        //tile.alpha = 128;
                        //gsPlay.backFGList.Add(tile);
                    }
                    else if (colorData[x, y] == new Color(255, 255, 0))
                    {
                        environmentData[x, y] = new EnvironmentData(new Vector2(4, 0));
                        gsPlay.AddWindEmitter(GridToPosition(x, y) + new Vector2(-16, 16), new Vector2(2, 0));
                        //SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/airCurrentRight"), GridToPosition(new Point(x, y)));
                        //tile.origin = Vector2.Zero;
                        //tile.alpha = 128;
                        //tile.scale = new Vector2(2);
                        //gsPlay.frontFGList.Add(tile);
                    }
                    else if (colorData[x, y] == new Color(0, 255, 255))
                    {
                        environmentData[x, y] = new EnvironmentData(new Vector2(-4, 0));
                        gsPlay.AddWindEmitter(GridToPosition(x, y) + new Vector2(48, 16), new Vector2(-2, 0));
                        //SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/airCurrentLeft"), GridToPosition(new Point(x, y)));
                        //tile.origin = Vector2.Zero;
                        //tile.alpha = 128;
                        //tile.scale = new Vector2(2);
                        //gsPlay.frontFGList.Add(tile);
                    }
                    else if (colorData[x, y] == new Color(255, 255, 150))
                    {
                        environmentData[x, y] = new EnvironmentData(InclineType.ThreeTileRight1, FrictionType.Normal);
                        if (renderCollision)
                        {
                            SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/tileInclineThreeRight1"), GridToPosition(new Point(x, y)));
                            tile.origin = Vector2.Zero;
                            gsPlay.backFGList.Add(tile);
                        }
                    }
                    else if (colorData[x, y] == new Color(255, 255, 100))
                    {
                        environmentData[x, y] = new EnvironmentData(InclineType.ThreeTileRight2, FrictionType.Normal);
                        if (renderCollision)
                        {
                            SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/tileInclineThreeRight2"), GridToPosition(new Point(x, y)));
                            tile.origin = Vector2.Zero;
                            gsPlay.backFGList.Add(tile);
                        }
                    }
                    else if (colorData[x, y] == new Color(255, 255, 50))
                    {
                        environmentData[x, y] = new EnvironmentData(InclineType.ThreeTileRight3, FrictionType.Normal);
                        if (renderCollision)
                        {
                            SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/tileInclineThreeRight3"), GridToPosition(new Point(x, y)));
                            tile.origin = Vector2.Zero;
                            gsPlay.backFGList.Add(tile);
                        }
                    }
                    else if (colorData[x, y] == new Color(50, 255, 255))
                    {
                        environmentData[x, y] = new EnvironmentData(InclineType.ThreeTileLeft1, FrictionType.Normal);
                        if (renderCollision)
                        {
                            SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/tileInclineThreeLeft1"), GridToPosition(new Point(x, y)));
                            tile.origin = Vector2.Zero;
                            gsPlay.backFGList.Add(tile);
                        }
                    }
                    else if (colorData[x, y] == new Color(100, 255, 255))
                    {
                        environmentData[x, y] = new EnvironmentData(InclineType.ThreeTileLeft2, FrictionType.Normal);
                        if (renderCollision)
                        {
                            SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/tileInclineThreeLeft2"), GridToPosition(new Point(x, y)));
                            tile.origin = Vector2.Zero;
                            gsPlay.backFGList.Add(tile);
                        }
                    }
                    else if (colorData[x, y] == new Color(150, 255, 255))
                    {
                        environmentData[x, y] = new EnvironmentData(InclineType.ThreeTileLeft3, FrictionType.Normal);
                        if (renderCollision)
                        {
                            SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/tileInclineThreeLeft3"), GridToPosition(new Point(x, y)));
                            tile.origin = Vector2.Zero;
                            gsPlay.backFGList.Add(tile);
                        }
                    }
                    else if (colorData[x, y] == new Color(64, 255, 255))
                    {
                        environmentData[x, y] = new EnvironmentData(InclineType.TwoTileLeft1, FrictionType.Normal);
                        if (renderCollision)
                        {
                            SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/tileInclineTwoLeft1"), GridToPosition(new Point(x, y)));
                            tile.origin = Vector2.Zero;
                            gsPlay.backFGList.Add(tile);
                        }
                    }
                    else if (colorData[x, y] == new Color(128, 255, 255))
                    {
                        environmentData[x, y] = new EnvironmentData(InclineType.TwoTileLeft2, FrictionType.Normal);
                        if (renderCollision)
                        {
                            SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/tileInclineTwoLeft2"), GridToPosition(new Point(x, y)));
                            tile.origin = Vector2.Zero;
                            gsPlay.backFGList.Add(tile);
                        }
                    }
                    else if (colorData[x, y] == new Color(255, 255, 128))
                    {
                        environmentData[x, y] = new EnvironmentData(InclineType.TwoTileRight1, FrictionType.Normal);
                        if (renderCollision)
                        {
                            SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/tileInclineTwoRight1"), GridToPosition(new Point(x, y)));
                            tile.origin = Vector2.Zero;
                            gsPlay.backFGList.Add(tile);
                        }
                    }
                    else if (colorData[x, y] == new Color(255, 255, 64))
                    {
                        environmentData[x, y] = new EnvironmentData(InclineType.TwoTileRight2, FrictionType.Normal);
                        if (renderCollision)
                        {
                            SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/tileInclineTwoRight2"), GridToPosition(new Point(x, y)));
                            tile.origin = Vector2.Zero;
                            gsPlay.backFGList.Add(tile);
                        }
                    }
                    else if (colorData[x, y] == new Color(50, 50, 50))
                    {
                        environmentData[x, y] = new EnvironmentData(true);
                        environmentData[x, y].oneWayPlatform = true;
                        if (renderCollision)
                        {
                            SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/jumpThru"), GridToPosition(new Point(x, y)));
                            tile.origin = Vector2.Zero;
                            gsPlay.backFGList.Add(tile);
                        }
                    }
                    else if (colorData[x, y] == new Color(255, 128, 255))
                    {
                        environmentData[x, y] = new EnvironmentData(false);
                        environmentData[x, y].checkpoint = true;
                        SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/checkpoint"), GridToCenterPosition(new Point(x, y)));
                        tile.scale = new Vector2(1.5f);
                        gsPlay.backFGList.Add(tile);
                    }
                    else if (colorData[x, y] == new Color(255, 128, 0))
                    {
                        environmentData[x, y] = new EnvironmentData(false);
                        environmentData[x, y].killZone = true;
                        //SpriteIMG tile = new SpriteIMG(gsPlay.LoadTexture("TestSprites/killZone"), GridToPosition(new Point(x, y)));
                        //tile.origin = Vector2.Zero;
                        //gsPlay.backFGList.Add(tile);
                        //gsPlay.AddFireParticle(GridToCenterPosition(x, y));
                    }
                    else if (colorData[x, y] == new Color(255, 128, 1))
                    {
                        environmentData[x, y] = new EnvironmentData(false);
                        environmentData[x, y].killZone = true;
                        gsPlay.AddFireParticle(GridToCenterPosition(x, y));
                    }
                    else if (colorData[x, y] == new Color(255, 128, 2))
                    {
                        environmentData[x, y] = new EnvironmentData(false);
                        environmentData[x, y].killZone = true;
                        gsPlay.AddSpinningFireParticle(GridToCenterPosition(x, y));
                    }
                    else
                    {
                        environmentData[x, y] = new EnvironmentData(false);
                    }
                }
            }

            gsPlay.player1 = new Player(gsPlay, PlayerObjectMode.One, gsPlay.LoadTexture("player1"), player1Pos);
            gsPlay.player1.SetAnimationStuff(1, 1, 8, 8, 256, 256, 64, 5);
            gsPlay.player1.SetCollisionBox(48, 96, Vector2.Zero);
            gsPlay.player2 = new Player(gsPlay, PlayerObjectMode.Two, gsPlay.LoadTexture("player2"), player2Pos);
            gsPlay.player2.SetAnimationStuff(1, 1, 8, 8, 256, 256, 64, 5);
            gsPlay.player2.SetCollisionBox(48, 96, Vector2.Zero);

            player1Checkpoint = gsPlay.AddBGParticle(gsPlay.LoadTexture("TestSprites/checkpointWarm"), new Vector2(-64, -64));
            player1Checkpoint.SetPlayerMode(PlayerObjectMode.One);
            player1Checkpoint.scale = new Vector2(1.5f);
            player1Checkpoint.canDie = false;
            player1Checkpoint.illuminatingAllTheTime = true;
            player2Checkpoint = gsPlay.AddBGParticle(gsPlay.LoadTexture("TestSprites/checkpointCool"), new Vector2(-64, -64));
            player2Checkpoint.SetPlayerMode(PlayerObjectMode.Two);
            player2Checkpoint.scale = new Vector2(1.5f);
            player2Checkpoint.canDie = false;
            player2Checkpoint.illuminatingAllTheTime = true;

            if (hasPortal)
            {
                glados = gsPlay.AddPortal(new EventTrigger(this, 0), gsPlay.LoadTexture("TestSprites/portal"), portalPos);
                glados.SetAnimationStuff(2, 1, 2, 8, 96, 192, 8, 5);
                PortalItem goody = new PortalItem(new EventTrigger(this, glados), gsPlay.LoadTexture("TestSprites/Cursor"), pItemPos);
                gsPlay.areaList.Add(goody);
                goody.SetCollisionBox(32, 32, Vector2.Zero);
                goody.visible = false;
                GlyphEmitter ge = new GlyphEmitter(gsPlay, Art.portalItem1, pItemPos);
                ge.AddTexture(Art.portalItem2);
                ge.AddTexture(Art.portalItem3);
                ge.AddTexture(Art.portalItem4);
                ge.AddTexture(Art.portalItem5);
                ge.selfIlluminated = true;
                ge.startAlpha = 0;
                ge.endAlpha = 255;
                ge.fadeInOut = true;
                ge.startScale = .75f;
                ge.endScale = 1.25f;
                ge.spawnRate = 10;
                ge.life = 40;
                //ge.randomDisplacement = new Vector2(8, 8);
                ge.randomSpeedX = new Vector2(-.75f, .75f);
                ge.randomSpeedY = new Vector2(-.75f, .75f);
                gsPlay.emitterList.Add(ge);
                goody.emitter = ge;

                AnimatedSprite pulseSprite = new AnimatedSprite(Art.portalPulse);
                ParticleEmitter pulse = gsPlay.AddEmitter(pulseSprite, glados.position);
                pulse.bgParticles = true;
                pulse.color = new Color(128, 0, 0);
                pulse.startScale = 1;
                pulse.endScale = 2;
                pulse.startAlpha = 255;
                pulse.endAlpha = 0;
                pulse.randomRotation = false;
                pulse.rotationSpeed = 0;
                pulse.spawnRate = 30;
                pulse.life = 60;
                glados.pulse = pulse;

                LightningChain portalLightning = gsPlay.AddLightning(glados.position + new Vector2(0, -48), glados.position + new Vector2(20, -27), Color.Red);
                portalLightning.AddVertex(glados.position + new Vector2(20, 27));
                portalLightning.AddVertex(glados.position + new Vector2(0, 48));
                portalLightning.AddVertex(glados.position + new Vector2(-20, 27));
                portalLightning.AddVertex(glados.position + new Vector2(-20, -27));
                portalLightning.AddVertex(glados.position + new Vector2(0, -48));
                portalLightning.SetActive(true);
                portalLightning.defaultActive = true;
                goody.AddEvent(new EventTrigger(this, portalLightning));
                //40x55

                List<Particle> particleList = new List<Particle>();
                for (int i = 1; i <= 6; i++)
                {
                    Particle p = gsPlay.AddParticle(Art.sparkle, Vector2.Zero);
                    p.canDie = false;
                    if (i % 2 == 0) p.color = new Color(246, 133, 23);
                    else p.color = new Color(145, 127, 185);
                    p.alpha = 128;
                    particleList.Add(p);
                }
                PortalParticles pp = new PortalParticles(gsPlay, particleList);
                pp.AddVertex(glados.position + new Vector2(0, -53));
                pp.AddVertex(glados.position + new Vector2(25, -27));
                pp.AddVertex(glados.position + new Vector2(25, 27));
                pp.AddVertex(glados.position + new Vector2(0, 53));
                pp.AddVertex(glados.position + new Vector2(-25, 27));
                pp.AddVertex(glados.position + new Vector2(-25, -27));
                pp.SetUpParticles();
                pp.Deactivate();
                gsPlay.ppList.Add(pp);
                goody.AddEvent(new EventTrigger(this, pp));

            }

            gsPlay.cameraPlayer1 = new Camera(gsPlay.player1, gsPlay.player2, Vector2.Zero);
            gsPlay.cameraPlayer2 = new Camera(gsPlay.player2, gsPlay.player1, Vector2.Zero);

            if (glados != null)
            {
                gsPlay.cameraPlayer1.AddTarget(glados);
                gsPlay.cameraPlayer2.AddTarget(glados);
            }
        }
コード例 #9
0
ファイル: Level1.cs プロジェクト: jacobnelson/WorldsApart
        public void StartIntro()
        {
            GSOverlay.words1.visible = true;
            GSOverlay.words2.visible = true;
            GSOverlay.words3.visible = true;
            GSOverlay.words4.visible = true;
            GSOverlay.words5.visible = true;
            GSOverlay.words6.visible = true;
            GSOverlay.words1.alpha = 0;
            GSOverlay.words2.alpha = 0;
            GSOverlay.words3.alpha = 0;
            GSOverlay.words4.alpha = 0;
            GSOverlay.words5.alpha = 0;
            GSOverlay.words6.alpha = 0;

            gsPlay.player1.superStopInput = true;
            gsPlay.player2.superStopInput = true;
            gsPlay.player1.visible = false;
            gsPlay.player2.visible = false;
            gsPlay.alphaDot.visible = false;

            Vector2 introPos = GridToPosition(41, 25) + new Vector2(0, 20);
            player1Intro = new AnimatedSprite(gsPlay.LoadTexture("Cutscene/cutscenePlayers"), introPos);
            player2Intro = new AnimatedSprite(gsPlay.LoadTexture("Cutscene/cutscenePlayers"), introPos);

            player2Intro.SetAnimationStuff(1, 1, 3, 8, 256, 256, 4, 12);
            player1Intro.SetAnimationStuff(1, 5, 3, 8, 256, 256, 4, 12);

            player1Intro.SetPlayerMode(PlayerObjectMode.One);
            player2Intro.SetPlayerMode(PlayerObjectMode.Two);

            gsPlay.frontFGList.Add(player1Intro);
            gsPlay.frontFGList.Add(player2Intro);

            gsPlay.PauseInput();
            if (!GameStateManager.isMultiplayer)
            {
                if (Mathness.RandomNumber(1, 2) == 1)
                    gsPlay.playerIndex = PlayerIndex.Two;
                else
                    gsPlay.playerIndex = PlayerIndex.One;
            }
        }
コード例 #10
0
 public InteractiveParticleSet(GSPlay gsPlay, AnimatedSprite sprite)
 {
     this.gsPlay = gsPlay;
 }
コード例 #11
0
 public CircularEmitter(GSPlay gsPlay, AnimatedSprite particle, Vector2 position)
     : base(gsPlay, particle, Vector2.Zero)
 {
     centerPosition = position;
 }
コード例 #12
0
ファイル: OBB.cs プロジェクト: jacobnelson/WorldsApart
 public OBB(Texture2D testTexture, AnimatedSprite image, Vector2 position)
 {
     this.image = image;
     this.position = position;
     this.testTexture = testTexture;
 }