81 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
User avatar
Andredron
Miko-Class Veteran
Posts: 697
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: 16 mini game Renpy

#46 Post by Andredron »

[
Feleven wrote: Mon Jun 28, 2021 11:10 am Thanks for the reply but unfortunately the link found there is dead as well. When you click on "Kri2.rar" it sends you there: https://vk.com/doc28338738_463390421?ha ... dc674af1dd

Image

In comment post:

Kri2a.rar download

User avatar
Trafagal
Regular
Posts: 100
Joined: Mon Apr 29, 2019 9:32 am
Contact:

Re: 16 mini game Renpy

#47 Post by Trafagal »

Andredron wrote: Wed Jun 30, 2021 11:37 am [
Feleven wrote: Mon Jun 28, 2021 11:10 am Thanks for the reply but unfortunately the link found there is dead as well. When you click on "Kri2.rar" it sends you there: https://vk.com/doc28338738_463390421?ha ... dc674af1dd
Image

In comment post:

Kri2a.rar download
Hi Andredon, thanks for making the minigames. Not sure if you still have it. The links at the comment section is not function.
https://vk.com/wall-7553243_41708?post_add#post_add

Kri2a.rar download in the comment section is not working.
I wonder if you still have it? Thank you
Check out some of my stuffs here:https://linktr.ee/theartofjoshlab

Art Portfolio: https://www.instagram.com/theartofjoshlab/

Working on a personal Visual Novel~

User avatar
Trafagal
Regular
Posts: 100
Joined: Mon Apr 29, 2019 9:32 am
Contact:

Re: 11)test Chess

#48 Post by Trafagal »

Andredron wrote: Thu Jun 28, 2018 4:07 pm Image
download https://m.vk.com/doc245191038_459115246 ... 4cceed95f6

The license is free, but I'll be glad if ty specify the author -Al Loui
The download link for this game is gone, any chance for you to relink it? Thank you!
Check out some of my stuffs here:https://linktr.ee/theartofjoshlab

Art Portfolio: https://www.instagram.com/theartofjoshlab/

Working on a personal Visual Novel~

User avatar
Trafagal
Regular
Posts: 100
Joined: Mon Apr 29, 2019 9:32 am
Contact:

Re: 8 mini games

#49 Post by Trafagal »

gas wrote: Thu May 24, 2018 2:57 pm 3 in 1 can be really streamlined using some particular python method. I'll try for as it's a nice input.
Hi Gas,

Do you happen to still have the 3-in-1 image files?
The orginal link doesn't seems to work anymore.

Thank you.
Check out some of my stuffs here:https://linktr.ee/theartofjoshlab

Art Portfolio: https://www.instagram.com/theartofjoshlab/

Working on a personal Visual Novel~

Feleven
Newbie
Posts: 10
Joined: Tue Jun 01, 2021 10:23 am
Contact:

Re: 8 mini games

#50 Post by Feleven »

Trafagal wrote: Thu Sep 09, 2021 7:12 pm Hi Gas,

Do you happen to still have the 3-in-1 image files?
The orginal link doesn't seems to work anymore.

Thank you.
Had the same issue but fortunately all you need to do is make them yourself in like 10 minutes. Grab some free vectors or w/e and edit them in photoshop or gimp to be 100x100 pixels. These are the files you need and the names:
k0 - just a blackscreen
k1, k2, k3, k4, k5, k6 - icons of the crystals/objects you're gonna be moving in the game
kgw - background, can be anything

You also have to save it in the .w format as that's what the script is looking for. Otherwise edit it to make it look for .pngs or something.

Edit, edit, edit:
I've done it for you. As I said, 10 min or less. I also changed the format to .png.
Attachments
1in3.7z
(132.45 KiB) Downloaded 81 times

User avatar
Trafagal
Regular
Posts: 100
Joined: Mon Apr 29, 2019 9:32 am
Contact:

Re: 8 mini games

#51 Post by Trafagal »

Feleven wrote: Tue Sep 14, 2021 11:00 am
Trafagal wrote: Thu Sep 09, 2021 7:12 pm Hi Gas,

Do you happen to still have the 3-in-1 image files?
The orginal link doesn't seems to work anymore.

Thank you.
Had the same issue but fortunately all you need to do is make them yourself in like 10 minutes. Grab some free vectors or w/e and edit them in photoshop or gimp to be 100x100 pixels. These are the files you need and the names:
k0 - just a blackscreen
k1, k2, k3, k4, k5, k6 - icons of the crystals/objects you're gonna be moving in the game
kgw - background, can be anything

You also have to save it in the .w format as that's what the script is looking for. Otherwise edit it to make it look for .pngs or something.

Edit, edit, edit:
I've done it for you. As I said, 10 min or less. I also changed the format to .png.
Thanks Feleven! Yeah, I figure that I probably just need to recreate the images. However, your work comes in handy too!

Thank you so much!
Check out some of my stuffs here:https://linktr.ee/theartofjoshlab

Art Portfolio: https://www.instagram.com/theartofjoshlab/

Working on a personal Visual Novel~

User avatar
Andredron
Miko-Class Veteran
Posts: 697
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

17) search for a disguised bug

#52 Post by Andredron »

mini game "search for a disguised bug"

This mini-game was made for me by my good friend Stanislav Korelov

This mini game can be used for gallery and as glasses through clothes for hentai images

zoom.rpy

Code: Select all


# show magnifier:
# call show_zoom
#change scale:
# $ zoom = 4




init python:
    # default increase
    zoom = 1

 # magnifier size (will change automatically according to mask size)
    zoom_w, zoom_h = 0, 0

  # the name of the sprite with the mask for the area under the magnifying glass
    #zoom_mask = "zoom mask"
    zoom_mask = "zoom MScaner"

    # the name of the magnifying glass sprite (with a transparent circle in the center)
    #zoom_idle = "zoom idle"
    zoom_idle = "zoom Scaner"
    #imm_ = "fon2.jpg"

    # to store the screenshot
    #zoom_shot = Null(1, 1)

    fon2 = "Stena1.jpg"

    zoom_shot = fon2
    #zoom_shot = "Stena2.jpg"

  # get the size of the declared sprite
    def get_size(image):
        w, h = renpy.render(renpy.easy.displayable(image), 0, 0, 0, 0).get_size()
        return int(w), int(h)

  # get a screenshot of the given size, by default - the whole screen
    #def shot(w=config.screen_width, h=config.screen_height):
    #    renpy.take_screenshot((w, h))
    #    return FileCurrentScreenshot()

 # make a screenshot
    def get_shot():
        global zoom_shot, zoom_w, zoom_h
        # take a screenshot

         #zoom_shot = shot(config.screen_width, config.screen_height)

        # magnifier size
        zoom_w, zoom_h = get_size(zoom_idle)
    GetShot = renpy.curry(get_shot)

  # get picture screen+magnifying glass
    def zoom_f(st, at):

        # mouse coordinates
        x, y = renpy.get_mouse_pos()
      # upper left corner (cursor in the center)
        x = int(x - zoom_w / 2)
        y = int(y - zoom_h / 2)
  # cut out a square from the screenshot
        d = Crop((x, y, zoom_w, zoom_h), zoom_shot)

      # increase
        d = Transform(d, zoom=zoom)
# cut out the square again
        x2 = int(zoom_w * zoom - zoom_w) / 2
        y2 = int(zoom_h * zoom - zoom_h) / 2
        d = Crop((x2, y2, zoom_w, zoom_h), d)
   # then cut out the circle
        d = AlphaMask(d, zoom_mask)
    # overlay the magnifying glass image
        d = LiveComposite((zoom_w, zoom_h), (0, 0), d, (0, 0), zoom_idle)
        return d, .01

# mouse coordinates
    def at_zoom_f(trans, st, at):
        trans.pos = renpy.get_mouse_pos()
        return 0

# change magnification [2, 4, 8]
    def re_zoom():
        fon2 = "Stena2.jpg"
        #global zoom
        #zoom *= 2
        #if zoom > 8:
        #    zoom = 2
    ReZoom = renpy.curry(re_zoom)

init:
# screen
    image zoom_zoom = DynamicDisplayable(zoom_f)

# transform to move the magnifier
    transform at_zoom():
        anchor(.5, .5)
        function at_zoom_f

# magnifier screen
screen ZOOM:
    modal True
    on "show" action GetShot()
    add "zoom_zoom" at at_zoom()
    #key "dismiss" action Hide("ZOOM"), With(dissolve)
    #key "K_TAB" action ReZoom()
    #key "K_TAB" action [SetVariable("zoom_shot", "Stena2.jpg"), Show("ZOOM"), With(dissolve)]
    #key "K_TAB" action Return()
    key ["+" , "="] action Return(1)
    key ["-"] action Return(2)

    if nnn == 5:
        button:
            background None
            xpos 1019
            ypos 268
            xsize 94
            ysize 94
            action Return(3)
    $ tik = pwr
    $ tik = tik - kraz
    timer 1 repeat True action SetVariable("pwr", tik)

    if pwr <=0:
        timer 0.5 repeat True action Return(5)
    else:
        textbutton ("Scanner Charge[pwr]/%"):
            text_color "#ff0000"
            background None
            xalign 0.5
            action NullAction()


return


# the label to call to turn on the magnifier
# call show_zoom
label show_zoom:
# remove the window
    window hide
    pause .0001
    $ nnn = 1
    $ podcl = False
    play music "audio/M1.mp3"
label scan:
    show screen ZOOM with dissolve

label scan1:
# show screen with magnifying glass
    call screen ZOOM
    #with dissolve
    #centered "{nw}"
    $ result = _return

    if result == 1:
        if nnn < 5:
            $ nnn = nnn + 1
            $ zoom_shot = "Stena" + str(nnn) + ".jpg"

    if result == 2:
        if nnn > 1:
            $ nnn = nnn - 1
            $ zoom_shot = "Stena" + str(nnn) + ".jpg"

# scanner discharge rate
    $ kraz = kk[nnn]


    if result == 5:
        hide screen ZOOM
        with dissolve
        $ inftxt = "Scanner empty"
        $ zar = False

        jump scanstop

    if result == 3:
        hide screen ZOOM
        with dissolve
        $ inftxt = "Connection detected"
        jump scanstop
    #with dissolve


    jump scan1
label scanstop:
    show screen info_
    with dissolve
    stop music fadeout 10.0
    $ renpy.pause(10.5, hard=True)   
    return

screen info_:

    textbutton ("[inftxt]"):
        text_color "#ff0000"
        background None
        xalign 0.5
        action NullAction()

    if zar == True:
        button:
            background "Metka_001.png"
            xpos 1019
            ypos 268
            xsize 94
            ysize 94
            action NullAction()
return
script.rpy

Code: Select all


init python:
   # automatic declaration of sprites
    config.automatic_images_minimum_components = 1
    config.automatic_images = [" ", "_", "/"]
    config.automatic_images_strip = ["images"]


return



label start:
    $ quick_menu = False

    $ pwr = 100
    $ zar = True
    $ kraz = 0.5
    $ kk = [0.5,0.5,1,10,15,20]
    $ inftxt = " "


    scene image("Stena1.jpg")
    #show talia

    "The task is to detect \"bug\" behind the wall\nThe scanner has five levels of sensitivity. They are switched by the + and - keys (on the main keyboard)\nKeep an eye on the scanner charge."




    scene image("Stena1.jpg")
    with dissolve
    # call a subroutine that shows the magnifying glass screen

    $ fon2 = "Stena2.jpg"
    call show_zoom

    pause

    return

Download - https://disk.yandex.ru/d/n-_JYcLY7-0IAw

Image

Image

User avatar
Andredron
Miko-Class Veteran
Posts: 697
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Clean the banana snake

#53 Post by Andredron »

autor - https://www.renpy.cn/thread-528-1-7.html
Videos - https://vk.com/video-7553243_456239257 (adult material)

Code: Select all

image cock = "cock.png"
transform trans_cock_show():
    "cock.png"
    function func_show_cock
 
transform trans_normal_cock():
    trans_cock_show
    0.1
    repeat
 
transform trans_touch_cock():
    trans_cock_show
    function func_touch_cock
    0.1
    repeat
 
 
init python:
    import math
    cock_value_max = 50
    cock_pop_value = 30
    cock_unpop_value = 20
 
 
    cock_value = 0
    cock_state = False
    cock_xzoom = 1.0
    cock_traning = False
    mouse_pos = (0,0)
 
    def func_show_cock(trans, st, at):
        global cock_pop_value, cock_unpop_value
        global cock_state, cock_value, cock_xzoom, cock_traning
        trans.xzoom = cock_xzoom
        if cock_state == False:
            if cock_value >= cock_pop_value or cock_traning:
                cock_traning = True
                if trans.xzoom < 2.0:
                    trans.xzoom += 0.01
                    cock_xzoom = trans.xzoom
                    return 0
                cock_traning = False
                cock_state = True
        else:
            if cock_value <= cock_unpop_value or cock_traning:
                cock_traning = True
                if trans.xzoom > 1.0:
                    trans.xzoom -= 0.01
                    cock_xzoom = trans.xzoom
                    return 0
                cock_traning = False
                cock_state = False
        return None
 
    def cock_calm():
        global cock_value, cock_traning
        if cock_value > 0 and not cock_traning:
            cock_value -= 1
 
    def func_touch_cock(trans, st, at):
        global cock_value, mouse_pos
        now_mouse = renpy.get_mouse_pos()
        dist = math.sqrt(sum([(a - b)**2 for (a,b) in zip(mouse_pos,now_mouse)]))
        if dist > 5:
            cock_value += 1
            mouse_pos = now_mouse
 
 
screen CockScreen():
    default refresh_var = 0
    bar value cock_value range cock_value_max:
        xalign 0.5
        xsize 400
    text "[cock_value]":
        xalign 0.5
    imagebutton:
        xalign 0.5
        focus_mask True
        idle trans_normal_cock
        hover trans_touch_cock
        action SetScreenVariable("refresh_var",refresh_var)
    timer 0.1:
        action SetScreenVariable("refresh_var",refresh_var)
        repeat True
    timer 0.5:
        action cock_calm
        repeat True
    if cock_value >= cock_value_max:
        timer 0.1:
            action Return()
 
label start:
 
    call screen CockScreen
    "Clean the banana snake"
 
    return

User avatar
Andredron
Miko-Class Veteran
Posts: 697
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Sic Bo

#54 Post by Andredron »

https://github.com/SG-mancer/SicBo

The game Sic Bo comes from ancient China. This is a betting game similar to roulette, it is played with three dice. You can play Sic Bo alone or with other players. An analogue of Sic Bo is the Grand Azar game, which takes place in some casinos in the Russian Federation. This review is compiled according to the rules of playing Sic Bo in Las Vegas and Atlantic City casinos.

The Sic Bo table looks very complex, as it has many sections. At the same time, the game itself is very simple and consists of just throwing three dice and betting on the outcome. This game does not require any complex calculations or additional actions from the player, except for placing bets.

Like roulette, Sic Bo has a lot of different bets. At the same time, all bets must be made in separate "pockets", there are no composite bets on intersections, as in roulette. We admit that the game table is quite complicated and requires a thorough study before you start playing. Please take a few minutes to study this guide.

Betting in Sic Bo
At the top of the Sic Bo game table, you can see two sections: "Small bets" (the so-called "Small bets"), traditionally located on the left, and "Big bets" (the so-called "Big bets") on the right. Payments for these rates are made 1 to 1. The probability of getting a combination is 48.61%. The advantage of the casino over the player at this rate is 2.78%.

Small bets are won when the sum of the three dice is between 4 and 10.
Big bet is won when the sum of three dice is between 11 and 18.
The bottom of the table contains "Number bets". You can bet on any number from 1 to 6. Payouts vary depending on how many times the number you specify falls on the faces of the die: 1 to 1 with a single drop (for example, when betting on 1, the combination 1-3-4 fell out) , 2 to 1 if the number comes up twice, and finally 3 to 1 if your number comes up three times. You can safely bet on any of the numbers, but we warn you that the probability of your number falling out on one die is 34.72%, on 2-dice - 6.94%, on 3-dice - 0.46%. The house edge at this rate is 7.87% and we tend to call it very big. In any case, it is not recommended to use the "Martingale" system or its variants (systems of progressive increase in rates) on this type of bets.

Slightly above the field bets on numbers is the field "Pair bets" (bets on two of the same type). Here you can bet on any of the 15 combinations of two out of three dice. If this combination falls out, you will receive a payout of 5 to 1. The probability of getting a combination is 13.89%, when paying 5:1, the house edge is 16.67%, so decide for yourself.

Even above the bets on pairs, you can see a wide column of "Total bets" (bets on the amount on the faces of the dice). With total bets, you only win when the sum of all three dice rolls. Three dice can give a sum from 3 to 18, but here 3 and 18 are excluded from Total bets due to low probability. Thus, you can bet on amounts from 4 to 17.

User avatar
Andredron
Miko-Class Veteran
Posts: 697
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: 48 mini game Renpy

#55 Post by Andredron »

Since at the moment some things in RenPy are broken (for example, values ​​​​are not returned in the _return variable or Return()() from a function does not work), I had to write a new "Search for Items". Plus, the possibility of additional settings has been added through the initialization function: choosing the position of the timebar, inventory, setting the principles of inventory - found items are added there or removed from it. By the way, the inventory can also be scaled through the parameters of the hf_init() function. Plus added flickering timebar when time runs out, and the ability to customize the reaction of items on hover. In general, everything from the SETTINGS section can be changed during initialization, you just need to remove the "hf_" prefix. Everything works only in combination with the 7dots.rpy module
Link to project archive http://renpyfordummies.blogspot.com/202 ... y.html?m=1


Code: Select all


#hf - HiddenFolks (Hidden Objects)
# used in conjunction with the 7dots.rpy module

# usage example:
init1:
    # define the game background, game time in seconds
    # and set game parameters - sprites and position for collected items
    $hf_init("bg room", 5,
        ("beer", 1013, 705),
        ("elf", 111, 560),
        ("flowers", 700, 615),
        ("skull", 1813, 161),
        ("sprite", 355, 240),
        # OPTIONAL PARAMETERS:
        # enable cursor change on hover
        mouse=True,
        # turn on the inventory with the removal of found items from it
        inventory=False,
        # turn on the highlight of the object on hover
        hover=brightness(.05),
        # reduce the size of inventory cells so that they do not interfere with collecting items
        w=200,
        h=200
    )

# then the game will be called:
    # $hf_start()
    
    # number of uncollected items will be in hf_return

init python:
    # automatic declaration of sprites (including webp)
    images_auto()

    # cursors
    config.mouse = {"default": [("images/c/default.png", 1, 1)],
        "hand": [("images/c/hand1.png", 2, 10),
        ("images/c/hand1.png", 2, 10), ("images/c/hand1.png", 2, 10),
        ("images/c/hand1.png", 2, 10), ("images/c/hand2.png", 2, 10),
        ("images/c/hand2.png", 2, 10), ("images/c/hand3.png", 2, 10),
        ("images/c/hand3.png", 2, 10), ("images/c/hand2.png", 2, 10),
        ("images/c/hand2.png", 2, 10)],
        "finger": [("images/c/finger.png", 2, 10)]}

# SETTINGS
    # whether to change the cursor on hover
    hf_mouse = False

    # True - found items are added to inventory
    # False - found items disappear from inventory
    # None - inventory is not displayed
    hf_inventory = None

    # transform to highlight on hover
    # could be, for example, brightness(.05)
    hf_hover = None

    # the name of the folder with the sprites of the game in the images directory, plus a space
    hf_dir="game"

    # sizes of items in inventory
    hf_w, hf_h = 300, 300

    # timebar sizes
    hf_t_w, hf_t_h = 1040, 32

    # padding items from inventory edges
    hf_xpadding = 20
    hf_ypadding = 40

    # inventory window position
    hf_xalign = .5
    hf_yalign = .05

    # timebar position
    hf_t_xalign = .5
    hf_t_yalign = .01

# INTERNAL VARIABLES
    # time to collect items
    hf_time = 5

    # time to reset for animation
    hf_bar = 100

    # game mode (False - background mode)
    hf_game_mode = False

    # items to find
    hf_needed = []

    # items already found
    hf_picked = []

    # game background
    hf_back="black"

    # whether to repaint the timebar (a quarter of the time left)
    hf_warning = False

    # number of uncollected items
    hf_return = 0

    # initial number of items
    hf_max_count = 0

    # game initialization
    def hf_init(bg, time, *args, **kwargs):
        global hf_needed, hf_picked, hf_back, hf_time, hf_bar, hf_max_count
        # reset lists and variables
        hf_needed = []
        hf_picked = []
        hf_back=bg
        hf_time = time
        hf_bar = 100
        # add to the list of items to be found
        for item, x, y in args:
            hf_needed.append((item, x, y))
        hf_max_count = len(hf_needed)
        # apply optional game parameters
        # essentially change the values ​​of similar variables,
        # but only they must start with hf_
        for k, v in kwargs.items():
            kk = "hf_" + k
            if kk in globals().keys():
                globals()[kk] = kwargs.get(k)

    # show game as background on master layer
    def hf_bg():
        store.hf_game_mode = False
        show_s("Hidden Folks")

    # hide game-background
    # but first show if game screen is hidden
    def hf_hide():
        hf_bg()
        renpy.with_statement(None)
        hide_s("Hidden Folks")

    # start the game
    # if some effect is set, then first show the game with it
    def hf_start(effect=None):
        store.hf_game_mode = False
        store.hf_warning = False
        hf_bg()
        renpy.with_statement(effect)
        store.hf_game_mode = True
        store.hf_return = len(hf_needed)
        renpy.call_screen("Hidden Folks")
        hf_bg()

    # click on an item (move it to inventory or remove it from there)
    def hf_click(item, x, y):
        store.hf_picked.append(store.hf_needed.pop(hf_needed.index((item, x, y))))
        splay("click")
        renpy.restart_interaction()
        # left to collect
        store.hf_return = len(hf_needed)
    hfclick = renpy.curry(hf_click)

    # change the color of the timer
    # or start the time reduction animation
    def hf_go(warning=False):
        if warning:
            # change color
            store.hf_warning = True
        else:
            # start animation
            store.hf_bar = 0
        renpy.restart_interaction()
    HFGo = renpy.curry(hf_go)

    # get inventory sprite
    def hf_isprite(item):
        # if there is an item in the inventory folder,
        # then we take it, otherwise - what is on the screen
        i = hf_dir + " inventory " + item
        if has_image(i):
            item = i
        # get item sprite size
        w, h = get_size(item)
        # coefficients for zoom
        zoom=1
        # if the item is larger than the cell, calculate the new zoom
        if w > hf_w or h > hf_h:
            # on the larger side
            if w > h:
                zoom=hf_w/w
            else:
                zoom=hf_h/h
        # return the sprite inscribed in the dimensions of the inventory cell
        return Transform(item, zoom=zoom)

