public static void Talk(Entity obj) { tempData.Add("UpArrow", "true"); GameMethods.ShowMessages(new List <MessageBox>() { new MessageBox("Ziggy", "I can't believe you figured it out!", obj.Position + new Vector2(0, -84)), new MessageBox("Ziggy", ".|.|. Well done!", obj.Position + new Vector2(0, -84)) }, true, () => { GameGlobal.PlayerController.MovementEnabled = false; Entity temp = Entity.Find("EarthRock"); CameraController.Instance.Shake(3); Global.AudioController.Play("SFX/EarthRockRumble"); StaticCoroutines.CoroutineHelper.RunOverX(3, 64, t => { temp.Position += new Vector2(0, 1f); }, () => { obj.Destroy(); GameData.Set("EarthRock/First", "2"); temp.Destroy(); GameGlobal.PlayerController.MovementEnabled = true; }); } ); }
public static void First(Entity obj) { if (GameData.Get("EarthRock/First") != null) { obj.Destroy(); return; } GameData.Set("EarthRock/First", "1"); GameMethods.ShowMessages(new List <MessageBox>() { new MessageBox("", "!", obj.Position + new Vector2(0, -64)), new MessageBox("Ziggy", "Hi.|.|.", obj.Position + new Vector2(0, -64)), new MessageBox("Ziggy", "I didn't think you'd survived.|.|.\nYou fell into that tree almost 3 days ago...", obj.Position + new Vector2(0, -64)), new MessageBox("Ziggy", "I'm not sure what this means but I feel implelled\nto tell you that if you want to interact with\nsomething you can press UP!", obj.Position + new Vector2(0, -64)), new MessageBox("Ziggy", "Why don't you try it on me!", obj.Position + new Vector2(16, -32)) }, true, () => { // Input icons if (GameData.Get("Tips/UpToInteract") == null) { GameData.Set("Tips/UpToInteract", "1"); Texture2D texture2D = GameMethods.GetInputIcon(InputManager.Input.Up, Global.InputManager.CurrentInputType); GameMethods.DisplayInputIcon(texture2D, new Vector2(119 * 16 + 8, 57 * 16 + 2), () => { return(false); }); GameMethods.DisplayInputIcon(texture2D, Entity.Find("EarthRock").Position + new Vector2(-8, 32 + 2), () => { return(tempData.ContainsKey("UpArrow")); }); } } ); }
public static void Save() { // Specific to this game GameData.Set("Player/Position", GameGlobal.Player.Position.X.ToString() + "," + GameGlobal.Player.Position.Y.ToString()); string SaveString = ""; foreach (KeyValuePair <string, string> item in Data) { SaveString += item.Key + Format_KVSeperator + item.Value + Format_UnitSeperator; } SaveString = SaveString.TrimEnd(Format_UnitSeperator.ToCharArray()); // Saving needs sorting depending on device and save slot System.IO.File.WriteAllText(GetFilePath(), SaveString); }
public override void Update() { if (!Collider.CheckOffset(new Offset(0, null, null, 1))) { Entity.Position.Y += 2; } while (Collider.CheckOffset(new Offset(0, (int)Entity.Size.Y + 1, null, 1))) { Entity.Position.Y--; } if (Entity.Data.ContainsKey("PO_ID")) { GameData.Set("PO_ID:" + Entity.Data["PO_ID"] + "/Position", Entity.Position.X.ToString() + "," + Entity.Position.Y.ToString()); } }
public void UpdateValue(string value) { Entity.Data["value"] = value; if (Entity.Data.ContainsKey("id")) { GameData.Set("Switch_ID:" + Entity.Data["id"] + "/Value", value); } if (Entity.Data["value"] == "0") { Sprite.RunAnimation("Off"); } else if (Entity.Data["value"] == "1") { Sprite.RunAnimation("On"); } }
public static void ID_first(Entity obj) { if (GameData.Get("NPCChest/" + obj.Data["id"] + "/" + "script") == null) { Global.AudioController.Play("SFX/OpenChest"); obj.GetComponent <Sprite>().RunAnimation("Opening", false); GameData.Set("NPCChest/" + obj.Data["id"] + "/" + "open", "true"); GameGlobal.PlayerController.MovementMode = PlayerController.MovementModes.None; StaticCoroutines.CoroutineHelper.WaitRun(1, () => { GameMethods.ShowMessages(new List <MessageBox>() { new MessageBox(null, "There's nothing inside.|.|.", new Vector2(obj.Position.X, obj.Position.Y - 30)) }, null, () => { StaticCoroutines.CoroutineHelper.WaitRun(2, () => { GameMethods.ShowMessages(new List <MessageBox>() { new MessageBox("Majestic Chest", "Hi!|| Did you want something?", new Vector2(obj.Position.X, obj.Position.Y - 30)), new MessageBox("Pause", "|.|.|.| I wasn't expecting that.", new Vector2(GameGlobal.Player.Position.X, GameGlobal.Player.Position.Y - 20)) }, null, () => { StaticCoroutines.CoroutineHelper.WaitRun(1, () => { GameGlobal.PlayerController.MovementMode = PlayerController.MovementModes.Normal; GameData.Set("NPCChest/" + obj.Data["id"] + "/" + "open", "false"); GameData.Set("NPCChest/" + obj.Data["id"] + "/" + "script", "2"); obj.GetComponent <Sprite>().RunAnimation("Closing", false); Global.AudioController.Play("SFX/OpenChest"); }); }); }); }); }); } else if (GameData.Get("NPCChest/" + obj.Data["id"] + "/" + "script") == "2") { GameMethods.ShowMessages(new List <MessageBox>() { new MessageBox(null, ".|.|. nothing.", new Vector2(obj.Position.X, obj.Position.Y - 30)) }, true, () => { }); } }
public void Save(Vector2 pos) { Saving = true; GameGlobal.PlayerController.MovementEnabled = false; if (GameData.Get("SavePoint/First") == null) { GameData.Set("SavePoint/First", "1"); GameMethods.ShowMessages(new List <MessageBox> { new MessageBox("", "Something is written here.|.|.", pos), new MessageBox("It say's", "'If you touch this grave stone your entire life up to\nthis point will be recorded.\n\nThe Holy Gravestone'|", pos), new MessageBox("Holy Gravestone", "Why don't they just call it a save point?", pos) }, null, () => { Save(pos); }); } else { MessageBox messageBox = new MessageBox(null, "Would you like to save?", pos); messageBox.Build(null, () => { GameMethods.ShowOptionSelector(pos + new Vector2(-16, 16), new List <Option>() { new Option("yes", "Yes", new Vector2(0, 0)), new Option("no", "No", new Vector2(0, 16)) }, option => { if (option == "yes") { Global.AudioController.Play("SFX/Save"); GameData.Save(); } messageBox.Destroy(); GameGlobal.PlayerController.MovementEnabled = true; Saving = false; }); }); } }
public void MysticCave() { // Input icons Entity pushableBox = Global.Entities.Find(p => p.Name == "MovableObject"); StaticCoroutines.CoroutineHelper.RunWhen(() => { return(GameGlobal.Player.Position.GetDistance(pushableBox.Position) < Global.Resolution.X / 2); }, () => { if (GameData.Get("Tips/Action2ToPush") == null) { // Action 2 Texture2D texture2D = GameMethods.GetInputIcon(InputManager.Input.Action2, Global.InputManager.CurrentInputType); GameMethods.DisplayInputIcon(texture2D, pushableBox.Position + new Vector2(0, -18), () => { return(GameGlobal.PlayerController.Pushing != 0); }, () => { GameData.Set("Tips/Action2ToPush", "1"); }); // Right texture2D = GameMethods.GetInputIcon(InputManager.Input.Right, Global.InputManager.CurrentInputType); GameMethods.DisplayInputIcon(texture2D, pushableBox.Position + new Vector2(-18, 0), () => { return(GameGlobal.PlayerController.Pushing != 0); }); // Left texture2D = GameMethods.GetInputIcon(InputManager.Input.Left, Global.InputManager.CurrentInputType); GameMethods.DisplayInputIcon(texture2D, pushableBox.Position + new Vector2(18, 0), () => { return(GameGlobal.PlayerController.Pushing != 0); }); } }); }
public void TheTree() { SoundEffectInstance forestAmbienceSFX = Global.AudioController.Play("SFX/Forest_Ambience"); forestAmbienceSFX.Volume = 0.3f; CoroutineHelper.Always(() => { if (forestAmbienceSFX.State == SoundState.Stopped) { forestAmbienceSFX = Global.AudioController.Play("SFX/Forest_Ambience"); forestAmbienceSFX.Volume = 0.3f; } }); Global.SceneManager.CurrentScene.OnExit += () => { Global.AudioController.Stop("SFX/Forest_Ambience"); }; if (GameData.Get("Levels/TheTree/Intro") == "True") { // Music Global.AudioController.PlayMusic("Overworld Happy"); return; } MyGame.Scenes.Level.CameraController.Offset = new Vector2(16, 0); // Initial fade GameGlobal.Fader.RunFunction("BlackOut"); GameGlobal.Fader.RunFunction("Cancel"); GameGlobal.Fader.Data["Time"] = "5"; CoroutineHelper.WaitRun(2, () => { GameGlobal.Fader.RunFunction("Resume"); GameGlobal.Fader.RunFunction("FadeIn"); }); GameGlobal.PlayerController.MovementEnabled = false; GameGlobal.PlayerController.Kinetic = true; GameGlobal.PlayerGraphic.Visible = false; GameGlobal.PlayerController.MovementMode = PlayerController.MovementModes.None; // Camera pan down Entity camePos = new Entity(e => { e.Position = GameGlobal.Player.Position + new Vector2(0, -800); }); CameraController.Instance.Easing = 0.03f; CameraController.Instance.MaxStep = 1f; CameraController.Instance.Target = camePos; CameraController.Instance.SnapOnce(); // Seagulls CoroutineHelper.WaitRun(11, () => { CoroutineHelper.WaitRun(1, () => { Global.AudioController.Play("SFX/BushRustle"); }); new Entity(entity => { entity.LayerName = "Main"; entity.SortingLayer = 8; entity.AddComponent(new Sprite() { Texture2D = Global.Content.Load <Texture2D>("Entities/Seagull") }).Run <Sprite>(s => { s.AddAnimation(new Animation("Default", 0.1f, new Point(16, 16), new Point(0, 0), new Point(1, 0), new Point(2, 0), new Point(3, 0), new Point(3, 0), new Point(3, 0))); s.RunAnimation("Default"); }); entity.Position = GameGlobal.Player.Position + new Vector2(0, -100); entity.Scale = new Vector2(2.1f, 2.1f); CoroutineHelper.RunUntil(() => { return(entity.Position.Y < -500); }, () => { entity.Position += new Vector2(0.3f, -0.2f * entity.Scale.Y); entity.Scale += new Vector2(-0.003f, -0.003f); if (entity.Scale.X < 0.5f) { entity.Scale = new Vector2(0.5f, 0.5f); } }); }); new Entity(entity => { entity.LayerName = "Main"; entity.SortingLayer = 8; entity.AddComponent(new Sprite() { Texture2D = Global.Content.Load <Texture2D>("Entities/Seagull") }).Run <Sprite>(s => { s.AddAnimation(new Animation("Default", 0.1f, new Point(16, 16), new Point(0, 0), new Point(1, 0), new Point(2, 0), new Point(3, 0), new Point(3, 0), new Point(3, 0))); s.RunAnimation("Default"); }); entity.Position = GameGlobal.Player.Position + new Vector2(-40, -100); entity.Scale = new Vector2(2, 2); CoroutineHelper.RunUntil(() => { return(entity.Position.Y < -500); }, () => { entity.Position += new Vector2(0.3f, -0.2f * entity.Scale.Y); entity.Scale += new Vector2(-0.003f, -0.003f); if (entity.Scale.X < 0.5f) { entity.Scale = new Vector2(0.5f, 0.5f); } }); }); }); CoroutineHelper.WaitRun(7, () => { camePos.Position = GameGlobal.Player.Position + new Vector2(0, -40); CoroutineHelper.WaitRun(12, () => { GameGlobal.Player.Position = camePos.Position + new Vector2(0, -20); GameGlobal.PlayerGraphic.RunAnimation("Jump"); GameMethods.ShowMessages(new List <MessageBox>() { new MessageBox("Pause", ".|.|.|| !", camePos.Position), new MessageBox("Pause", "Huh|.|.|.||| I don't remember\nsleeping there!?", camePos.Position) }, null, () => { CoroutineHelper.WaitRun(3, () => { GameGlobal.PlayerGraphic.Visible = true; MessageBox WoahMSG = new MessageBox("Pause", "Woah!", camePos.Position, MessageBox.Type.ManualDestroy); WoahMSG.Build(); float temp = GameGlobal.Player.Position.Y; CoroutineHelper.RunFor(0.7f, p => { if (GameGlobal.Player.Position.Y < camePos.Position.Y + 45) { GameGlobal.Player.Position.Y += 1f * (p * 4.15f); } if (GameGlobal.Player.Position.Y > WoahMSG.Position.Y + 32) { WoahMSG.Position = GameGlobal.Player.Position + new Vector2(-WoahMSG.Container.Size.X / 2, -32); } }, () => { GameGlobal.Player.Position.Y = camePos.Position.Y + 45; GameGlobal.PlayerGraphic.RunAnimation("Lay"); Global.AudioController.Play("SFX/Thump"); WoahMSG.Destroy(); GameMethods.SmokePuffs(8, GameGlobal.PlayerGraphicEntity.Position, new Point(8, 8)); CameraController.Instance.Shake(0.7f); CoroutineHelper.WaitRun(2, () => { // Music Global.AudioController.PlayMusic("Overworld Happy", 1); GameMethods.ShowMessages(new List <MessageBox>() { new MessageBox("Pause", "OUCH!", GameGlobal.Player.Position + new Vector2(0, -32)), }, null, () => { GameGlobal.PlayerController.MovementEnabled = true; GameGlobal.PlayerController.MovementMode = PlayerController.MovementModes.Normal; GameGlobal.PlayerController.Kinetic = false; CameraController.Instance.Easing = 0.1f; CameraController.Instance.MaxStep = 1000; CameraController.Instance.Target = GameGlobal.Player; camePos.Destroy(); GameGlobal.PlayerGraphic.RunAnimation("Stand"); GameGlobal.PlayerController.Direction = 1; GameGlobal.PlayerController.IsGrounded = true; GameData.Set("Levels/TheTree/Intro", "True"); GameGlobal.Fader.RunFunction("SetDefault"); }); }); }); }); }); }); }); }