/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { try { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); #region Tricky's Quick Monogame Graphics if (SBubble.JCR == null) { System.Diagnostics.Debug.WriteLine("EEP! JCR resource is null! But how?"); } TQMG.Init(graphics, GraphicsDevice, spriteBatch, SBubble.JCR); #endregion BubbleInit.LetsGo(); TrickyGameJolt.GJAPI.ERRORFUNCTION = delegate(string msg) { #if FATAL_GAMEJOLT SBubble.MyError("Game Jolt API Error", msg, ""); #else BubConsole.WriteLine("GAME JOLT ERROR", 255, 0, 0); System.Console.Beep(); BubConsole.WriteLine(msg); #endif }; } catch (System.Exception Allemaal_naar_de_klote) { #if DEBUG Confirm.Annoy($"ERROR!\n{Allemaal_naar_de_klote.Message}\n\n{Allemaal_naar_de_klote.StackTrace}\n", "NALA Init error (LC)", System.Windows.Forms.MessageBoxIcon.Error); #else Confirm.Annoy($"ERROR!\n{Allemaal_naar_de_klote.Message}\n\nDid you install everything propely, or is the engine broken?\n", "NALA Init error (LC)", System.Windows.Forms.MessageBoxIcon.Error); #endif System.Environment.Exit(10); } }
public override void Draw(GameTime gameTime) { // Blocked, or not? for (int y = 0; y < TQMG.ScrHeight; y++) { for (int x = 0; x < TQMG.ScrWidth; x++) { #if DEBUG if (first) { BubConsole.WriteLine($"Pure({x},{y}); Scroll({ScrollX},{ScrollY}); Combined({x + ScrollX},{ y + ScrollY}); Block({MapLayer.Block(x + ScrollX, y + ScrollY)})"); } #endif TQMG.Color( BlCol( MapLayer.Block(x + ScrollX, y + ScrollY) ) ); TQMG.Plot(x, y); } } #if DEBUG first = false; #endif // Actors foreach (KthuraObject O in MapLayer.Objects) { TQMG.Color(255, 0, 0); if (O.kind == "Actor") { TQMG.Plot(O.x - ScrollX, O.y - ScrollY); } } }
public int Load(string name) { try { var mappath = $"Maps/Kthura/{name.Trim()}/"; BubConsole.WriteLine($"Loading Kthura map {mappath}", 180, 0, 255); if (!(SBubble.JCR.Exists($"{mappath}Objects") && SBubble.JCR.Exists($"{mappath}Data"))) { SBubble.MyError("Kthura LoadMap Error", $"Error finding the two required files for map {name}", $"Found({mappath}Objects) => {SBubble.JCR.Exists($"{mappath}Objects")}\nFound({mappath}Data) => {SBubble.JCR.Exists($"{mappath}Data")}"); return(0); } var KMap = Kthura.Load(SBubble.JCR, mappath, SBubble.JCR); BubConsole.WriteLine($"Kthura map {mappath} loaded", 180, 0, 255); return(Assign(KMap)); } catch (Exception Ellende) { if (JCR6.JERROR != "") { Crash(JCR6.JERROR); } else { Crash(Ellende); } BubConsole.CSay(Ellende.StackTrace); return(0); } }
public void MoveToSpot(int ID, string ActorTag, string Spot) { try { if (!KMaps.ContainsKey(ID)) { throw new Exception($"Map #{ID} does not exist!"); } var M = KMaps[ID]; if (!M.Layers.ContainsKey(Layers[ID])) { throw new Exception($"Map #{ID} does not have a layer named {Layers[ID]}"); } var L = M.Layers[Layers[ID]]; if (!L.HasTag(ActorTag)) { throw new Exception($"Map #{ID} does not have an object(actor) tagged {ActorTag} on Layer {Layers[ID]}"); } var O = L.FromTag(ActorTag); if (O.kind != "Actor") { throw new Exception($"Object \"{ActorTag}\" is a(n) {O.kind} and not an actor!"); } var A = (KthuraActor)O; if (!L.HasTag(Spot)) { throw new Exception($"Map #{ID} does not have an object(target) tagged {ActorTag} on Layer {Layers[ID]}"); } A.MoveTo(Spot); if (A.FoundPath != null && A.FoundPath.Success) { BubConsole.WriteLine($"Request to Move to spot \"{Spot}\" was succesful!", 0, 255, 0); //MoveSuccess = true; } else { BubConsole.WriteLine($"Request to Move to \"{Spot}\" has failed!", 255, 0, 0); //BubConsole.WriteLine($"Request to Move to \"{Spot}\" has failed!", 255, 0, 0); //MoveSuccess = false; } } catch (Exception Klotezooi) { Crash($"<Map #{ID}>.<KthuraActor.{ActorTag}>.MoveTo(\"{Spot}\"):", Klotezooi); //_MoveSuccess = false; } }
public void MoveToCoords(int ID, string ActorTag, int x, int y) { try { if (!KMaps.ContainsKey(ID)) { throw new Exception($"Map #{ID} does not exist!"); } var M = KMaps[ID]; var L = M.Layers[Layers[ID]]; var O = L.FromTag(ActorTag); if (O.kind != "Actor") { throw new Exception($"Object \"{ActorTag}\" is a(n) {O.kind} and not an actor!"); } var A = (KthuraActor)O; A.MoveTo(x, y); if (A.FoundPath != null && A.FoundPath.Success) { BubConsole.WriteLine($"Request to Move to ({x},{y}) was succesful!", 0, 255, 0); //MoveSuccess = true; #if DijkstraPathDebug var P = new StringBuilder("Move: "); foreach (TrickyUnits.Dijkstra.Node N in A.FoundPath.Nodes) { P.Append($"({N.x},{N.y}); "); } BubConsole.WriteLine(P.ToString(), 255, 180, 0); #endif } else { BubConsole.WriteLine($"Request to Move to ({x},{y}) has failed!", 255, 0, 0); //MoveSuccess = false; } } catch (Exception Klotezooi) { Crash($"<Map #{ID}>.<KthuraActor.{ActorTag}>.MoveTo({x},{y}):", Klotezooi); //MoveSuccess = false; } }