null

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Kiyo
Newbie
Posts: 10
Joined: Fri Jan 31, 2020 11:43 pm

null

#1 Post by Kiyo »

null
Last edited by Kiyo on Sun Jun 14, 2020 12:01 am, edited 1 time in total.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: How to add a button/icon for in-game minigame?

#2 Post by Per K Grok »

Kiyo wrote: Mon Mar 30, 2020 12:13 am How to add a button/icon for in-game minigame?
I am planning to add a minigame for my game, and I want the player to be able to play the minigame by clicking the minigame icon. How can I do this?
Please help me.
To make a button you need a screen to place the button in. You could do something like this.

Code: Select all

screen minigamebutton():
	imagebutton idle "MGbutton.png" action Jump("minigame") pos (10, 10)

You can place that piece of code somewhere before 'label start'.

You will probably also want a hover image and maybe some more stuff. Read up on 'imagebutton'.

For the button to show up in the game you need to put this line of code in the code at the point where the button should start to be seen.

show screen minigamebutton

and the button will now be seen in the position 10 pixels from the top and the left sides of the game screen (or whatever position you chose).

And if there is some part of the game where the button should not be seen you add this line of code

hide screen minigamebutton

---------

With the code above clicking the button will take you to a label (label minigame) where you have your minigame.

This could be a bit of a problem if you want to jump back to the spot you where at when you clicked at the button. It is no problem if you always continue to a specific label.

Another way would be to have the minigame in a screen (you will need a screen for your minigame anyway) and instead of jumping to a label you show the screen.

replace Jump('minigame') with Show('minigame)

This will open a 'screen minigame()' where you have your minigame. When you close the minigame (hide the screen) you will be at the same spot.

--------

This was in no ways a complete description on what you need to know, but hopefully it is enough to get you started.
Read up on screens, screen language and actions. You will need that to make a minigame. Good luck.

Kiyo
Newbie
Posts: 10
Joined: Fri Jan 31, 2020 11:43 pm

Re: How to add a button/icon for in-game minigame?

#3 Post by Kiyo »

Per K Grok wrote: Mon Mar 30, 2020 1:29 am
Kiyo wrote: Mon Mar 30, 2020 12:13 am How to add a button/icon for in-game minigame?
I am planning to add a minigame for my game, and I want the player to be able to play the minigame by clicking the minigame icon. How can I do this?
Please help me.
To make a button you need a screen to place the button in. You could do something like this.

Code: Select all

screen minigamebutton():
	imagebutton idle "MGbutton.png" action Jump("minigame") pos (10, 10)

You can place that piece of code somewhere before 'label start'.

You will probably also want a hover image and maybe some more stuff. Read up on 'imagebutton'.

For the button to show up in the game you need to put this line of code in the code at the point where the button should start to be seen.

show screen minigamebutton

and the button will now be seen in the position 10 pixels from the top and the left sides of the game screen (or whatever position you chose).

And if there is some part of the game where the button should not be seen you add this line of code

hide screen minigamebutton

---------

With the code above clicking the button will take you to a label (label minigame) where you have your minigame.

This could be a bit of a problem if you want to jump back to the spot you where at when you clicked at the button. It is no problem if you always continue to a specific label.

Another way would be to have the minigame in a screen (you will need a screen for your minigame anyway) and instead of jumping to a label you show the screen.

replace Jump('minigame') with Show('minigame)

This will open a 'screen minigame()' where you have your minigame. When you close the minigame (hide the screen) you will be at the same spot.

--------

This was in no ways a complete description on what you need to know, but hopefully it is enough to get you started.
Read up on screens, screen language and actions. You will need that to make a minigame. Good luck.
Thank you :'>

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Lacha