cassius Posted November 6, 2015 Share Posted November 6, 2015 Using c++ Whats the best way to re start a game when it ends?Currently I don't have that option. Tried goto a label called restart but got syntax error.obviosly Boolean flags would have to b reset. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
reepblue Posted November 6, 2015 Share Posted November 6, 2015 What kind of a "reset" you want? In the Darkness Awaits Template, I made it reload the map by saving the changename string into another string before clearing the changename value. A C++ example of what I'm talking about can be found here. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
cassius Posted November 6, 2015 Author Share Posted November 6, 2015 Thanks but that looks too advanced for me. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
reepblue Posted November 7, 2015 Share Posted November 7, 2015 Not really advanced, LEX is just complicated. Simply put: std::string nextmap std::string currentmap if (nextmap != NULL) { // Put this after you stopped the time and cleared the world. currentmap = nextmap nextmap = NULL // Make nextmap null so it does not loop. } Then when you want the map to reload: Map::Load(currentmap) Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Slastraf Posted November 7, 2015 Share Posted November 7, 2015 currentmap = nextmap if you change currentmap to a string like "level01" then it will load it. Quote Link to comment Share on other sites More sharing options...
reepblue Posted November 7, 2015 Share Posted November 7, 2015 Just put this instead of Map::Load() when you start the game: nextmap = "Maps\mymap.map" And the function before will automatically save the the current map you're playing. The entire thing should look like: std::string nextmap std::string currentmap if (nextmap != NULL) { World::Clear() Time::Pause() Map::Load(nextmap) Time::Resume() currentmap = nextmap nextmap = NULL // Make nextmap null so it does not loop. } Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.