Jump to content

restarting a game


cassius
 Share

Recommended Posts

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.

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

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.

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

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)

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

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.

}

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...