screen HiddenFolks():
    # game background
    add hf_back

    # all items on the screen
    for i, x, y in hf_needed:

        $ item = hf_dir + " " + i
        # button item
        imagebutton:
            style "empty"
            # item sprite
            idle item
            # item position (coordinates of its center)
            pos(x, y)

            # all actions only in game mode
            if hf_game_mode:

                # change cursor if necessary
                if hf_mouse:
                    mouse "hand"

                # if highlight on hover is enabled
                if not hf_hover is None:
                    # if there is a picture for the selected object, then display it
                    if has_image(item + "hover"):
                        hover item + "hover"
                    # otherwise highlight the transform specified in the settings
                    else:
                        hover At(item, hf_hover)

                # handle click
                action HFCclick(i, x, y)

    # timer animation
    if hf_game_mode and hf_time > 0:
        # activate the timer
        timer .01 action HFGo()

        # timer for repainting the bar (one third of the total time)
        timer hf_time * .6666 action HFGo(True)

        # visualization of the timer as a bar
        bar:
            # position and size of the timebar
            align(hf_t_xalign, hf_t_yalign)
            xysize(hf_t_w, hf_t_h)
            value AnimatedValue(hf_bar, 100, hf_time)

            # repainting and flickering of the left strip of the bar,
            # when less than a third of the time is left
            if hf_warning:
                left_bar Frame(At("gui/bar/left.png", paint2("#e02", "#e028", .2)), gui.bar_borders, tile=gui.bar_tile)

        # timer loss
        timer hf_time repeat True action SPlay("gameover"), Return()

        # collected everything, leave (Return()() from def does not work anymore)
        if hf_return < 1:
            timer .01 repeat True action SPlay("gamewin"), Return()

        # inventory
        if not hf_inventory is None:
            # inventory frame
            frame:
                style "empty"
                xysize(hf_max_count * hf_w + hf_xpadding * 2, hf_h + hf_ypadding * 2)
                # inventory position
                align(hf_xalign, hf_yalign)
                background Frame("framei", 48, 48)
                # item container
                hbox:
                    align(.5, .5)
                    # display collected items
                    if hf_inventory:
                        for item, x, y in hf_picked:
                            button style "empty" xysize(hf_w, hf_h):
                                add hf_isprite(item) align(.5, .5)
                    # either display the items left to collect
                    else:
                        for item, x, y in hf_needed:
                            button style "empty" xysize(hf_w, hf_h):
                                add hf_isprite(item) align(.5, .5)

User avatar
Andredron
Miko-Class Veteran
Posts: 697
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: 52 mini game Renpy

#56 Post by Andredron »

52)
Advanced Shooting Range

The only difficult moment for beginners, after updating Renpy 8, the video code does not work properly, I ask you not to publish the rest of the code, so that people really learn to understand the processes when developing this mini-game.

Code: Select all

init python:
    def corkGunTransform(t, st, at):
        global cork_gun_pos
        global cork_gun_opos
 
        mousepos = renpy.get_mouse_pos()
 
        if mousepos[0] - cork_gun_size[0] / 2 <= renpy.get_physical_size()[0] - cork_gun_size[0] and mousepos[0] >= cork_gun_size[0] / 2:
            cork_gun_pos = (int(mousepos[0] - cork_gun_size[0] / 2), cork_gun_opos[1])
 
        t.xpos = cork_gun_pos[0]
 
        cork_gun_pos = (cork_gun_pos[0], cork_gun_opos[1] + int((mousepos[1] - config.screen_height / 2 )/7))
        t.ypos = cork_gun_pos[1]
        return 0
 
transform half_size:
    zoom 0.5
 
transform spotlights:
    zoom 0.5
    blend "add"
    alpha 0.5
 
 
screen scene_1:
    image "images/scene-1-background.png" at half_size
    imagebutton idle Solid("#FFFFFF00") hover "images/scene-1-sg-button.png" align (0.7, 0.3) at half_size action Show("shooting_gallery")
 
