Skip to content
← Back to Community
Can anyone make a functioning restart button for my platformer game: Shadow Runner
Profile icon
HenryMusic

Also, comment the code below so I can use it

Answered by HarperframeInc [earned 5 cycles]
View Answer
Voters
Profile icon
JosePupo-Hernan
Profile icon
HenryMusic
Comments
hotnewtop
Profile icon
HarperframeInc

Generally for all languages, I would expect for you to put each section of your game into a function and have that function started for a restart button.

I can clarify this more if you tell me what language you are using and/or the repl.

Profile icon
PattanAhmed

@HenryMusic
Hi,
Restarting a Python Script Within Itself by Petr Zemek.

That's it
Thanks!

Hope this helps

Profile icon
Coder100

that's python not HTML

@PattanAhmed

Profile icon
PattanAhmed

@Coder100
Is he asking HTML
Any clue?

Profile icon
Coder100

hm true ig

@PattanAhmed

Profile icon
PattanAhmed

@Coder100
I guessed it as Python...
Maybe you are True.
Who knows

Quarreling on this regard is something called MAD
LoL!

Profile icon
Whacko

Two examples of restart:

  1. JavaScript
function restart() { window.location = ""; /* Reloads the tab */ }
  1. HTML
<!-- Restart Button --> <a href=""><button>Restart</button></a>

Basically, all these codes do are restart the tab, although it would work.

Profile icon
Coder100

Well you should comment your code

Profile icon
HenryMusic

@Coder100
it is html and script.js

Profile icon
Coder100

ok, do location.reload()

@HenryMusic