Jump to content

Recommended Posts

Posted

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++

Posted

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!

Posted

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!

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.

×
×
  • Create New...