Python help :D

hello guys! i cant find a tutorial for pause button in blender using python script. may you help me to code thisresume.blend (460 KB). Controls> W-A-S-D for movement, R for pause.

thanks in advance and happy valentines to all blenderartists :smiley:

I do not really see a problem with your file. It seems to work as you describe.

But I recommend some changes:

Your cube performs his own movement - which is perfectly fine. But it adds the “Pause” scene too. This is a complete different concern. Better keep it separate e.g. at an empty called “sceneManager” or so.

As written pretty often, give your actuators/sensors/objects meaningful names. This helps you to see what they do without the need to expand and analyze them. I’m sure this is a test file, but developer tend to keep the previous test file as production file ;).

Overlay:
I suggest to do the buttons this way:
When clicked on button send a message that tells that the button was clicked e.g. “resume” and “quit” for the other button.
Keep the logic to resume and quit away from the buttons (see next paragraph). This allows to trigger these things with another object too (e.g. an object that listens to keyboard).

I suggest to have an empty “Suspender”. All it does is to suspend the main scene after creation. You can do that with an always sensor (no pulses). When receiving the message “resume” it resumes the main scene and ends the current scene.

Another empty switches mouse cursor “Cursor.manager”. It shows cursor on creation (Always sensor again). And it can hide the cursor when receiving the message “resume”.

Then have an empty “Quitter” that quits the game on receipt of message “quit”.

This may sound a bit overhead, but look at your buttons. They have confusing connections already.

I hope it helps

Thanks bro:D
yes this is a test file :slight_smile: