Page 6 of 7

Re: Simple minigames (Screen Language only).

Posted: Thu Jun 27, 2019 3:59 pm
by Alex
Well, this part sets the positions for buttons

Code: Select all

    # This will make the description for all buttons (numbers, values and positions)
    python:
        for i in range (0, len(buttons_values) ):
            numbers_buttons.append ( {"b_number":i, "b_value":buttons_values[i], "b_x_pos":(renpy.random.randint (10, 70))*10, "b_y_pos":(renpy.random.randint (15, 50))*10, "b_to_show":True} )
For now "b_x_pos" and "b_y_pos" are set randomly, but you can predefine some positions and use them to set buttons positions. Or you could put the buttons inside a grid...

How would you like to place those buttons on screen?

Re: Simple minigames (Screen Language only).

Posted: Mon Jul 08, 2019 9:42 pm
by bubski_sketches
Figured it out through trial and error thanks to your clarification above,

Thanks so much again!

Re: Simple minigames (Screen Language only).

Posted: Fri Aug 16, 2019 3:37 pm
by Matalla
Hey Alex, thanks for your work.

I am implementing your fifteen game in my project and all works well, even with the clumsy modifications I made.

There's only a little thing that bothers me: after time is up, you can keep moving pieces. This has no real consequences, as if the puzzle is failed, even solving it after the time runs out, don't change anything. And if it's solved you can't make any move (but a sound I put in the buttons keeps playing).

I have tried several things but I can't figure out how to disable the buttons after time is up.

Re: Simple minigames (Screen Language only).

Posted: Fri Aug 16, 2019 5:48 pm
by Alex
Matalla wrote:
Fri Aug 16, 2019 3:37 pm
...I have tried several things but I can't figure out how to disable the buttons after time is up.
Hi, Matalla!
All game tiles are buttons, so you can use a variable to set their 'sensitive' property to True/False.
https://www.renpy.org/doc/html/screens.html#button

Here's an example of this - viewtopic.php?f=8&t=56083&p=514958&hili ... ve#p514958

Re: Simple minigames (Screen Language only).

Posted: Fri Aug 16, 2019 6:34 pm
by Matalla
Alex wrote:
Fri Aug 16, 2019 5:48 pm
Matalla wrote:
Fri Aug 16, 2019 3:37 pm
...I have tried several things but I can't figure out how to disable the buttons after time is up.
Hi, Matalla!
All game tiles are buttons, so you can use a variable to set their 'sensitive' property to True/False.
https://www.renpy.org/doc/html/screens.html#button

Here's an example of this - viewtopic.php?f=8&t=56083&p=514958&hili ... ve#p514958
It works! Thanks Alex.

I usually do this kind of things with SensitiveIf inside the action, but with all the stuff that I don't fully understand going on inside your action, I didn't even try. This method seems more suited for code ignorants like me, so thanks for showing it to me too.

For anyone interested, putting this below the action block, do the trick.

Code: Select all

sensitive fifteen_timer > 0
Edit: Oh, wait... that only works with the lose option. I'll have to think something that covers the win option too. Or I could hide the screen and show the image, which is what I had in place before.

Edit2: I'm dumber than I'd like to think:

Code: Select all

sensitive timer_on

Re: Simple minigames (Screen Language only).

Posted: Thu Nov 07, 2019 8:30 am
by XemiTicTac
Hi Alex! Im implementing the Memoria game to my proyect, i want make the cards to appear in a specific area of ​​the screen. Like set area screen limits x and y to put the cards. Its maybe with position attribute or with the area attribute? Thanks for sharing us these minigames ! :D

PD: I dont know if i explained my problem properly xD

Re: Simple minigames (Screen Language only).

Posted: Thu Nov 07, 2019 4:11 pm
by Alex
XemiTicTac wrote:
Thu Nov 07, 2019 8:30 am
... i want make the cards to appear in a specific area of ​​the screen. ...
Well, for now all the cards are placed in a grid, so you can set the position of the grid, like

Code: Select all

    grid 3 4:
        align (0.5, 0.5)
        for card in cards_list:
or apply the transform to it - viewtopic.php?f=8&t=55947&p=514658#p514658

The other way would be to add individual positions for each card in their description and show them not in a grid but at their positions, like

Code: Select all

