I already made mini games.The short answer is, you need to code them in.
The long answer is more complex, and really depends on what it is you actually want to do. Without knowing more specifics, or just speaking in general terms, you'd very likely need to learn python code to add minigames, and then write the code yourself. (Or find code someone else has written, then adapt it).
#you assign money value, in the main game
$ money = 100
#after you exit the slot machine, you add the coin value to the money
$ money += coins
#now you can do whatever with the money
"You have [money]"
$money = 100
if (coins >150):
$ money += coins
$ money = 100
if (coins>150):
$ money += 5
"You have [money]"
$money = 100
if (coins>150)
$ money += 5
$coins = 100
$ money = 100
call screen slotstart
label newlabel:
scene bgwinter1
if (coins > 150):
$ money += 5
elif (coins < 100):
$ money -= 5
$ coins = 100
"You have [money]"
call screen slotstart
If you add some of other example/source code for a clue. it would be more easier for you too.The ones ive made so far wouldn't really help since it's so different. I'll give a shot at figuring out what you want.
If I understand correctly, you want to add money within the main game (outside the slot machine) when you win, but do nothing if you lose? Correct me if im misunderstanding. That can be achieved a few different ways depending on your goal. For example
Code:#you assign money value, in the main game $ money = 100 #after you exit the slot machine, you add the coin value to the money $ money += coins #now you can do whatever with the money "You have [money]"
That'd just add your total coin value to your money.
If instead you wanted to only add money if say, you finished with more than 100 coins (the starting value), or more than 150, or whatever then you'd just
Code:$money = 100 if (coins >150): $ money += coins
or if you want to add a specific amount of money
If you were looking to make the slot machine a 1 time thing, then you really wouldn't have to worry about it much after that.Code:$ money = 100 if (coins>150): $ money += 5 "You have [money]"
If it was replayable, you'd just want to make sure you reset the value of coins either every time you entered the slot or after you exit, after doing the money adjustment. for example:
'Code:$money = 100 if (coins>150) $ money += 5 $coins = 100
And if you wanted to pay for the slot, you could subtract money every time you started it, or manipulate it any other way you'd like.
This is what I added (I also added an exit button in the slot machine, that jumped to the label i created)
Every time I exited with less than 100 coins, I lost 5 money, everytime I exited with more, I won 5 money, if I exited with 100-150, nothing changed, and it just repeated entering the slot machine over and over. Obviously you'd prefer something like an imagebutton to click to enter the slot machine, but this was just a quick and dirty example.Code:$ money = 100 call screen slotstart label newlabel: scene bgwinter1 if (coins > 150): $ money += 5 elif (coins < 100): $ money -= 5 $ coins = 100 "You have [money]" call screen slotstart
I'm not sure if that's what you were asking or not, if not lmk and I'll see what I can do.
# Assuming that "star" is '1', and that there's only three wining combinations:
# ***, **X and *XX
init python:
def slotMachineRoll():
# 6 symbol on the slots.
store.leftSlot = renpy.random.randint(1,6)
store.centerSlot = renpy.random.randint(1,6)
store.rightSlot = renpy.random.randint(1,6)
def slotMachineGain():
combination = ( leftSlot * 100 ) + ( centerSlot * 10 ) + rightSlot
if combination == 111: # three stars, jackpot
return 100
elif 110 <= combination < 120: # star, start, whatever
return 50
elif 100 <= combination < 200: # star, whatever, whatever
return 10
return 0
default leftSlot = 0
default centerSlot = 0
default rightSlot = 0
label slotMachine:
# Remove the 10 it cost to roll the machine
$ money -= 10
# Generate the slot combination.
$ slotMachineRoll()
# Display the screen showing the slots roll, then stop on the right combination
# Note: the screen is not depicted in this exemple.
screen rollingMachine
# Compute the gain
$ gain = slotMachineWin()
# Tell something to the player
if gain != 0:
"Oh, you won"
else:
"Sorry you lost"
# Add the potential gains.
$ money += gain
# What to do next
menu:
"roll again":
jump slotMachine
"quit":
jump somewhereElse