16 mini game Renpy

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
bambino358
Newbie
Posts: 13
Joined: Sat Apr 27, 2019 7:17 am
Contact:

Re: 14 mini games

#31 Post by bambino358 » Sat Apr 27, 2019 7:30 am

Hi,
I'm trying to use minigame Fable 2 and I have a question. How to make a point move faster?
The basic move is too slow for me so I would like to make it faster but have no idea how to do it.

This is my script:

Code: Select all

init 15 python:
    fable_minigame_bar = 0
    fable_minigame_score = 0
    fable_you_press_button = 0
init:
    transform fable_point_move(frp):
        subpixel True
        rotate_pad True
        align(0.5,-0.53)
        rotate frp
        
screen fable_2_minigame1:
    add "minigame/Fable_bar.png" align(0.5,0.5)
    add "minigame/Fable_point.png" at fable_point_move(fable_minigame_bar)
    text "[fable_minigame_score]" align(0.5,0.1)
    text "[fable_minigame_bar]" align(0.5,0.2)
    text "[fable_you_press_button]" align(0.5,0.3)
    
    if fable_minigame_bar >= -14 and fable_minigame_bar <= 14:
        key "K_SPACE":
            if fable_you_press_button == 0:
                if fable_minigame_score < 14:
                    action [SetVariable("fable_minigame_score", fable_minigame_score + 1), SetVariable("fable_you_press_button", fable_you_press_button + 1), Show("you_press_button_good")]
                else:
                    action Jump("end")
            elif fable_you_press_button == 1:
                action SetVariable("fable_minigame_score", fable_minigame_score + 0)
    else:
        key "K_SPACE" action [SetVariable("fable_minigame_score", 0), Show("you_press_button_bad")]
    
screen fable_timer_left:
    timer 0.00001 repeat True action [If(fable_minigame_bar >= -90, SetVariable("fable_minigame_bar", fable_minigame_bar - 1)),If(fable_minigame_bar == -90, Hide("fable_timer_left"), Show("fable_timer_right")), If(fable_minigame_bar == -90, SetVariable("fable_you_press_button", 0))]
screen fable_timer_right:
    timer 0.00001 repeat True action [If(fable_minigame_bar <= 90, SetVariable("fable_minigame_bar", fable_minigame_bar + 1)),If(fable_minigame_bar == 90, Hide("fable_timer_right"), Show("fable_timer_left")), If(fable_minigame_bar == 90, SetVariable("fable_you_press_button", 0))]
    
screen you_press_button_good:
    text "{color=#1e8e00}Good Work!{/color}" at fable_move_good
    timer 1.0 action Hide("you_press_button_good")
screen you_press_button_bad:
    #hbox at fable_move_bad:
    text "{color=#950000}Ups...\nTry Again.{/color}" at fable_move_bad
    timer 1.0 action Hide("you_press_button_bad")
transform fable_move_good:
    align(0.5,0.5)
    linear 0.05 zoom 1.3
    linear 0.5 zoom 1.0 alpha 0.0
transform fable_move_bad:
    align(0.5,0.5)
    linear 0.04 xalign 0.5
    linear 0.06 xalign 0.495
    linear 0.06 xalign 0.515
    linear 0.06 xalign 0.5
    linear 0.5 alpha 0.0
I tried to change the Timer but it doesn't seem to work...

Thank you

User avatar
Andredron
Veteran
Posts: 340
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: 14 mini games

#32 Post by Andredron » Sun Apr 28, 2019 9:28 am

Code: Select all

screen fable_timer_left:
    timer 0.00001 repeat True action [If(fable_minigame_bar >= -90, SetVariable("fable_minigame_bar", fable_minigame_bar - 1)),If(fable_minigame_bar == -90, Hide("fable_timer_left"), Show("fable_timer_right")), If(fable_minigame_bar == -90, SetVariable("fable_you_press_button", 0))]
screen fable_timer_right:
    timer 0.00001 repeat True action [If(fable_minigame_bar <= 90, SetVariable("fable_minigame_bar", fable_minigame_bar + 1)),If(fable_minigame_bar == 90, Hide("fable_timer_right"), Show("fable_timer_left")), If(fable_minigame_bar == 90, SetVariable("fable_you_press_button", 0))]
    


Speed

Code: Select all


screen fable_timer_left:
    timer 0.00001 repeat True action [If(fable_minigame_bar >= -100, SetVariable("fable_minigame_bar", fable_minigame_bar - 1)),If(fable_minigame_bar == -100, Hide("fable_timer_left"), Show("fable_timer_right")), If(fable_minigame_bar == -100, SetVariable("fable_you_press_button", 0))]