label memoria_game:
    
    #####
    #
    # At first, let's set the cards to play (the amount should match the grid size - in this example 12)
    $ values_list = ["A", "A", "A", "A", "A", "A", "B",  "B", "B", "B", "B", "B"]
    
    # Then - shuffle them
    $ values_list = cards_shuffle(values_list)
    
    # And make the cards_list that describes all the cards
    $ cards_list = []
    $ card_positions_list = [(100, 50), (150, 70), (70, 150), (120, 90)] #the number of positions must match the number of cards !!!
    python:
        for i in range (0, len(values_list) ):
            cards_list.append ( {"c_number":i, "c_value": values_list[i], "c_chosen":False, "c_pos":card_positions_list[i]} )

Code: Select all

    #grid 3 4:
    for card in cards_list:
        button:
            pos card["c_pos"]
            background None

Re: Simple minigames (Screen Language only).

Posted: Fri Nov 08, 2019 11:46 am
by XemiTicTac
Tried these methods and it worked ! Thanks as always Alex, pretty appreciate your help. :D

Re: Simple minigames (Screen Language only).

Posted: Sat Nov 16, 2019 11:01 am
by thomas_oak
Is there a simple way to freeze the timer upon completion of the memoria game, so as to increase the player's prize depending on how well they have done?

Re: Simple minigames (Screen Language only).

Posted: Sat Nov 16, 2019 1:41 pm
by Alex
Try to add a variable 'timer_on' and set it to True/False to start/stop timer.
Something like

Code: Select all

##### The game screen
screen memo_scr:    
    
    ##### Timer
    if timer_on: # <---
        timer 1.0 action If (memo_timer > 1, SetVariable("memo_timer", memo_timer - 1), Jump("memo_game_lose") ) repeat True
    
    text str(memo_timer) xalign 0.5 yalign 0.05

Code: Select all

    # Before start the game, let's set the timer
    $ memo_timer = 50.0

    $ timer_on = True # <---
    
    # Shows the game screen
    show screen memo_scr

Code: Select all

label memo_game_win:
    $ timer_on = False
    $ can_click = False
    if memo_timer > 20:
        "Great job!"
    hide screen memo_scr
    $ renpy.pause (0.1, hard = True)
    $ renpy.pause (0.1, hard = True)
    "You win!"
    return

Re: Simple minigames (Screen Language only).

Posted: Sat Nov 16, 2019 3:30 pm
by thomas_oak
Splendid. Thanks Alex

Re: Simple minigames (Screen Language only).

Posted: Sat May 23, 2020 8:14 pm
by ForeverAScone
Hey, it says that I shouldn't be posting questions here but it looks like lots of people are asking questions here?? Sorry if this is not the right place.
I was just wondering, on the battle sequence thing you've created, is there a way to make it so you can choose an option only x amount of times? Sort of like Pokemon PP for the moves?
Thank you for making the code! I've been looking all over for something like this to put in my game! :D

Re: Simple minigames (Screen Language only).

Posted: Sat May 23, 2020 10:25 pm
by isobellesophia
ForeverAScone wrote:
Sat May 23, 2020 8:14 pm
Hey, it says that I shouldn't be posting questions here but it looks like lots of people are asking questions here?? Sorry if this is not the right place.
I was just wondering, on the battle sequence thing you've created, is there a way to make it so you can choose an option only x amount of times? Sort of like Pokemon PP for the moves?
Thank you for making the code! I've been looking all over for something like this to put in my game! :D
People help you if you asked in the right place, in here.

viewforum.php?f=8

Re: Simple minigames (Screen Language only).

Posted: Sun May 24, 2020 4:51 am
by Alex
ForeverAScone wrote:
Sat May 23, 2020 8:14 pm
...I was just wondering, on the battle sequence thing you've created, is there a way to make it so you can choose an option only x amount of times? Sort of like Pokemon PP for the moves?...
Hi, ForeverAScone!
What battle sequence you plan to use (1 on 1 or group one)? And how it works "you can choose an option only x amount of times" - does it mean that player can make several actions in one turn, or a limited number of actions for one battle (like using supermove only 3 times per battle)?

Re: Simple minigames (Screen Language only).

Posted: Sun May 24, 2020 12:42 pm
by ForeverAScone
Alex wrote:
Sun May 24, 2020 4:51 am
Hi, ForeverAScone!
What battle sequence you plan to use (1 on 1 or group one)? And how it works "you can choose an option only x amount of times" - does it mean that player can make several actions in one turn, or a limited number of actions for one battle (like using supermove only 3 times per battle)?
Hi, thanks for the reply :) I meant that each move can be used only a couple times per battle, like what you were saying "using a supermove only 3 times per battle". I was planning on using it with the one on one battle.