null
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.
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.
- 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?
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 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.
Re: How to add a button/icon for in-game minigame?
Thank you :'>Per K Grok wrote: ↑Mon Mar 30, 2020 1:29 amTo make a button you need a screen to place the button in. You could do something like this.
You can place that piece of code somewhere before 'label start'.Code: Select all
screen minigamebutton(): imagebutton idle "MGbutton.png" action Jump("minigame") pos (10, 10)
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.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Lacha