screen fable_timer_right:
    timer 0.00001 repeat True action [If(fable_minigame_bar <= 100, SetVariable("fable_minigame_bar", fable_minigame_bar + 1)),If(fable_minigame_bar == 100, Hide("fable_timer_right"), Show("fable_timer_left")), If(fable_minigame_bar == 100, SetVariable("fable_you_press_button", 0))]
    /code]
   
  
  90 and - 90 speed bar
 
 +1 - 1  size bar delit
I know, I'm writing terribly in English.

I'm writing a Renpy textbook (in Russian). https://yadi.sk/d/ZX_DonP63USRru Update 22.06.18

Honest Critique

bambino358
Newbie
Posts: 13
Joined: Sat Apr 27, 2019 7:17 am
Contact:

Re: 14 mini games

#33 Post by bambino358 » Tue Apr 30, 2019 3:28 pm

Thank you. Now I feel like an idiot :).

Anyway... It works. Great!

User avatar
sonictoad
Newbie
Posts: 19
Joined: Tue Mar 12, 2019 10:39 pm
Projects: It's Different When It's Your Own
Organization: Sonic Toad Media LLC
itch: nyhcmaven84
Location: Bronx, NY
Contact:

Re: 16 mini game Renpy

#34 Post by sonictoad » Thu May 23, 2019 3:52 pm

This is going to sound like a stupid question but--

I want to use that "Search for Items" minigame, first one in the list. Except that there's no "game.rpy" file in my directory. I have the latest version of the engine and I'm using Editra, is this only in Atom or something?

User avatar
Andredron
Veteran
Posts: 340
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: 16 mini game Renpy

#35 Post by Andredron » Fri May 24, 2019 6:14 am

sonictoad wrote:
Thu May 23, 2019 3:52 pm
This is going to sound like a stupid question but--

I want to use that "Search for Items" minigame, first one in the list. Except that there's no "game.rpy" file in my directory. I have the latest version of the engine and I'm using Editra, is this only in Atom or something?

It is not necessary to have this file, just see how in the example to call the game, and in your project, where you also need to call.
I know, I'm writing terribly in English.

I'm writing a Renpy textbook (in Russian). https://yadi.sk/d/ZX_DonP63USRru Update 22.06.18

Honest Critique

User avatar
sonictoad
Newbie
Posts: 19
Joined: Tue Mar 12, 2019 10:39 pm
Projects: It's Different When It's Your Own
Organization: Sonic Toad Media LLC
itch: nyhcmaven84
Location: Bronx, NY
Contact:

Re: 16 mini game Renpy

#36 Post by sonictoad » Wed May 29, 2019 9:51 am

Andredron wrote:
Fri May 24, 2019 6:14 am
sonictoad wrote:
Thu May 23, 2019 3:52 pm
This is going to sound like a stupid question but--

I want to use that "Search for Items" minigame, first one in the list. Except that there's no "game.rpy" file in my directory. I have the latest version of the engine and I'm using Editra, is this only in Atom or something?

It is not necessary to have this file, just see how in the example to call the game, and in your project, where you also need to call.
Oh ok! So would this just go in the script.rpy file where virtually all of the game's code is? Or should I make a whole new script file (let's call it game.rpy to keep it simple) then call it from script.rpy when the player reaches the appropriate jump?

User avatar
Andredron
Veteran
Posts: 340
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: 16 mini game Renpy

#37 Post by Andredron » Wed May 29, 2019 10:43 pm

sonictoad wrote:
Wed May 29, 2019 9:51 am
Andredron wrote:
Fri May 24, 2019 6:14 am
sonictoad wrote:
Thu May 23, 2019 3:52 pm
This is going to sound like a stupid question but--

I want to use that "Search for Items" minigame, first one in the list. Except that there's no "game.rpy" file in my directory. I have the latest version of the engine and I'm using Editra, is this only in Atom or something?

It is not necessary to have this file, just see how in the example to call the game, and in your project, where you also need to call.
Oh ok! So would this just go in the script.rpy file where virtually all of the game's code is? Or should I make a whole new script file (let's call it game.rpy to keep it simple) then call it from script.rpy when the player reaches the appropriate jump?
The code of the game, for example, is written in a separate game.rpy file and is completely thrown into the project. You look then the code in script.rpy there mini game is called so

call screen minigame
Or
show screen minigame

And variables, they start with $ or python, don't forget to add first
I know, I'm writing terribly in English.

I'm writing a Renpy textbook (in Russian). https://yadi.sk/d/ZX_DonP63USRru Update 22.06.18

Honest Critique

Post Reply

Who is online

Users browsing this forum: No registered users