#🔒 Need help making a way to reset game variables

35 messages · Page 1 of 1 (latest)

worthy oxide
#

just started learning python recently and cant find a way to make it so my snake game can play again with out re running the game

here is the code

mossy hullBOT
#

@worthy oxide

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

calm owl
mossy hullBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

worthy oxide
mossy hullBOT
# worthy oxide

Please react with ✅ to upload your file(s) to our paste bin, which is more accessible for some users.

calm owl
#

is there a reason that you're using tkinter?

worthy oxide
#

Not really I’ve pretty much just started learning python so I’ve been trying out different tutorials and stuff

calm owl
#

right

#

so you dont need tkinter for this

#

just pygame is enough

worthy oxide
#

Alright thanks for letting me know

calm owl
#

can you start over and write it in just pygame?

vague river
#

Let them use tkinter

#

That's fine

final shore
#

@worthy oxide is that godot

vague river
#

Not optimal but that's fine

final shore
#

I used it before

calm owl
final shore
#

Godot game engine

calm owl
worthy oxide
final shore
#

I swear the fonts

vague river
#

Doesn't matter tbh

#

Alright so what you want

#

Is a button that resets everything

#

In tkinter you cnan make simple buttons

#

With tk.Button()

#

The button will wantna function, that is called when the button is pressed

#

In the function, you can reset all the variables that changed to its initial value

#

And draw the screen in its iniitial state

worthy oxide
#

Alr

mossy hullBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.