screen shooting_gallery:
    image "images/targets-background.png" at half_size
    image "images/shooting-gallery-background.png" at half_size
    image "images/spotlights.png" at spotlights
    add cork_gun_transform
    image "images/score-background.png" pos (10, 0) at half_size
 
label start:
    $ cork_gun_image = Image("images/cork-gun.png")
    $ cork_gun_size = (330 / 2, 384/ 2)
    $ cork_gun_pos = (0, 0)
    $ cork_gun_opos = (int((config.screen_width / 2) - (cork_gun_size[0] / 2)), config.screen_height - cork_gun_size[1] + 60)
    $ cork_gun_transform = Transform(child = cork_gun_image, zoom = 0.5, pos = (cork_gun_opos[0], cork_gun_opos[1]), function = corkGunTransform)
    call screen scene_1
Recommend for familiarization

CatNip23
Newbie
Posts: 9
Joined: Wed Jul 29, 2020 12:16 pm
Contact:

Re: 54 mini game Renpy

#57 Post by CatNip23 »

Hello, I seem to be having a problem with the dog minigame #10, specifically with the replayability.

I managed to get it to work, but when I start new round, it looks like the one before stays under, and the fish that are under are invisible.
I think it comes from the ui.add( FishCatcherGame() ) from line 256, because the only way to replay it that I found was to call ui.add again, but it seems that the previous ui is not cleared. I have tried to clear it but I just can't.

I also tried assigning it to a variable like:

Code: Select all

new_ui = FishCatcherGame()

ui.add( new_ui )

And using

del new_ui

or

new_ui = None

To try to clear it but to no avail. Help?

User avatar
Andredron
Miko-Class Veteran
Posts: 697
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: 54 mini game Renpy

#58 Post by Andredron »

CatNip23 wrote: Fri Dec 09, 2022 8:31 pm Hello, I seem to be having a problem with the dog minigame #10, specifically with the replayability.

I managed to get it to work, but when I start new round, it looks like the one before stays under, and the fish that are under are invisible.
I think it comes from the ui.add( FishCatcherGame() ) from line 256, because the only way to replay it that I found was to call ui.add again, but it seems that the previous ui is not cleared. I have tried to clear it but I just can't.

I also tried assigning it to a variable like:

Code: Select all

new_ui = FishCatcherGame()

ui.add( new_ui )

And using

del new_ui

or

new_ui = None

To try to clear it but to no avail. Help?
I have been climbing into it for so long that I forgot how to remove the called script in the old version.

Code: Select all


label fish_catcher:
    window hide None
    scene bg background
    with fade

    python:
        ui.add( FishCatcherGame() )
        ui.interact( suppress_overlay=True, suppress_underlay=True )
        
label wingame:
    "you won"
    jump aftergame
    return

label lossgame:
    "YOu lost"
    "Too bad"

python: ui.add and ui.interact( suppress_overlay=True, suppress_underlay=True )
you called the code, but I don't remember how to close it anymore

CatNip23
Newbie
Posts: 9
Joined: Wed Jul 29, 2020 12:16 pm
Contact:

Re: 54 mini game Renpy

#59 Post by CatNip23 »

My editor says that ui.add is obsolete, but I don't know what to use in its place, and I can find almost nothing about it.

Regarding my problem, I was able to solve it. It was nothing related to the ui.add however. My fish were just spawning outside the screen. I fixed that

thexerox123
Regular
Posts: 127
Joined: Fri Jan 20, 2023 3:21 pm
itch: thexerox123
Contact:

Re: 62 mini game Renpy

#60 Post by thexerox123 »

If you're still adding new minigames to the list, I've tied a bow on this thread that I was getting help in: viewtopic.php?f=8&t=66003&p=558337#p558337

Uploaded a standalone version of the minigame to itch.io and pasted the final code into the thread, if you wanted to add it to the list! :)

Post Reply

Who is online

Users browsing this forum: No registered users