public void LoadTutorialLevel(int index) { string path = "Tutorial"; totems[0] = new Totem(); totems[0].BuildFromFile(path + "/Tutorial_1"); totems[1] = new Totem(); totems[1].BuildFromFile(path + "/Tutorial_2"); totems[2] = new Totem(); totems[2].BuildFromFile(path + "/Tutorial_3"); totems[0].HidePowerUp(); totems[1].HidePowerUp(); totems[2].HidePowerUp(); int maxIndex = 3; if (index == 0) { maxIndex = 2; } for (int i = 0; i < maxIndex; ++i) { SoundEffectInstance musicL1 = SoundEffectLibrary.Get("music_T" + index + "P" + (i + 1) + "L1").CreateInstance(); SoundEffectInstance musicL2 = SoundEffectLibrary.Get("music_T" + index + "P" + (i + 1) + "L2").CreateInstance(); SoundEffectInstance musicL3 = SoundEffectLibrary.Get("music_T" + index + "P" + (i + 1) + "L3").CreateInstance(); SoundEffectInstance musicL4 = SoundEffectLibrary.Get("music_T" + index + "P" + (i + 1) + "L4").CreateInstance(); musics[i] = new DynamicMusic(musicL1, musicL2, musicL3, musicL4); } PlaceTotems(); }
public void LoadRandomLevel() { totems[0] = new Totem(); totems[0].AddSections(new SectionData(typeof(NormalSection), 0, 0, 10)); totems[0].AddSections(new SectionData(typeof(MetalSection), 8, 8, 4)); totems[0].AddSections(new SectionData(typeof(SpikeSection), 4, 4, 2)); totems[0].BuildRandom(); totems[1] = new Totem(); totems[1].AddSections(new SectionData(typeof(NormalSection), 0, 0, 10)); totems[1].AddSections(new SectionData(typeof(MetalSection), 8, 8, 4)); totems[1].AddSections(new SectionData(typeof(SpikeSection), 4, 4, 2)); totems[1].BuildRandom(); totems[2] = new Totem(); totems[2].AddSections(new SectionData(typeof(NormalSection), 0, 0, 10)); totems[2].AddSections(new SectionData(typeof(MetalSection), 8, 8, 4)); totems[2].AddSections(new SectionData(typeof(SpikeSection), 4, 4, 2)); totems[2].BuildRandom(); for (int i = 0; i < 3; ++i) { SoundEffectInstance musicL1 = SoundEffectLibrary.Get("music_T1P" + (i + 1) + "L1").CreateInstance(); SoundEffectInstance musicL2 = SoundEffectLibrary.Get("music_T1P" + (i + 1) + "L2").CreateInstance(); SoundEffectInstance musicL3 = SoundEffectLibrary.Get("music_T1P" + (i + 1) + "L3").CreateInstance(); SoundEffectInstance musicL4 = SoundEffectLibrary.Get("music_T1P" + (i + 1) + "L4").CreateInstance(); musics[i] = new DynamicMusic(musicL1, musicL2, musicL3, musicL4); } PlaceTotems(); }
public MenuScreen() { isActive = false; isHidden = true; canLauchChallenge = false; menuSound = SoundEffectLibrary.Get("cursor").CreateInstance(); m_sprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("menu_start_bg"), m_transform); m_sprite.Transform.Position = outPos; arrow = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("arrow"), new Transform(m_transform, true)); moveTo = new MoveToStaticAction(Program.TheGame, m_transform, inPos, 1); moveTo.StartPosition = new Vector2(80, 200); moveTo.Interpolator = new PSmoothstepInterpolation(); moveTo.Timer.Interval = 0.5f; moveOut = new MoveToStaticAction(Program.TheGame, m_transform, outPos, 1); moveOut.StartPosition = inPos; moveOut.Interpolator = new PSmoothstepInterpolation(); moveOut.Timer.Interval = 0.5f; choice = MenuState.START; challengeChoice = ChallengeState.CHALL_1; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { TextureLibrary.LoadContent(Content, "Textures"); TextureLibrary.Initialise(GraphicsDevice); Explosion.InitialiseIndexes(); debugText = Content.Load <SpriteFont>("Text/Debug"); menuText = Content.Load <SpriteFont>("Text/Menu"); SoundEffectLibrary.LoadContent(Content, "SoundEffects"); m_drawer = new GameboyDrawer(this); GameCamera = new Camera2D(new Vector2(GameboyWidth * 0.5f, GameboyHeight * 0.5f)); GameCamera.ScaleToZoom = true; // Totem // //LoadLevel(1); //totems[0] = new Totem(); ////testTotem.BuildFromFile("Level1_p1"); //totems[0].AddSections(new SectionData(typeof(NormalSection), 0, 0, 30)); //totems[0].AddSections(new SectionData(typeof(MetalSection), 10, 10, 7)); //totems[0].AddSections(new SectionData(typeof(SpikeSection), 4, 4, 7)); //totems[0].BuildRandom(); //totems[0].Transform.PosX = 100; // Player initialisation // player = new Player(); // Pause screen & GUI initialisation // menuScreen = new MenuScreen(); pauseScreen = new PauseScreen(); startingCountdown = new Countdown(); scoreBorder = new ScoreBorder(); mapBorder = new MapBorder(); comboCounter = new ComboCounter(player); scoreDisplay = new ScoreDisplay(); // Background textures // m_falaise = new Sprite(this, TextureLibrary.GetSpriteSheet("decors_sol_falaise"), new Transform()); m_falaise.Origin = new Vector2(0, 0.32f); m_falaise.Transform.PosX = -235; m_falaise.Transform.PosY = 8; // Sound & musics // normalTotemCollisionSound_Channel1 = SoundEffectLibrary.Get("normal_collision_sound").CreateInstance(); normalTotemCollisionSound_Channel1.Volume = 0.6f; normalTotemCollisionSound_Channel2 = SoundEffectLibrary.Get("normal_collision_sound").CreateInstance(); normalTotemCollisionSound_Channel2.Volume = 0.6f; metalTotemCollisionSound_Channel1 = SoundEffectLibrary.Get("metal_collision_sound").CreateInstance(); metalTotemCollisionSound_Channel2 = SoundEffectLibrary.Get("metal_collision_sound").CreateInstance(); swordSlashSound = SoundEffectLibrary.Get("sword_slash").CreateInstance(); moveLeftToRightSound = SoundEffectLibrary.Get("move_left_to_right").CreateInstance(); moveLeftToRightSound.Volume = 0.6f; moveRightToLeftSound = SoundEffectLibrary.Get("move_right_to_left").CreateInstance(); moveRightToLeftSound.Volume = 0.6f; spikeHitSound = SoundEffectLibrary.Get("spike_hit").CreateInstance(); groundImpact = SoundEffectLibrary.Get("ground_slam").CreateInstance(); footsteps = SoundEffectLibrary.Get("footsteps").CreateInstance(); footsteps.IsLooped = true; menuMusic = SoundEffectLibrary.Get("music_menu").CreateInstance(); successJingle = SoundEffectLibrary.Get("success_jingle").CreateInstance(); feedback_powerUp = SoundEffectLibrary.Get("feedback_powerup").CreateInstance(); feedback_combo3 = SoundEffectLibrary.Get("feedback_combo3").CreateInstance(); feedback_combo3.Volume = 0.2f; feedback_combo6 = SoundEffectLibrary.Get("feedback_combo6").CreateInstance(); feedback_combo6.Volume = 0.3f; feedback_combo9 = SoundEffectLibrary.Get("feedback_combo9").CreateInstance(); feedback_combo9.Volume = 0.4f; feedback_comboBreaker = SoundEffectLibrary.Get("feedback_comboBreaker").CreateInstance(); feedbackLock = true; isComboBreakerSoundPossible = false; musicT4P1L1 = SoundEffectLibrary.Get("music_T4P1L1").CreateInstance(); musicT4P1L2 = SoundEffectLibrary.Get("music_T4P1L2").CreateInstance(); musicT4P1L3 = SoundEffectLibrary.Get("music_T4P1L3").CreateInstance(); musicT4P1L4 = SoundEffectLibrary.Get("music_T4P1L4").CreateInstance(); musicT4P2L1 = SoundEffectLibrary.Get("music_T4P2L1").CreateInstance(); musicT4P2L2 = SoundEffectLibrary.Get("music_T4P2L2").CreateInstance(); musicT4P2L3 = SoundEffectLibrary.Get("music_T4P2L3").CreateInstance(); musicT4P2L4 = SoundEffectLibrary.Get("music_T4P2L4").CreateInstance(); musicT4P3L1 = SoundEffectLibrary.Get("music_T4P3L1").CreateInstance(); musicT4P3L2 = SoundEffectLibrary.Get("music_T4P3L2").CreateInstance(); musicT4P3L3 = SoundEffectLibrary.Get("music_T4P3L3").CreateInstance(); musicT4P3L4 = SoundEffectLibrary.Get("music_T4P3L4").CreateInstance(); //dynamicMusic = new DynamicMusic(musicT1P1L1, musicT1P1L2, musicT1P1L3, musicT1P1L4); //dynamicMusic = new DynamicMusic(musicT1P2L1, musicT1P2L2, musicT1P2L3, musicT1P2L4); //dynamicMusic = new DynamicMusic(musicT4P2L1, musicT4P2L2, musicT4P2L3, musicT4P2L4); //dynamicMusic = new DynamicMusic(musicT4P3L1, musicT4P3L2, musicT4P3L3, musicT4P3L4); //Foule et joueur porté Cutscenes.Initalise(); Cutscenes.Intro(); SetupNextLevel(); }
public CutscenePlayer() : base() { m_ascendSound = SoundEffectLibrary.Get("ascend").CreateInstance(); m_cloud = new Prop("cloud"); m_sword = new Prop("sword"); m_shlingSprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("shling"), new Transform(m_transform, true)); m_sprite = new PastaGameLibrary.Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("player_cutscene", 1, 4), new Transform(m_transform, true)); m_sprite.Origin = new Vector2(0.5f, 0.5f); m_sprite.PixelCorrection = false; m_moveToCrowd = new MoveToTransform(Program.TheGame, m_transform, null, null, 1); m_moveToCrowd.Timer.Interval = 0.1f; MoveToStaticAction carryMovement = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(0, CarryHeight - 5), 1); carryMovement.Interpolator = new PBounceInterpolation(1.0f); carryMovement.StartPosition = new Vector2(0, CarryHeight); carryMovement.Timer.Interval = 0.2f; MethodAction action = new MethodAction(delegate() { carryMovement.StartPosition = new Vector2(0, CarryHeight); }); Sequence bounceAnimation = new Sequence(-1); bounceAnimation.AddAction(carryMovement); bounceAnimation.AddAction(action); m_carryAnimation = new Sequence(1); m_carryAnimation.AddAction(m_moveToCrowd); m_carryAnimation.AddAction(bounceAnimation); //Sword movement Transform start = new Transform(m_transform, true); Transform end = new Transform(m_transform, true); m_swordMovement = new MoveToTransform(Program.TheGame, m_sword.Transform, start, end, 1); end.PosX = SwordOffsetToPlayerX; end.PosY = SwordOffsetToPlayerY; m_swordDelay = new DelayAction(Program.TheGame, AscendDuration * SwordStartTimeRatio); //Cloud movement m_cloudMovement = new MoveToStaticAction(Program.TheGame, m_cloud.Transform, new Vector2(CloudOffsetToPlayerX, CloudOffsetToPlayerY), 1); m_cloudMovement.StartPosition = new Vector2(CloudStartX, 0); m_cloudMovement.Interpolator = new PSquareInterpolation(0.25f); //Delay of the ascend, then sword/cloud movement Sequence swordAndCloudMovement = new Sequence(1); swordAndCloudMovement.AddAction(m_swordDelay); swordAndCloudMovement.AddAction(new Concurrent(new PastaGameLibrary.Action[] { m_swordMovement, m_cloudMovement })); m_ascendMovement = new MoveToTransform(Program.TheGame, m_transform, new Transform(), new Transform(), 1); m_ascendMovement.Interpolator = new PSquareInterpolation(0.5f); MethodAction showPlayer = new MethodAction(delegate() { m_sprite.Transform.PosY -= 1; Game1.player.ShowPlayer(); isVisible = false; m_cloud.IsVisible = false; m_sword.IsVisible = false; }); //Shling! ScaleToAction shlingScale = new ScaleToAction(Program.TheGame, m_shlingSprite.Transform, new Vector2(ShlingScale, ShlingScale), 1); shlingScale.Timer.Interval = ShlingTime; shlingScale.StartScale = Vector2.Zero; shlingScale.Interpolator = new PSquareInterpolation(2); RotateToStaticAction shlingRotate = new RotateToStaticAction(Program.TheGame, m_shlingSprite.Transform, ShlingSpin, 1); shlingRotate.Timer.Interval = ShlingTime; m_shling = new Concurrent(new PastaGameLibrary.Action[] { shlingScale, shlingRotate }); Sequence readyAnim = new Sequence(1); readyAnim.AddAction(new DelayAction(Program.TheGame, 0.5f)); readyAnim.AddAction(new MethodAction(delegate() { Cutscenes.GetReady(); SoundEffectLibrary.Get("sword_slash").Play(); })); Concurrent shlingReady = new Concurrent(new PastaGameLibrary.Action[] { m_shling, readyAnim, }); m_ascend = new Sequence(1); m_ascend.AddAction(new DelayAction(Program.TheGame, Crowd.LaunchTensionTime)); m_ascend.AddAction(new MethodAction(delegate() { m_ascendSound.Play(); })); Concurrent ascendAndSword = new Concurrent(new PastaGameLibrary.Action[] { m_ascendMovement, swordAndCloudMovement }); m_ascend.AddAction(ascendAndSword); m_ascend.AddAction(showPlayer); m_ascend.AddAction(shlingReady); m_physics = new PhysicsComponent(Program.TheGame, m_transform); m_physics.Mass = 3.0f; m_jumpFromTotem = new Sequence(1); m_decelerate = new MoveToStaticAction(Program.TheGame, m_transform, Vector2.Zero, 1); m_decelerate.Interpolator = new PSquareInterpolation(0.5f); m_jumpFromTotem.AddAction(m_decelerate); m_jumpFromTotem.AddAction(new DelayAction(Program.TheGame, 0.2f)); m_jumpFromTotem.AddAction(new MethodAction(delegate() { m_physics.OnBounce = null; m_physics.Throw(1.0f, -2.0f, 0); Game1.CurrentMusic.StopDynamicMusic(); SoundEffectLibrary.Get("sword_slash").Play(); })); m_jumpFromTotem.AddAction(new DelayAction(Program.TheGame, 0.75f)); m_jumpFromTotem.AddAction(new MethodAction(delegate() { Game1.SetupNextRound(); if (Game1.CurrentTotem == null) { Cutscenes.GoToCliff(); } else { Cutscenes.GoToTotem(Game1.CurrentTotem, 1.0f, 0); } })); m_actionManager = new SingleActionManager(); m_hitSpikes = new Sequence(1); m_moveToCrashingPlayer = new MoveToTransform(Program.TheGame, Game1.GameCamera.Transform, new Transform(), new Transform(), 1); m_moveToCrashingPlayer.Timer.Interval = 0.2f; m_hitSpikes.AddAction(new DelayAction(Program.TheGame, 1.0f)); m_hitSpikes.AddAction(m_moveToCrashingPlayer); m_hitSpikes.AddAction(new DelayAction(Program.TheGame, 0.5f)); m_hitSpikes.AddAction(new MethodAction(delegate() { if (Game1.CurrentTotem == null) { Cutscenes.GoToCliff(); } else { Cutscenes.GoToTotem(Game1.CurrentTotem, 1.0f, 0); } m_sprite.SetFrame(0); m_physics.OnBounce = null; m_physics.Throw(0, -3, 0); m_transform.PosY = m_physics.GroundLevel; })); m_auraParticles = new ParticleSystem(Program.TheGame, 100); m_soulParticles = new ParticleSystem(Program.TheGame, 500); m_levitate = new Sequence(1); m_moveToCliffTip = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(Cutscenes.InitialCharacterPosition + 10, -8), 1); m_moveToCliffTip.Interpolator = new PSmoothstepInterpolation(); m_moveToCliffTip.Timer.Interval = 1.0f; m_levitate.AddAction(m_moveToCliffTip); m_levitate.AddAction(new MethodAction(delegate() { m_generateSouls = true; })); m_particleGenerator = new ParticleGenerator <GlitterParticle>(Program.TheGame, m_auraParticles); m_particleGenerator.Automatic = true; m_particleGenerator.GenerationInterval = 0.01f; m_soulParticleGenerator = new ParticleGenerator <SoulParticle>(Program.TheGame, m_soulParticles); m_jumpInMouth = new Sequence(1); m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.5f)); m_jumpInMouth.AddAction(new MethodAction(delegate() { m_generateSouls = false; })); m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.5f)); m_jumpInMouth.AddAction(new MethodAction(delegate() { JumpInMonsterMouth(); })); m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 0.25f)); m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.monster.CloseMouth(); })); m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 2.0f)); m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.crowd.PushNewGuy(); })); m_jumpInMouth.AddAction(new DelayAction(Program.TheGame, 1.0f)); m_jumpInMouth.AddAction(new MethodAction(delegate() { Cutscenes.StartMainMenu(); })); }