83 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: 731
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

83 mini game Renpy

#1 Post by Andredron »

Soon, each minigame will be provided with a video, and in the description of the video code and where to download it (youtube limit 8 videos per day)

1)
Game "Search for items" in one line
viewtopic.php?p=478861#p478861
Renpy 8 http://renpyfordummies.blogspot.com/202 ... y.html?m=1

2)
Primitive clicker
viewtopic.php?p=478863#p478863
viewtopic.php?f=8&t=39777

3)
3 in 1 row
viewtopic.php?p=486054#p486054

4,5,6) Image
3 simple card mini games.
viewtopic.php?p=487368#p487368

7)
Memoria
viewtopic.php?p=487375#p487375

8)
2048
viewtopic.php?p=487378#p487378

9) Image
QTE
viewtopic.php?p=488400#p488400

10)
Dog fishing
viewtopic.php?p=489693#p489693

Size edit
https://www.reddit.com/r/RenPy/comments ... ?context=3

11)
chess test
https://github.com/RuolinZheng08/renpy-chess

12)
Fable2
viewtopic.php?p=490843#p490843

13)
Corsare (Not commerce)
viewtopic.php?f=45&t=50225


14)
fable fishing
viewtopic.php?p=506086#p506086
https://www.bilibili.com/read/cv18210668

15)
Gitar of hero
viewtopic.php?f=8&t=29439#p348727

https://github.com/RuolinZheng08/renpy-rhythm

https://github.com/CharlieFuu69/RenPy_RhythmBeats

16)
Do not be caught!
https://github.com/zantyru/renpy-do-not-be-caught

17) Image
Mini game search for a bug
viewtopic.php?p=553307#p553307

18)
Tortichki
viewtopic.php?f=11&t=15121

19) Clue minigame
https://github.com/Daniellozanorodr/Clue_Renpy

20) Squid game
viewtopic.php?f=8&t=60428&p=535483&hili ... me#p535483

21)
Skyrim/Fallout-style Lockpicking Mini-Game
viewtopic.php?f=51&t=58049
https://github.com/kaodachet/Renpy-lockpick-minigame

22)

Сonnect the dots
viewtopic.php?f=8&t=57541
viewtopic.php?f=8&t=65755

23)
Tir
Code
https://github.com/ColoradoStark/Renpy_Shooter
Download the finished project - https://disk.yandex.ru/d/JxsAFpMk7zs6xg

24)
card game Triple triad
https://github.com/saiffyros/Triple-Triad_AI

25)
Reversi
https://github.com/jsfehler/renpy-reversi
https://github.com/limnological/renpy-go

26)
Minigame with matches
https://github.com/NyashniyVladya/gameWithMatches/

27)
Image
Tetris
viewtopic.php?f=51&t=52871

28)
https://sun9-11.userapi.com/impf/c84472 ... type=album
Ren'py Vertical Word Puzzle
viewtopic.php?f=11&t=30840#p360279

29)
https://sun9-63.userapi.com/impf/c84472 ... type=album
Sudoku
viewtopic.php?f=8&t=14066#p185595

30)
Shooter / Shmup / Shoot 'em Up prototype
viewtopic.php?f=51&t=49085
https://github.com/jsfehler/renpy-shooter


31)
Image
Solitaire
viewtopic.php?f=43&t=37133&p=404141#p404141
viewtopic.php?f=8&t=24626&p=304081&hili ... me#p304081

32)
Spot the Difference
viewtopic.php?f=51&t=36835&p=402101#p402101

33)Point and Click Sample
viewtopic.php?f=51&t=20541

34)
Strip 69
viewtopic.php?f=30&t=24989&p=307729#p307729

35)
Puzzle
viewtopic.php?f=51&t=16151&p=270918#p270918

36)
blackjack
viewtopic.php?f=8&t=56837&p=519226&hili ... me#p519226

37)
Dragon and coins
viewtopic.php?f=8&t=65071

38)
Snake v.1
viewtopic.php?f=8&t=65119

39) facing monsters
viewtopic.php?f=8&t=65141&p=554542#p554542

40)

renpy-space-invaders
https://github.com/pass-by-reference/re ... e-invaders

41)

SameGame
https://www.youtube.com/watch?v=nvMP9g1 ... z&index=12
https://www.patreon.com/posts/samegame-mini-on-61884755

42) Clean the banana snake
viewtopic.php?p=554914#p554914

43) Drawing a flashlight with a creator-defined displayable
viewtopic.php?t=20872

44)
Image
Game board

viewtopic.php?f=8&t=56394
viewtopic.php?f=8&t=55947&p=514658#p514658

45)
Image
Labyrinth

viewtopic.php?f=8&t=59490
viewtopic.php?f=51&t=19245#p249267
viewtopic.php?f=51&t=59463

46)
Catapult
viewtopic.php?f=8&t=54276

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

48)Python coding mini game
https://github.com/alicerunsonfedora/renpy-codeit-game

49)Hit the hamster
Image
Download https://disk.yandex.ru/d/FbxLci_3iAInLg

50)
Code - viewtopic.php?p=243934#p243934
Download the finished project - https://disk.yandex.ru/d/VKeyhz2dTeiM7A

51)
Finding Items. Version 2
viewtopic.php?p=235921#p235921

52)
Advanced Shooting Range
viewtopic.php?p=556863#p556863

53)
Puzzle
viewtopic.php?p=267460#p267460

54)
Racing in the form of numbers
viewtopic.php?p=395929#p395929

55)
Numbers
viewtopic.php?p=235918#p235918

56)
Snake v.2
https://github.com/pass-by-reference/go-game


57)
RhythmGame v.2
https://github.com/NyashniyVladya/RhythmGame

58)
Combination lock
viewtopic.php?f=51&t=51868

59)
Combination lock
https://www.youtube.com/watch?v=_0mvFUw ... v1JiuXxWyo

60)
Flappy bird
viewtopic.php?p=556983#p556983

61) Jacks Or Better draw poker
viewtopic.php?f=51&t=65838


62)
Runner
https://m.vk.com/wall-7553243_64810

63) ChristmasCranes
viewtopic.php?f=8&t=66003&start=30

64) Airship Battle
https://salator.itch.io/airship-battle

65)

RenPyDraw(Ren'Py 8.0.3 )
https://github.com/NyashniyVladya/RenPyDraw
renpy-freehand-draw(Renpy 7.3 and below versions)
https://github.com/jsfehler/renpy-freehand-draw

viewtopic.php?f=8&t=51370

66)
Tiny World Cardgame
viewtopic.php?f=11&t=14935&p=556977#p194570

67)
Fall Fair (5mini game)
viewtopic.php?f=45&t=14073&p=556974#p556974

68)
Nes emulator(no commerc.)
viewtopic.php?f=8&t=66378

GB emulator - https://github.com/Pseurae/rengbpy

69)
Ren'Py Sliding Puzzle
https://youtube.com/watch?v=STgjUMPUVn0&t=22s

70)
Ren'Py Snakes and Ladders
https://github.com/Redpika/RenPySL

71) Image
Zombie-Knigg platformer(demo)

https://github.com/GemmySystem/Zombie-Knight

72) Tetris(2version)
https://github.com/Mikan-DS/RenPy_Tetris

73) Shooter
viewtopic.php?f=8&t=67022

74) Coop and Robbers(TWO-PLAYER Mode) Not for commerce
https://pilgrimcreations.itch.io/copsrobbers


75) Rhaier Dungeon Prototype (TWO-PLAYER Mode) Not for commerce
https://pilgrimcreations.itch.io/rhaier ... -prototype

76) Renpy-ShootingGamePlugin-FPS
https://github.com/Wendy-Nam/Renpy-Shoo ... Plugin-FPS

77) FPS
https://seo-a-nam.itch.io/shooting-game-v1

78) Trivia game template
https://dmochas-assets.itch.io/trivia-game-template

79) Fisher
https://saelinstudios.itch.io/fishing-mini-game

80) Chrome Dino Runner
https://github.com/BlackRam-oss/Chrome-Dino-Runner

81) Mines
viewtopic.php?p=565019#p565019

82) Elfdjek
viewtopic.php?p=565308#p565308

83)
Dice
viewtopic.php?p=567258#p567258
Last edited by Andredron on Thu May 23, 2024 2:21 am, edited 117 times in total.

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

1) Card mini-games

#2 Post by Andredron »

Image

Game "Search for items" in one line
http://renpyfordummies.blogspot.ru/2015 ... -post.html - Download the finished project

Code: Select all

###by 7dots Ruslan Nebykov
###license: cc by-sa
###free use, when specifying the author
# This is a mini-game to find items
# save this code to the game.rpy file in the root of the game

# Called like this:
# $ InitGame("bg_room", 5.0, True, (735, 300), "figure1", (640, 226), "figure2", (288, 38), "figure3", (115, 260), "figure4")
# $ StartGame()
# where bg_room is the name of the background file without an extension .jpg
# 5.0 - the number of seconds to execute the search (if <= 0, the timer is disabled)
# (735, 300), "figure1" - coordinates and file name of the object
# without extension .png
# items can be as many as you like
# all backgrounds and pictures of objects should be in the images folder
# at the exit - true or false (met within the allotted time or not)
# number of items found in the variable oLen
# total number of items in the variable maxLen

# $ GameAsBG () # shows the screen with pictures as a background, not clickable

# in the sounds folder should be the sound of "click.mp3"
# or, if it does not, then comment out the line:
# renpy.play ("sounds / click.mp3", channel = "sound")
init python:
    # window in the center of the screen
    import os
    os.environ ['SDL_VIDEO_CENTERED'] = '1'
    # automatic sprites
    config.automatic_images_minimum_components = 1
    config.automatic_images = ['', '_', '/']
    config.automatic_images_strip = ["images"]
    oXY = []
    oN = []
    oLen = 0
    maxLen = 0
    oBg = ""
    oLast = -1
    oTime = 0.0
    oMaxTime = 5.0
    needTimer = False
    oActive = False

    # Initialize the game, placing items on the screen
    def InitGame (bg, time, * args):
        global oBg, oXY, oN, oLen, maxLen, oLast, oTime, oMaxTime, oActive, needTimer
        oXY = []
        oN = []
        oLen = 0
        oBg = bg
        oLast = -1
        oTime = time
        oMaxTime = time
        maxLen = 0
        oActive = True
        if oTime> 0.0:
            needTimer = True
        for xy, obj_name in zip (args [0 :: 2], args [1 :: 2]):
            oXY.append (xy)
            oN.append (obj_name)
            maxLen + = 1

    # Running the game
    def StartGame ():
        global oActive
        oActive = True
        while (oLen <maxLen) and ((oTime> 0.0) or not needTimer):
            renpy.call_screen ("game", _layer = "master")
        if oTime> 0.0 or not needTimer:
            return True
        else:
            return False

    # Show the game screen as an inactive background
    # Items already found will not be displayed
    def GameAsBG ():
        global oActive
        oActive = False
        renpy.show_screen ("game", _layer = "master")

    # The click handler for the item
    def oClick ():
        global oLen
        if oLast> = 0:
            if oN [oLast]:
                oN [oLast] = ""
                oLen + = 1
                renpy.play ("sounds / click.mp3", channel = "sound")

# Actually the game screen, run from the function StartGame ()
screen game:
    if oActive and needTimer:
        timer 0.01 repeat True action [SetVariable ("oTime", oTime - .01), If (oTime <= .0, true = [Hide ("game"), Return (-1)])]
    add oBg
    for i in range (0, len (oN)):
        if oN [i]:
            imagebutton:
                focus_mask True
                pos (oXY [i])
                idle oN [i]
                hover oN [i]
                # You can duplicate pictures of objects,
                # naming them "images / name of the subject_hover.png"
                # and highlight them in the image editor
                # and replace the line above with a line below
                # then when you hover the cursor, they will be highlighted
                # hover oN [i] + "hover"
                if oActive:
                    action [SetVariable ("oLast", i), oClick (), Hide ("game"), Return (i)]
                else:
                    action []
    if oActive and needTimer:
        # if oTime> .1:
            # text "[oTime]" align (.1, .1) size 48
        # else:
            # text "0.0" align (.1, .1) size 48
        bar value StaticValue (oTime, oMaxTime):
            align (.5, .001)
            xmaximum 400
            ymaximum 20
            left_bar Frame ("slider_left.png", 10, 10)
            right_bar Frame ("slider_right.png", 10, 10)
            thumb None
            thumb_shadow None
Last edited by Andredron on Wed May 23, 2018 3:55 am, edited 2 times in total.

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

2) Primitive clicker

#3 Post by Andredron »

Image

http://renpyfordummies.blogspot.ru/2016 ... st_10.html - Download the finished project

Code: Select all

###by 7dots Ruslan Nebykov
###license: cc by-sa
###free use, when specifying the author
init python:
    # game window in the center of the screen
    import os
    os.environ ['SDL_VIDEO_CENTERED'] = '1'
    # auto image ads
    config.automatic_images_minimum_components = 1
    config.automatic_images = ['', '_', '/']
    config.automatic_images_strip = ['images']
    # flash
    flash = Fade (.25, 0, .5, color = "# fff")
    flash2 = Fade (.25, 0, .5, color = "# 222")

# game settings:
    # maximum scale value
    max_points = 100
    # the name of the picture (without numbering frames)
    img_name = "n"
    # first and last animation frames
    minN = 1
    maxN = 14
    # value, to which the scale is added when clicking
    # (ie, the complexity of the game, 2.0 is very difficult, 3.0 is easy)
    points_plus = 2.5

# default variables
    # If desired, you can change this value, too,
    # to better find the balance of the game
    points_minus = 1.0
    # allowable time between clicks or
    # Animation speed (time between frames)
    ani_time = .1
    # current frame
    number = 0
    # Frame increment (+ 1 / -1)
    plus = 1
    # Scale to fill
    points = 0
    # recently was a click
    clicked = True
    # Changing animation frames if clicking was recently
    # and redraw the screen to see the changes
    def NextFrameF ():
        global points, number, plus, clicked
        # If the click was recently, then we continue the animation,
        # else the next frame will not be. pause
        if clicked:
            # next / previous frame
            number + = plus
            # If beyond the number of frames, then the animation in the opposite direction
            if number> maxN:
                number = maxN - 1
                plus = -plus
            if number <minN:
                number = minN + 1
                plus = -plus
        # Scaling down if there is no longer a click
        points - = points_minus
        if points <0:
            points = 0
        clicked = False
        # redraw the screen
        renpy.restart_interaction ()
    #function → action
    NextFrame = renpy.curry (NextFrameF)

# screen game
screen clicker:
    # this is so that the game does not go on clicking the mouse
    modal True
    # reset the game settings when the screen appears
    on "show" action [SetVariable ("number", 0), SetVariable ("plus", 1), SetVariable ("clicked", True)]
    # change the frame if the click was recently,
    # and check for a loss
    timer ani_time repeat True action [NextFrame (), If (points <= 0, true = Return (False), false = NullAction ())]
    # picture with animation
    add img_name + str (number)
    # display invisible button for clicks
    # click on add a scale and set the click flag
    button:
        text _ ("")
        xfill True
        yfill True
        background "# 00000001"
        # If the scale is full, then the end of the game, victory
        action [SetVariable ("points", points + points_plus), SetVariable ("clicked", True), If (points> = max_points, true = Return (True), false = NullAction ())]
    # Alternative keypress
    key "K_SPACE" action [SetVariable ("points", points + points_plus), SetVariable ("clicked", True), If (points> = max_points, true = Return (True), false = NullAction ())]
    # indicator
    vbar value StaticValue (points, max_points):
        align (0, 0) # position on the screen
        maximum (150, 150) # dimensions
        left_bar "heartempty" # empty heart
        right_bar "heart" # full heart
        thumb None # you can put a separator here
        thumb_shadow None # and shadow

label start:
    # any unnecessary pieces for registration
    scene expression (img_name + "0")
    pause .5
    show expression Text ("Prepared!") at truecenter as txt
    with dissolve
    pause
    hide txt
    # Start with 10 points to not lose immediately
    $ points = 10

    # ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
    call screen clicker # ← game
    # ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑

    # Further all unnecessary things went again:
    # show the results of the game
    if _return:
        # rewind the animation to the last frame
        while number <maxN:
            $ number + = 1
            scene expression (img_name + str (number))
            $ renpy.pause (ani_time, hard = True)
        scene expression (img_name + str (maxN))
        with flash
        show expression Text ("Victory!") at truecenter as txt
    else:
        # rewind the animation to the first frame
        while number> 1:
            $ number - = 1
            scene expression (img_name + str (number))
            $ renpy.pause (ani_time, hard = True)
        scene expression (img_name + "0")
        with flash2
        show expression Text ("Loss.") at truecenter as txt
    # A hard pause in case the player is still tapping on the button
    $ renpy.pause (1.0, hard = True)
    hide txt
    with dissolve
    return
    
Last edited by Andredron on Wed May 23, 2018 3:57 am, edited 1 time in total.

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

3) 3 in 1 row

#4 Post by Andredron »

The license is free, but I'll be glad if ty specify the author - = a = Firestorm (https://vk.com/a_firestorm)

Image
https://vk.com/wall-7553243_41708?post_add#post_add download project

kry.rpy

Code: Select all

#cl1, cl2, cl3, cl4, cl5, cl6, cl7 are the horizontal rows
#krix- selected stone
#krix0- 2 stone you want to change

#kricol - it seems that something superfluous
#pointka - number of points
#ktmr - timer
#clp1, clp2, clp3, clp4, clp5, clp6, clp7- this is for animation
#mcnn - Style

# image any one can write down, simply changing the value here
# imagebutton idle ("k" + str (globals () ["cl" + str (z)] [i]) + ". w")
# on
# imagebutton idle ("k" + str (globals () ["cl" + str (z)] [i]) + ". png")


image kg="kg.w"   #background image
init python:
    import time
    style.mcnn=Style(style.default)
    style.mcnn.set_parent(style.button)
    style.mcnn.color="#beddff"
    style.mcnn.size=70
    style.mcnn.outlines=[(2,"#6e6e6e",0,0)]
    def krib():
        global cl1,cl2,cl3,cl4,cl5,cl6,cl7,kricol,krix,krix0,pointka,ktmr,clp1,clp2,clp3,clp4,clp5,clp6,clp7
        for i in range(0,9):
            if cl1[i]>0:
                clzz=1
                if i<7:
                    if cl1[i]==cl1[i+1]==cl1[i+2]:
                        pointka+=(cl1[i]+cl1[i+1]+cl1[i+2])*2
                        if i<6 and cl1[i]==cl1[i+3]:
                            if i<5 and cl1[i]==cl1[i+4]:
                                pointka+=cl1[i+4]*4
                                ktmr+=4
                                cl1[i+4]=0
                            pointka+=cl1[i+3]*3
                            ktmr+=2
                            cl1[i+3]=0
                        clzz,cl1[i+1],cl1[i+2]=0,0,0
                if cl1[i]==cl2[i]==cl3[i]:
                    pointka+=(cl1[i]+cl2[i]+cl3[i])*2
                    if cl1[i]==cl4[i]:
                        if cl1[i]==cl5[i]:
                            pointka+=cl5[i]*4
                            ktmr+=4
                            cl5[i]=0
                        pointka+=cl4[i]*3
                        ktmr+=2
                        cl4[i]=0
                    clzz,cl2[i],cl3[i]=0,0,0
                if clzz==0:
                    cl1[i]=0
        renpy.pause(0.05)
        for i in range(0,9):
            if cl2[i]>0:
                clzz=1
                if i<7:
                    if cl2[i]==cl2[i+1]==cl2[i+2]:
                        pointka+=(cl2[i]+cl2[i+1]+cl2[i+2])*2
                        if i<6 and cl2[i]==cl2[i+3]:
                            if i<5 and cl2[i]==cl2[i+4]:
                                pointka+=cl2[i+4]*4
                                ktmr+=4
                                cl2[i+4]=0
                            pointka+=cl2[i+3]*3
                            ktmr+=2
                            cl2[i+3]=0
                        clzz,cl2[i+1],cl2[i+2]=0,0,0
                if cl2[i]==cl3[i]==cl4[i]:
                    pointka+=(cl2[i]+cl3[i]+cl4[i])*2
                    if cl2[i]==cl5[i]:
                        if cl2[i]==cl6[i]:
                            pointka+=cl6[i]*4
                            ktmr+=4
                            cl6[i]=0
                        pointka+=cl5[i]*3
                        ktmr+=2
                        cl5[i]=0
                    clzz,cl3[i],cl4[i]=0,0,0
                if clzz==0:
                    cl2[i]=0
        renpy.pause(0.05)
        for i in range(0,9):
            if cl3[i]>0:
                clzz=1
                if i<7:
                    if cl3[i]==cl3[i+1]==cl3[i+2]:
                        pointka=(cl3[i]+cl3[i+1]+cl3[i+2])*2
                        if i<6 and cl3[i]==cl3[i+3]:
                            if i<5 and cl3[i]==cl3[i+4]:
                                pointka+=cl3[i+4]*4
                                ktmr+=4
                                cl3[i+4]=0
                            pointka+=cl3[i+3]*3
                            ktmr+=2
                            cl3[i+3]=0
                        clzz,cl3[i+1],cl3[i+2]=0,0,0
                if cl3[i]==cl4[i]==cl5[i]:
                    pointka+=(cl3[i]+cl4[i]+cl5[i])*2
                    if cl3[i]==cl6[i]:
                        pointka+=cl6[i]*3
                        ktmr+=2
                        cl6[i]=0
                    clzz,cl4[i],cl5[i]=0,0,0
                if clzz==0:
                    cl3[i]=0
        renpy.pause(0.05)
        for i in range(0,9):
            if cl4[i]>0:
                clzz=1
                if i<7:
                    if cl4[i]==cl4[i+1]==cl4[i+2]:
                        pointka+=(cl4[i]+cl4[i+1]+cl4[i+2])*2
                        if i<6 and cl4[i]==cl4[i+3]:
                            if i<5 and cl4[i]==cl4[i+4]:
                                pointka+=cl4[i+4]*4
                                ktmr+=4
                                cl4[i+4]=0
                            pointka+=cl4[i+3]*3
                            ktmr+=2
                            cl4[i+3]=0
                        clzz,cl4[i+1],cl4[i+2]=0,0,0
                if cl4[i]==cl5[i]==cl6[i]:
                    pointka+=(cl4[i]+cl5[i]+cl6[i])*2
                    clzz,cl5[i],cl6[i]=0,0,0
                if clzz==0:
                    cl4[i]=0
        renpy.pause(0.05)
        for i in range(0,7):
            if cl5[i]>0:
                if cl5[i]==cl5[i+1]==cl5[i+2]:
                    pointka+=(cl5[i]+cl5[i+1]+cl5[i+2])*2
                    if i<6 and cl5[i]==cl5[i+3]:
                        if i<5 and cl5[i]==cl5[i+4]:
                            pointka+=cl5[i+4]*4
                            ktmr+=4
                            cl5[i+4]=0
                        pointka+=cl5[i+3]*3
                        ktmr+=2
                        cl5[i+3]=0
                    cl5[i],cl5[i+1],cl5[i+2]=0,0,0
        renpy.pause(0.05)
        for i in range(0,7):
            if cl6[i]>0:
                if cl6[i]==cl6[i+1]==cl6[i+2]:
                    pointka+=(cl6[i]+cl6[i+1]+cl6[i+2])*2
                    if i<6 and cl6[i]==cl6[i+3]:
                        if i<5 and cl6[i]==cl6[i+4]:
                            pointka+=cl6[i+4]*4
                            ktmr+=4
                            cl6[i+4]=0
                        pointka+=cl6[i+3]*3
                        ktmr+=2
                        cl6[i+3]=0
                    cl6[i],cl6[i+1],cl6[i+2]=0,0,0
        for i in range(0,9):
            if cl6[i]==0:
                clp5[i]-=32
                if cl5[i]>0:
                    cl6[i]=cl5[i]
                    cl5[i]=0
                elif cl4[i]>0:
                    cl6[i]=cl4[i]
                    cl4[i]=0
                elif cl3[i]>0:
                    cl6[i]=cl3[i]
                    cl3[i]=0
                elif cl2[i]>0:
                    cl6[i]=cl2[i]
                    cl2[i]=0
                elif cl1[i]>0:
                    cl6[i]=cl1[i]
                    cl1[i]=0
                else:
                    cl6[i]=renpy.random.randint(1,6)
                for q in range(4):
                    clp5[i]+=8
                    renpy.pause(.0000001)
                ktmr+=0.1
        for i in range(0,9):
            if cl5[i]==0:
                clp5[i]-=32
                if cl4[i]>0:
                    cl5[i]=cl4[i]
                    cl4[i]=0
                elif cl3[i]>0:
                    cl5[i]=cl3[i]
                    cl3[i]=0
                elif cl2[i]>0:
                    cl5[i]=cl2[i]
                    cl2[i]=0
                elif cl1[i]>0:
                    cl5[i]=cl1[i]
                    cl1[i]=0
                else:
                    cl5[i]=renpy.random.randint(1,6)
                for q in range(4):
                    clp5[i]+=8
                    renpy.pause(.0000001)
                ktmr+=0.1
        for i in range(0,9):
            if cl4[i]==0:
                clp4[i]-=32
                if cl3[i]>0:
                    cl4[i]=cl3[i]
                    cl3[i]=0
                elif cl2[i]>0:
                    cl4[i]=cl2[i]
                    cl2[i]=0
                elif cl1[i]>0:
                    cl4[i]=cl1[i]
                    cl1[i]=0
                else:
                    cl4[i]=renpy.random.randint(1,6)
                for q in range(4):
                    clp4[i]+=8
                    renpy.pause(.0000001)
                ktmr+=0.1
        for i in range(0,9):
            if cl3[i]==0:
                clp3[i]-=32
                if cl2[i]>0:
                    cl3[i]=cl2[i]
                    cl2[i]=0
                elif cl1[i]>0:
                    cl3[i]=cl1[i]
                    cl1[i]=0
                else:
                    cl3[i]=renpy.random.randint(1,6)
                for q in range(4):
                    clp3[i]+=8
                    renpy.pause(.0000001)
                ktmr+=0.1
        for i in range(0,9):
            if cl2[i]==0:
                clp2[i]-=32
                if cl1[i]>0:
                    cl2[i]=cl1[i]
                    cl1[i]=0
                else:
                    cl2[i]=renpy.random.randint(1,6)
                for q in range(4):
                    clp2[i]+=8
                    renpy.pause(.0000001)
                ktmr+=0.1
        for i in range(0,9):
            if cl1[i]==0:
                clp1[i]-=32
                cl1[i]=renpy.random.randint(1,6)
                for w in range(4):
                    clp1[i]+=8
                    renpy.pause(.0000001)
                ktmr+=0.1
        return
screen krix:
    text"[pointk]"style"mcnn"
    text str(int(ktmr))style"mcnn"xalign.99
    timer 1 repeat True action If(ktmr>0,true=SetVariable('ktmr',ktmr-1),false=Return())
    for z in range(1,7):
        for i in range(0,9):
            imagebutton idle("k"+str(globals()["cl"+str(z)][i])+".w")xpos(i*80+260)ypos(z*80+20)action[SetVariable('krix',i),SetVariable('kriy',z),ui.callsinnewcontext("krich")]
screen krixx:
    text"[pointk]"style"mcnn"
    text str(int(ktmr)) style"mcnn"xalign.99
    timer 1 repeat True action If(ktmr>0,true=SetVariable('ktmr',ktmr-1),false=Return())
    for z in range(1,7):
        for i in range(0,9):
            image("k"+str(globals()["cl"+str(z)][i])+".w")xpos(i*80+260)ypos(z*80+20+globals()["clp"+str(z)][i])
label krich:
    show screen krixx
    if krix>=0:
        if krix in(krix0+1,krix0-1)and kriy==kriy0:
            pass
        elif kriy in(kriy0+1,kriy0-1)and krix==krix0:
            pass
        else:
            jump krich3
        if krix0>=0:
            $krixxx=globals()["cl"+str(kriy)][krix]
            $globals()["cl"+str(kriy)][krix]=globals()["cl"+str(kriy0)][krix0]
            $globals()["cl"+str(kriy0)][krix0]=krixxx
            label krich2:
                $krib()
                if pointka>0:
                    $pointloop+=1
                    $pointk+=pointka
                    $pointka=0
                    jump krich2
                if pointloop==0:
                    $krixxx=globals()["cl"+str(kriy0)][krix0]
                    $globals()["cl"+str(kriy0)][krix0]=globals()["cl"+str(kriy)][krix]
                    $globals()["cl"+str(kriy)][krix]=krixxx
                $pointloop=0
                $krix=-1
                $krix0=-1
        else:
            label krich3:
                $krix0=krix
                $kriy0=kriy
    return
label krix:
    scene kg
    python:
        cl0,cl1,cl2,cl3,cl4,cl5,cl6,cl7,krix,kriy,kris,krin,kriw,krie,kricol,krix,krix0,kriy,kriy0,pointk,pointloop,ktmr,pointka=[],[],[],[],[],[],[],[],0,0,0,0,0,0,0,-1,-1,-1,-1,0,0,120,0
        for z in range(1,7):
            for i in range(0,9):
                globals()["cl"+str(z)].append(renpy.random.randint(1,6))
        clp0,clp1,clp2,clp3,clp4,clp5,clp6,clp7=[],[],[],[],[],[],[],[]
        for z in range(1,7):
            for i in range(0,9):
                globals()["clp"+str(z)].append(0)
    call screen krix
    return
Last edited by Andredron on Sat Jun 26, 2021 6:48 pm, edited 4 times in total.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3807
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: 6 mini-games

#5 Post by Imperf3kt »

Thanks for creating these!
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

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

4,5,6) 3 simple card mini games.

#6 Post by Andredron »

Image Image
The license is free, but I'll be glad if specify the author - = a = Firestorm (https://vk.com/ a_firestorm)
In file script.rpy

Code: Select all

define e = Character('Eileen', color="#c8ffc8")
###When you start the game in windowed mode, the window itself is sometimes on the edges,
### or somewhere in the corner, we'll, definitely not in the center. To fix this, just add these lines
init python hide:
    import os 
    os.environ['SDL_VIDEO_CENTERED'] = '1'

init python:
    import os
screen map:
    add "map.webp"
    imagebutton idle ("tb.webp") xalign .5 yalign .5 action [Return(),Jump("dom")]
screen tet:
    $ line=renpy.get_filename_line()
    text "[line]"
label start:
label kgames:
    menu:
        e "What will we play?"
        "At 21 points":
            $ renpy.call_in_new_context("card78")
        "Fool":
            $ renpy.call_in_new_context("card79")
        "Drunkard":
            $ renpy.call_in_new_context("card77")
    jump kgames
    return

1) 21 points or blackjack, in file card78.rpy
https://pp.userapi.com/c841623/v8416236 ... fY5t0g.jpg

Code: Select all

image tb = "tb.webp"
screen c78a:
    if btnn<5:
        textbutton "Another card" xalign .5 yalign .5 action [SetVariable("karta"+str(btnn),renpy.random.randint(2,11)),SetVariable("kartam"+str(btnn),renpy.random.choice([100,200,300,400])),SetVariable("kart"+str(btnn),renpy.random.randint(2,11)),SetVariable("kartm"+str(btnn),renpy.random.choice([100,200,300,400])),SetVariable("btnn",btnn+1),Jump("cpui")]
    textbutton "Enough" xalign .5 yalign .54 action Jump("cstand")
screen c78:
    hbox xalign .1:
        add str(kart1+kartm1)+".png"
        add str(kart2+kartm2)+".png"
        add str(kart3+kartm3)+".png"
        add str(kart4+kartm4)+".png"
    hbox xalign .1 yalign .94:
        add str(karta1+kartam1)+".png"
        add str(karta2+kartam2)+".png"
        add str(karta3+kartam3)+".png"
        add str(karta4+kartam4)+".png"
label card78:
    scene tb
    $ btnn=2
    $ kart1=renpy.random.randint(2,11)
    $ kartm1=renpy.random.choice([100,200,300,400])
    $ karta1=renpy.random.randint(2,11)
    $ kartam1=renpy.random.choice([100,200,300,400])
    $ kart2=0
    $ kart3=0
    $ kart4=0
    $ kartm2=0
    $ kartm3=0
    $ kartm4=0
    $ karta2=0
    $ karta3=0
    $ karta4=0
    $ kartam2=0
    $ kartam3=0
    $ kartam4=0
    $ cpupoint=kart1
    $ ipoint=karta1
label bgme:
    show screen c78
    show screen c78a
    e "Opponent - [cpupoint]\n Your cards - [ipoint]"
    jump bgme
label cpui:
    if cpupoint>16:
        if btnn==4:
            $ kart3=0
            $ kartm3=0
        if btnn==5:
            $ kart4=0
            $ kartm4=0
    $ cpupoint=kart1+kart2+kart3+kart4
    $ ipoint=karta1+karta2+karta3+karta4
    if cpupoint>21:
        if kart1==11:
            $ kart1=1
        elif kart2==11:
            $ kart2=1
        elif kart3==11:
            $ kart3=1
        elif kart4==11:
            $ kart4=1
        $ cpupoint=kart1+kart2+kart3+kart4
    if ipoint>21:
        if karta1==11:
            $ karta1=1
        elif karta2==11:
            $ karta2=1
        elif karta3==11:
            $ karta3=1
        elif karta4==11:
            $ karta4=1
        $ ipoint=karta1+karta2+karta3+karta4
    jump bgme
label cstand:
    hide screen c78a
    $ cpupoint=kart1+kart2+kart3+kart4
    $ ipoint=karta1+karta2+karta3+karta4
    if ipoint>21:
        if cpupoint>21:
            e "Draw"
        else:
            e "Losing bust"
    elif cpupoint>21:
        e "Victory"
    elif ipoint==cpupoint:
        e "Draw"
    elif ipoint>cpupoint:
        if cpupoint<17:
            if kart2==0:
                $ kart2=renpy.random.randint(2,11)
                $ kartm2=renpy.random.choice([100,200,300,400])
                jump cstand
            elif kart3==0:
                $ kart3=renpy.random.randint(2,11)
                $ kartm3=renpy.random.choice([100,200,300,400])
                jump cstand
            elif kart4==0:
                $ kart4=renpy.random.randint(2,11)
                $ kartm4=renpy.random.choice([100,200,300,400])
                jump cstand
        e "Victory"
    else:
        e "Loss"
    return

2) Fool card, 1 on 1 card79.rpy
https://pp.userapi.com/c841623/v8416236 ... w23P_E.jpg

Code: Select all

### Card, background, main buttons
screen c79:
    if cpua==1:
        textbutton "Pick up" xalign .5 yalign .7 action [SetVariable("kstep",0),SetVariable("tblnmb",set([0])),Jump("khodv")]
    else:
        if len(tblkardal)>1:
            textbutton "Finish the move" xalign .5 yalign .7 action [SetVariable("dhod",0),SetVariable("cpua",1),Jump("khodotb")]
    hbox xalign .1:
        if kart1!=0:
            add "krb.webp"
        if kart2!=0:
            add "krb.webp"
        if kart3!=0:
            add "krb.webp"
        if kart4!=0:
            add "krb.webp"
        if kart5!=0:
            add "krb.webp"
        if kart6!=0:
            add "krb.webp"
        if kart7!=0:
            add "krb.webp"
        if kart8!=0:
            add "krb.webp"
        if kart9!=0:
            add "krb.webp"
        if kart10!=0:
            add "krb.webp"
        if kart11!=0:
            add "krb.webp"
        if kart12!=0:
            add "krb.webp"
    hbox xpos .14 yalign .5:
        if len(tblkardal)>1:
            add str(tblkardal[1])+".png"
            if len(tblkarda)>2:
                add str(tblkardal[2])+".png"
                if len(tblkarda)>3:
                    add str(tblkardal[3])+".png"
                    if len(tblkarda)>4:
                        add str(tblkardal[4])+".png"
                        if len(tblkarda)>5:
                            add str(tblkardal[5])+".png"
                            if len(tblkarda)>6:
                                add str(tblkardal[6])+".png"
                                if len(tblkarda)>7:
                                    add str(tblkardal[7])+".png"
                                    if len(tblkarda)>8:
                                        add str(tblkardal[8])+".png"
                                        if len(tblkarda)>9:
                                            add str(tblkardal[9])+".png"
                                            if len(tblkarda)>10:
                                                add str(tblkardal[10])+".png"
                                                if len(tblkarda)>11:
                                                    add str(tblkardal[11])+".png"
                                                    if len(tblkarda)>12:
                                                        add str(tblkardal[12])+".png"
    hbox xpos .15 yalign .55:
        if len(tblkardzl)>1:
            add str(tblkardzl[1])+".png"
            if len(tblkardz)>2:
                add str(tblkardzl[2])+".png"
                if len(tblkardz)>3:
                    add str(tblkardzl[3])+".png"
                    if len(tblkardz)>4:
                        add str(tblkardzl[4])+".png"
                        if len(tblkardz)>5:
                            add str(tblkardzl[5])+".png"
                            if len(tblkardz)>6:
                                add str(tblkardzl[6])+".png"
                                if len(tblkardz)>7:
                                    add str(tblkardzl[7])+".png"
                                    if len(tblkardz)>8:
                                        add str(tblkardzl[8])+".png"
                                        if len(tblkardz)>9:
                                            add str(tblkardzl[9])+".png"
                                            if len(tblkardz)>10:
                                                add str(tblkardzl[10])+".png"
                                                if len(tblkardz)>11:
                                                    add str(tblkardzl[11])+".png"
                                                    if len(tblkardz)>12:
                                                        add str(tblkardzl[12])+".png"
    hbox yalign .5:
        add str(kozir)+".png" rotate -90
    if len(koloda)>0:
        hbox yalign .5:
            add "krb.webp"
    hbox xalign .1 yalign .94:
        if karta1!=0:
            imagebutton idle str(karta1)+".png" action [SetVariable("kartah",karta1),SetVariable("knmb",1),Jump("khod0")]
        if karta2!=0:
            imagebutton idle str(karta2)+".png" action [SetVariable("kartah",karta2),SetVariable("knmb",2),Jump("khod0")]
        if karta3!=0:
            imagebutton idle str(karta3)+".png" action [SetVariable("kartah",karta3),SetVariable("knmb",3),Jump("khod0")]
        if karta4!=0:
            imagebutton idle str(karta4)+".png" action [SetVariable("kartah",karta4),SetVariable("knmb",4),Jump("khod0")]
        if karta5!=0:
            imagebutton idle str(karta5)+".png" action [SetVariable("kartah",karta5),SetVariable("knmb",5),Jump("khod0")]
        if karta6!=0:
            imagebutton idle str(karta6)+".png" action [SetVariable("kartah",karta6),SetVariable("knmb",6),Jump("khod0")]
        if karta7!=0:
            imagebutton idle str(karta7)+".png" action [SetVariable("kartah",karta7),SetVariable("knmb",7),Jump("khod0")]
        if karta8!=0:
            imagebutton idle str(karta8)+".png" action [SetVariable("kartah",karta8),SetVariable("knmb",8),Jump("khod0")]
        if karta9!=0:
            imagebutton idle str(karta9)+".png" action [SetVariable("kartah",karta9),SetVariable("knmb",9),Jump("khod0")]
        if karta10!=0:
            imagebutton idle str(karta10)+".png" action [SetVariable("kartah",karta10),SetVariable("knmb",10),Jump("khod0")]
        if karta11!=0:
            imagebutton idle str(karta11)+".png" action [SetVariable("kartah",karta11),SetVariable("knmb",11),Jump("khod0")]
        if karta12!=0:
            imagebutton idle str(karta12)+".png" action [SetVariable("kartah",karta12),SetVariable("knmb",12),Jump("khod0")]
            
            
            
            
####Here begins the game
label card79:
    scene tb
    $ cpukarn=set([])
    $ knmb=0
    
    ####Cards register numbers
    $ koloda=set([102,103,104,105,106,107,108,109,110,111,202,203,204,205,206,207,208,209,210,211,302,303,304,305,306,307,308,309,310,311,402,403,404,405,406,407,408,409,410,411])
    
    ###Prescribe the cards that will first drop to the player
    $ kart1=renpy.random.choice(list(koloda))
    $ koloda.remove(kart1)
    $ kart2=renpy.random.choice(list(koloda))
    $ koloda.remove(kart2)
    $ kart3=renpy.random.choice(list(koloda))
    $ koloda.remove(kart3)
    $ kart4=renpy.random.choice(list(koloda))
    $ koloda.remove(kart4)
    $ kart5=renpy.random.choice(list(koloda))
    $ koloda.remove(kart5)
    $ kart6=renpy.random.choice(list(koloda))
    $ koloda.remove(kart6)
    $ kart7=0
    $ kart8=0
    $ kart9=0
    $ kart10=0
    $ kart11=0
    $ kart12=0
    
    ###I prescribe the cards that first drop the computer
    $ karta1=renpy.random.choice(list(koloda))
    $ koloda.remove(karta1)
    $ karta2=renpy.random.choice(list(koloda))
    $ koloda.remove(karta2)
    $ karta3=renpy.random.choice(list(koloda))
    $ koloda.remove(karta3)
    $ karta4=renpy.random.choice(list(koloda))
    $ koloda.remove(karta4)
    $ karta5=renpy.random.choice(list(koloda))
    $ koloda.remove(karta5)
    $ karta6=renpy.random.choice(list(koloda))
    $ koloda.remove(karta6)
    $ karta7=0
    $ karta8=0
    $ karta9=0
    $ karta10=0
    $ karta11=0
    $ karta12=0
    
    ###Trumps
    $ kozir=renpy.random.choice(list(koloda))
    $ koloda.remove(kozir)
    if kozir>400:    ###If the card starts with 4
        $ cozir=4
    elif kozir>300:    ###If the card starts with 3
        $ cozir=3
    elif kozir>200:    ###If the card starts with 2
        $ cozir=2
    else:                           ###If the card starts with 1
        $ cozir=1
    $ koziri=set([0])
    if karta1/100==cozir:
        $ koziri.add(karta1)
    if karta2/100==cozir:
        $ koziri.add(karta2)
    if karta3/100==cozir:
        $ koziri.add(karta3)
    if karta4/100==cozir:
        $ koziri.add(karta4)
    if karta5/100==cozir:
        $ koziri.add(karta5)
    if karta6/100==cozir:
        $ koziri.add(karta6)
    $ igkozir=max(koziri)
    $ koziri=set([0])
    if kart1/100==cozir:
        $ koziri.add(kart1)
    if kart2/100==cozir:
        $ koziri.add(kart2)
    if kart3/100==cozir:
        $ koziri.add(kart3)
    if kart4/100==cozir:
        $ koziri.add(kart4)
    if kart5/100==cozir:
        $ koziri.add(kart5)
    if kart6/100==cozir:
        $ koziri.add(kart6)
    $ cpukozir=max(koziri) ###computer all trumps
    if igkozir==0: ###player
        $ dhod=0
        $ cpua=1
    elif igkozir<cpukozir: ###player <computer
        $ dhod=1
        $ cpua=0
    else:
        $ dhod=0
        $ cpua=1
    $ tblkardz=set([0])
    $ tblkarda=set([0])
    $ tblkardzl=list("0")
    $ tblkardal=list("0")
    $ tblkarde=set([0])
    $ kartah=0
    $ kstep=0
    $ tblnmb=set([0])
    jump khod
    
    
    
label dgme:
    show screen c79

    e " "
    jump dgme
    
    
    
label khod0:
    if cpua==1:
        $ tblkardale=len(tblkardal)
        $ tblkardale=tblkardal[tblkardale-1]
        if (kartah/100)==cozir:
            if (tblkardale/100)==cozir:
                if kartah>tblkardale:
                    jump khod0a
            else:
                jump khod0a
        if tblkardale<200:
            if kartah<200:
                if kartah>tblkardale:
                    pass
                else:
                    jump dgme
            else:
                jump dgme
        elif tblkardale<300:
            if 200<kartah<300:
                if kartah>tblkardale:
                    pass
                else:
                    jump dgme
            else:
                jump dgme
        elif tblkardale<400:
            if 300<kartah<400:
                if kartah>tblkardale:
                    pass
                else:
                    jump dgme
            else:
                jump dgme
        else:
            if kartah>400:
                if kartah>tblkardale:
                    pass
                else:
                    jump dgme
            else:
                jump dgme
        label khod0a:
            $ tblkardz.add(kartah)
            $ tblkardzl.append(kartah)
    else:
        if len(tblkarda)>1:
            $ tblnmb.discard(0)
            $ tblnmb.add(tblkardal[kstep]%100)
            $ tblnmb.add(tblkardzl[kstep]%100)
            if kartah%100 not in(tblnmb):
                jump dgme
        $ kstep+=1
        $ tblkarda.add(kartah)
        $ tblkardal.append(kartah)
    $ globals()[("karta%s"%(knmb))]=0
    $ dhod=0
    
    
    ####Card when distributed here we get
label khod:
    if dhod==0:
        if cpua==1:
            jump khod2
        jump khod2i

    jump dgme
    
    
    
    
label khod1a:
    $ cpukarn=set([kart1,kart2,kart3,kart4,kart5,kart6,kart7,kart8,kart9,kart10,kart11,kart12])
    $ cpukarn.discard(0)
    $ igkarn=set([karta1,karta2,karta3,karta4,karta5,karta6,karta7,karta8,karta9,karta10,karta11,karta12])
    $ igkarn.discard(0)
    if len(cpukarn)<6:
        if len(koloda)<1:
            if len(igkarn)<1:
                jump dgwin
            if kozir==0:
                if len(cpukarn)<1:
                    jump dglose
                if cpua==0:
                    jump dgme
                jump khod2
            else:
                $ kartavz=kozir
                $ kozir=0
                jump kartavz1
        $ kartavz=renpy.random.choice(list(koloda))
        $ koloda.remove(kartavz)
        label kartavz1:
            if kart1==0:
                $ kart1=kartavz
            elif kart2==0:
                $ kart2=kartavz
            elif kart3==0:
                $ kart3=kartavz
            elif kart4==0:
                $ kart4=kartavz
            elif kart5==0:
                $ kart5=kartavz
            else:
                $ kart6=kartavz
        if len(igkarn)<6:
            if len(koloda)<1:
                if kozir==0:
                    if len(igkarn)<1:
                        jump dgwin
                    if cpua==0:
                        jump dgme
                    jump khod2
                else:
                    $ kartavz=kozir
                    $ kozir=0
                    jump kartavz2
            $ kartavz=renpy.random.choice(list(koloda))
            $ koloda.remove(kartavz)
            label kartavz2:
                if karta1==0:
                    $ karta1=kartavz
                elif karta2==0:
                    $ karta2=kartavz
                elif karta3==0:
                    $ karta3=kartavz
                elif karta4==0:
                    $ karta4=kartavz
                elif karta5==0:
                    $ karta5=kartavz
                else:
                    $ karta6=kartavz
    elif len(igkarn)<6:
        if len(koloda)<1:
            if kozir==0:
                if len(igkarn)<1:
                    jump dgwin
                if cpua==0:
                    jump dgme
                jump khod2
            else:
                $ kartavz=kozir
                $ kozir=0
                jump kartavz3
        $ kartavz=renpy.random.choice(list(koloda))
        $ koloda.remove(kartavz)
        label kartavz3:
            if karta1==0:
                $ karta1=kartavz
            elif karta2==0:
                $ karta2=kartavz
            elif karta3==0:
                $ karta3=kartavz
            elif karta4==0:
                $ karta4=kartavz
            elif karta5==0:
                $ karta5=kartavz
            else:
                $ karta6=kartavz
    else:
        if cpua==0:
            jump dgme
        jump khod2
    jump khod1a
    
    
    
label khod2:
    $ igkarn=set([karta1,karta2,karta3,karta4,karta5,karta6,karta7,karta8,karta9,karta10,karta11,karta12])
    $ igkarn.discard(0)
    if len(igkarn)<1:
        $ dhod=1
        $ cpua=0
        jump khodotb
    if len(tblkarda)>1+kstep:
        $ tblnmb.discard(0)
        $ cpukarn=set([])
        $ tblnmb.add(tblkardal[kstep+1]%100)
        $ tblnmb.add(tblkardzl[kstep+1]%100)
        $ kstep+=1
        if kart1%100 in tblnmb:
            $ cpukarn.add(kart1)
        if kart2%100 in tblnmb:
            $ cpukarn.add(kart2)
        if kart3%100 in tblnmb:
            $ cpukarn.add(kart3)
        if kart4%100 in tblnmb:
            $ cpukarn.add(kart4)
        if kart5%100 in tblnmb:
            $ cpukarn.add(kart5)
        if kart6%100 in tblnmb:
            $ cpukarn.add(kart6)
        if kart7%100 in tblnmb:
            $ cpukarn.add(kart7)
        if kart8%100 in tblnmb:
            $ cpukarn.add(kart8)
        if kart9%100 in tblnmb:
            $ cpukarn.add(kart9)
        if kart10%100 in tblnmb:
            $ cpukarn.add(kart10)
        if kart11%100 in tblnmb:
            $ cpukarn.add(kart11)
        if kart12%100 in tblnmb:
            $ cpukarn.add(kart12)
        if len(cpukarn)<1:
            $ dhod=1
            $ cpua=0
            jump khodotb
        jump khod2a
        
        
label khod2i:
    $ cpukarn=set([kart1,kart2,kart3,kart4,kart5,kart6,kart7,kart8,kart9,kart10,kart11,kart12])
    $ cpukarnc=set([])
    $ cpukarn.discard(0)
    if len(cpukarn)<1:
        jump dglose
    if kart1/100==cozir:
        $ cpukarnc.add(kart1)
    if kart2/100==cozir:
        $ cpukarnc.add(kart2)
    if kart3/100==cozir:
        $ cpukarnc.add(kart3)
    if kart4/100==cozir:
        $ cpukarnc.add(kart4)
    if kart5/100==cozir:
        $ cpukarnc.add(kart5)
    if kart6/100==cozir:
        $ cpukarnc.add(kart6)
    if kart7/100==cozir:
        $ cpukarnc.add(kart7)
    if kart8/100==cozir:
        $ cpukarnc.add(kart8)
    if kart9/100==cozir:
        $ cpukarnc.add(kart9)
    if kart10/100==cozir:
        $ cpukarnc.add(kart10)
    if kart11/100==cozir:
        $ cpukarnc.add(kart11)
    if kart12/100==cozir:
        $ cpukarnc.add(kart12)
    if cpua==0:
        $ cpukarn=set([])
        $ kartaa=len(tblkardal)-1
        $ kartaa=tblkardal[kartaa]
        if kartaa%100<kart1%100:
            if kartaa/100==kart1/100:
                $ cpukarn.add(kart1)
        if kartaa%100<kart2%100:
            if kartaa/100==kart2/100:
                $ cpukarn.add(kart2)
        if kartaa%100<kart3%100:
            if kartaa/100==kart3/100:
                $ cpukarn.add(kart3)
        if kartaa%100<kart4%100:
            if kartaa/100==kart4/100:
                $ cpukarn.add(kart4)
        if kartaa%100<kart5%100:
            if kartaa/100==kart5/100:
                $ cpukarn.add(kart5)
        if kartaa%100<kart6%100:
            if kartaa/100==kart6/100:
                $ cpukarn.add(kart6)
        if kartaa%100<kart7%100:
            if kartaa/100==kart7/100:
                $ cpukarn.add(kart7)
        if kartaa%100<kart8%100:
            if kartaa/100==kart8/100:
                $ cpukarn.add(kart8)
        if kartaa%100<kart9%100:
            if kartaa/100==kart9/100:
                $ cpukarn.add(kart9)
        if kartaa%100<kart10%100:
            if kartaa/100==kart10/100:
                $ cpukarn.add(kart10)
        if kartaa%100<kart11%100:
            if kartaa/100==kart11/100:
                $ cpukarn.add(kart11)
        if kartaa%100<kart12%100:
            if kartaa/100==kart12/100:
                $ cpukarn.add(kart12)
        jump khod2a
    $ cpukarn-=cpukarnc
    
    
    
    
label khod2a:
    if len(cpukarn)==0:
        if kartaa/100==cozir:
            if cpua==0:
                jump khodvc
        if len(cpukarnc)>0:
            $ cpukar=min(cpukarnc)
            jump khod2u
        else:
            jump khodvc
        $ cpukarn=set([kart1,kart2,kart3,kart4,kart5,kart6,kart7,kart8,kart9,kart10,kart11,kart12])
        $ cpukarn.discard(0)
    $ cpukar=min(cpukarn)
    
    
    
    
label khod2u:
    if cpukar==kart1:
        $ kart1=0
    elif cpukar==kart2:
        $ kart2=0
    elif cpukar==kart3:
        $ kart3=0
    elif cpukar==kart4:
        $ kart4=0
    elif cpukar==kart5:
        $ kart5=0
    elif cpukar==kart6:
        $ kart6=0
    elif cpukar==kart7:
        $ kart7=0
    elif cpukar==kart8:
        $ kart8=0
    elif cpukar==kart9:
        $ kart9=0
    elif cpukar==kart10:
        $ kart10=0
    elif cpukar==kart11:
        $ kart11=0
    else:
        $ kart12=0
    if cpua==1:
        $ tblkarda.add(cpukar)
        $ tblkardal.append(cpukar)
    else:
        $ tblkardz.add(cpukar)
        $ tblkardzl.append(cpukar)
        $ cpukarn=set([kart1,kart2,kart3,kart4,kart5,kart6,kart7,kart8,kart9,kart10,kart11,kart12])
        $ cpukarn.discard(0)
        if len(cpukarn)<1:
            $ dhod=0
            $ cpua=1
            jump khodotb
    $ dhod=1
    jump khod
    
    
    
    
label khodv:
    if len(tblkardal)>1:
        $ kartavz=tblkardal[1]
        $ tblkarda.remove(kartavz)
        $ tblkardal.remove(kartavz)
        jump khodv1
    if len(tblkardzl)>1:
        $ kartavz=list(tblkardz)
        $ kartavz=kartavz[1]
        $ tblkardz.remove(kartavz)
        $ tblkardzl.remove(kartavz)
        jump khodv1
    jump khod1a
    
    
    
    
label khodv1:
    if karta1==0:
        $ karta1=kartavz
    elif karta2==0:
        $ karta2=kartavz
    elif karta3==0:
        $ karta3=kartavz
    elif karta4==0:
        $ karta4=kartavz
    elif karta5==0:
        $ karta5=kartavz
    elif karta6==0:
        $ karta6=kartavz
    elif karta7==0:
        $ karta7=kartavz
    elif karta8==0:
        $ karta8=kartavz
    elif karta9==0:
        $ karta9=kartavz
    elif karta10==0:
        $ karta10=kartavz
    elif karta11==0:
        $ karta11=kartavz
    elif karta12==0:
        $ karta12=kartavz
    else:
        jump dglose
    jump khodv
    
    
    
label khodvc:
    if len(tblkardal)>1:
        $ kartavz=tblkardal[1]
        $ tblkarda.remove(kartavz)
        $ tblkardal.remove(kartavz)
        jump khodv1c
    if len(tblkardzl)>1:
        $ kartavz=list(tblkardz)
        $ kartavz=kartavz[1]
        $ tblkardz.remove(kartavz)
        $ tblkardzl.remove(kartavz)
        jump khodv1c
    $ tblnmb=set([0])
    $ kstep=0
    $ tblkarda=set([0])
    $ tblkardal=list(["0"])
    $ tblkardz=set([0])
    $ tblkardzl=list(["0"])
    jump khod1a
    
    
    
label khodv1c:
    if kart1==0:
        $ kart1=kartavz
    elif kart2==0:
        $ kart2=kartavz
    elif kart3==0:
        $ kart3=kartavz
    elif kart4==0:
        $ kart4=kartavz
    elif kart5==0:
        $ kart5=kartavz
    elif kart6==0:
        $ kart6=kartavz
    elif kart7==0:
        $ kart7=kartavz
    elif kart8==0:
        $ kart8=kartavz
    elif kart9==0:
        $ kart9=kartavz
    elif kart10==0:
        $ kart10=kartavz
    elif kart11==0:
        $ kart11=kartavz
    elif kart12==0:
        $ kart12=kartavz
    else:
        jump dgwin
    jump khodvc
    
    
    
    
label khodotb:
    $ tblnmb=set([0])
    $ kstep=0
    $ tblkarda=set([0])
    $ tblkardal=list(["0"])
    $ tblkardz=set([0])
    $ tblkardzl=list(["0"])
    jump khod1a
    
    
    
label dglose:
    hide screen c79
    e "Loss"
    return
    
label dgwin:
    hide screen c79
    e "Victory"
    return
    
label dgnich:
    hide screen c79
    e "Draw"
    return
3) Drunkard, 1 on 1 card77.rpy

Code: Select all

screen c77:
    if len(koloda)<1:
        textbutton "Pass" xalign .5 yalign .7 action [SetVariable("dhod",0),SetVariable("igpass",1),Jump("khodp")]
    else:
        textbutton "Take a card" xalign .5 yalign .7 action Jump("khodvр")
    hbox xalign .1:
        if kart1!=0:
            add "krb.webp"
        if kart2!=0:
            add "krb.webp"
        if kart3!=0:
            add "krb.webp"
        if kart4!=0:
            add "krb.webp"
        if kart5!=0:
            add "krb.webp"
        if kart6!=0:
            add "krb.webp"
        if kart7!=0:
            add "krb.webp"
        if kart8!=0:
            add "krb.webp"
        if kart9!=0:
            add "krb.webp"
        if kart10!=0:
            add "krb.webp"
        if kart11!=0:
            add "krb.webp"
        if kart12!=0:
            add "krb.png"
    hbox yalign .5 xalign .44:
        add str(kozir)+".png"
    if len(koloda)>0:
        hbox yalign .5 xalign .56:
            add "krb.webp"
    hbox xalign .1 yalign .94:
        if karta1!=0:
            imagebutton idle str(karta1)+".png" action [SetVariable("kartah",karta1),SetVariable("knmb",1),Jump("khodp")]
        if karta2!=0:
            imagebutton idle str(karta2)+".png" action [SetVariable("kartah",karta2),SetVariable("knmb",2),Jump("khodp")]
        if karta3!=0:
            imagebutton idle str(karta3)+".png" action [SetVariable("kartah",karta3),SetVariable("knmb",3),Jump("khodp")]
        if karta4!=0:
            imagebutton idle str(karta4)+".png" action [SetVariable("kartah",karta4),SetVariable("knmb",4),Jump("khodp")]
        if karta5!=0:
            imagebutton idle str(karta5)+".png" action [SetVariable("kartah",karta5),SetVariable("knmb",5),Jump("khodp")]
        if karta6!=0:
            imagebutton idle str(karta6)+".png" action [SetVariable("kartah",karta6),SetVariable("knmb",6),Jump("khodp")]
        if karta7!=0:
            imagebutton idle str(karta7)+".png" action [SetVariable("kartah",karta7),SetVariable("knmb",7),Jump("khodp")]
        if karta8!=0:
            imagebutton idle str(karta8)+".png" action [SetVariable("kartah",karta8),SetVariable("knmb",8),Jump("khodp")]
        if karta9!=0:
            imagebutton idle str(karta9)+".png" action [SetVariable("kartah",karta9),SetVariable("knmb",9),Jump("khodp")]
        if karta10!=0:
            imagebutton idle str(karta10)+".png" action [SetVariable("kartah",karta10),SetVariable("knmb",10),Jump("khodp")]
        if karta11!=0:
            imagebutton idle str(karta11)+".png" action [SetVariable("kartah",karta11),SetVariable("knmb",11),Jump("khodp")]
        if karta12!=0:
            imagebutton idle str(karta12)+".png" action [SetVariable("kartah",karta12),SetVariable("knmb",12),Jump("khodp")]
label card77:
    scene tb
    $ cpukarn=set([])
    $ knmb=0
    $ igpass=0
    $ koloda=set([102,103,104,105,106,107,108,109,110,111,202,203,204,205,206,207,208,209,210,211,302,303,304,305,306,307,308,309,310,311,402,403,404,405,406,407,408,409,410,411])
    $ kart1=renpy.random.choice(list(koloda))
    $ koloda.remove(kart1)
    $ kart2=renpy.random.choice(list(koloda))
    $ koloda.remove(kart2)
    $ kart3=renpy.random.choice(list(koloda))
    $ koloda.remove(kart3)
    $ kart4=renpy.random.choice(list(koloda))
    $ koloda.remove(kart4)
    $ kart5=renpy.random.choice(list(koloda))
    $ koloda.remove(kart5)
    $ kart6=renpy.random.choice(list(koloda))
    $ koloda.remove(kart6)
    $ kart7=renpy.random.choice(list(koloda))
    $ koloda.remove(kart7)
    $ kart8=0
    $ kart9=0
    $ kart10=0
    $ kart11=0
    $ kart12=0
    $ karta1=renpy.random.choice(list(koloda))
    $ koloda.remove(karta1)
    $ karta2=renpy.random.choice(list(koloda))
    $ koloda.remove(karta2)
    $ karta3=renpy.random.choice(list(koloda))
    $ koloda.remove(karta3)
    $ karta4=renpy.random.choice(list(koloda))
    $ koloda.remove(karta4)
    $ karta5=renpy.random.choice(list(koloda))
    $ koloda.remove(karta5)
    $ karta6=renpy.random.choice(list(koloda))
    $ koloda.remove(karta6)
    $ karta7=renpy.random.choice(list(koloda))
    $ koloda.remove(karta7)
    $ karta8=0
    $ karta9=0
    $ karta10=0
    $ karta11=0
    $ karta12=0
    $ kozir=renpy.random.choice(list(koloda))
    $ koloda.remove(kozir)
    $ igkozir=max(karta1,karta2,karta3,karta4,karta5,karta6,karta7)
    $ cpukozir=max(kart1,kart2,kart3,kart4,kart5,kart6,kart7)
    if igkozir>cpukozir:
        $ dhod=1
    else:
        $ dhod=0
    $ kartah=0
label khodp:
    if dhod==0:
        jump khod2ip
    if kartah/100==kozir/100:
        $ kozir=kartah
        $ globals()[("karta%s"%(knmb))]=0
        $ dhod=0
        $ igkarn=set([karta1,karta2,karta3,karta4,karta5,karta6,karta7,karta8,karta9,karta10,karta11,karta12])
        $ igkarn.discard(0)
        if len(igkarn)<1:
            jump pgwin
        jump khod2ip
    elif kartah%100==kozir%100:
        $ kozir=kartah
        $ globals()[("karta%s"%(knmb))]=0
        $ dhod=0
        $ igkarn=set([karta1,karta2,karta3,karta4,karta5,karta6,karta7,karta8,karta9,karta10,karta11,karta12])
        $ igkarn.discard(0)
        if len(igkarn)<1:
            jump pgwin
        jump khod2ip
label pgme:
    show screen c77
    e "..."
    jump pgme
label khod2ip:
    $ cpukarn=set([])
    if kozir/100==kart1/100:
        $ cpukarn.add(kart1)
    if kozir/100==kart2/100:
        $ cpukarn.add(kart2)
    if kozir/100==kart3/100:
        $ cpukarn.add(kart3)
    if kozir/100==kart4/100:
        $ cpukarn.add(kart4)
    if kozir/100==kart5/100:
        $ cpukarn.add(kart5)
    if kozir/100==kart6/100:
        $ cpukarn.add(kart6)
    if kozir/100==kart7/100:
        $ cpukarn.add(kart7)
    if kozir/100==kart8/100:
        $ cpukarn.add(kart8)
    if kozir/100==kart9/100:
        $ cpukarn.add(kart9)
    if kozir/100==kart10/100:
        $ cpukarn.add(kart10)
    if kozir/100==kart11/100:
        $ cpukarn.add(kart11)
    if kozir/100==kart12/100:
        $ cpukarn.add(kart12)
    if kozir%100==kart1%100:
        $ cpukarn.add(kart1)
    if kozir%100==kart2%100:
        $ cpukarn.add(kart2)
    if kozir%100==kart3%100:
        $ cpukarn.add(kart3)
    if kozir%100==kart4%100:
        $ cpukarn.add(kart4)
    if kozir%100==kart5%100:
        $ cpukarn.add(kart5)
    if kozir%100==kart6%100:
        $ cpukarn.add(kart6)
    if kozir%100==kart7%100:
        $ cpukarn.add(kart7)
    if kozir%100==kart8%100:
        $ cpukarn.add(kart8)
    if kozir%100==kart9%100:
        $ cpukarn.add(kart9)
    if kozir%100==kart10%100:
        $ cpukarn.add(kart10)
    if kozir%100==kart11%100:
        $ cpukarn.add(kart11)
    if kozir%100==kart12%100:
        $ cpukarn.add(kart12)
    if len(cpukarn)<1:
        if len(koloda)<1:
            if igpass==1:
                if kart1+kart2+kart3+kart4+kart5+kart6+kart7>karta1+karta2+karta3+karta4+karta5+karta6+karta7:
                    jump pgwin
                jump pglose
            jump pppas
        $ kartavz=renpy.random.choice(list(koloda))
        $ koloda.remove(kartavz)
        if kart1==0:
            $ kart1=kartavz
        elif kart2==0:
            $ kart2=kartavz
        elif kart3==0:
            $ kart3=kartavz
        elif kart4==0:
            $ kart4=kartavz
        elif kart5==0:
            $ kart5=kartavz
        elif kart6==0:
            $ kart6=kartavz
        elif kart7==0:
            $ kart7=kartavz
        elif kart8==0:
            $ kart8=kartavz
        elif kart9==0:
            $ kart9=kartavz
        elif kart10==0:
            $ kart10=kartavz
        elif kart11==0:
            $ kart11=kartavz
        elif kart12==0:
            $ kart12=kartavz
        else:
            jump pgwin
        jump khod2ip
    $ kozir=renpy.random.choice(list(cpukarn))
    if kozir==kart1:
        $ kart1=0
    elif kozir==kart2:
        $ kart2=0
    elif kozir==kart3:
        $ kart3=0
    elif kozir==kart4:
        $ kart4=0
    elif kozir==kart5:
        $ kart5=0
    elif kozir==kart6:
        $ kart6=0
    elif kozir==kart7:
        $ kart7=0
    elif kozir==kart8:
        $ kart8=0
    elif kozir==kart9:
        $ kart9=0
    elif kozir==kart10:
        $ kart10=0
    elif kozir==kart11:
        $ kart11=0
    else:
        $ kart12=0
    $ cpukarn=set([kart1,kart2,kart3,kart4,kart5,kart6,kart7,kart8,kart9,kart10,kart11,kart12])
    $ cpukarn.discard(0)
    if len(cpukarn)<1:
        jump pglose
label pppas:
    $ dhod=1
    $ igpass=0
    jump pgme
label khodvр:
    $ kartavz=renpy.random.choice(list(koloda))
    $ koloda.remove(kartavz)
    if karta1==0:
        $ karta1=kartavz
    elif karta2==0:
        $ karta2=kartavz
    elif karta3==0:
        $ karta3=kartavz
    elif karta4==0:
        $ karta4=kartavz
    elif karta5==0:
        $ karta5=kartavz
    elif karta6==0:
        $ karta6=kartavz
    elif karta7==0:
        $ karta7=kartavz
    elif karta8==0:
        $ karta8=kartavz
    elif karta9==0:
        $ karta9=kartavz
    elif karta10==0:
        $ karta10=kartavz
    elif karta11==0:
        $ karta11=kartavz
    elif karta12==0:
        $ karta12=kartavz
    else:
        jump pglose
    jump pgme
label pglose:
    hide screen c77
    e "Loss"
    return
label pgwin:
    hide screen c77
    e "Victory"
    return
Download the finished version (only the buttons there in Russian are made) https://vk.com/doc189145553_451441774?h ... c0cff9b871

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

7) Memoria

#7 Post by Andredron »

Image
http://renpyfordummies.blogspot.ru/2015/08/memoria.html Download the finished project
Finished a little mini-game to memorize. Now the program checks the folder "images" for files of the type "card _ *. Png", where "*" - preferably the letter of the English alphabet. Required pictures are "card_back.png" and "card_empty.png" (card shirt and empty picture). If the picture-cards are small (<2, not including the empty and the shirt), then the text mode (img_mode = False) will turn on. If you set the field to 3x3 (ww, hh = 3, 3), then one cell will remain empty.

Code: Select all

init python:

    # DEFAULT GAME SETTINGS:

    # default card type set
    all_cards = ['A', 'B', 'C']
    # width and height of the field
    ww = 3
    hh = 3
    # how many cards can be opened for 1 turn
    max_c = 2
    # text size in the card for text mode
    card_size = 48
    # time allocated for the passage
    max_time = 25
    # pause before the cards disappear
    wait = 0.5
    # mode of cards with images, not with the text
    img_mode = True

    values_list = []
    temp = []
    # we announce picture cards
    # must be in the format "images / card _ *. png"
    # required "card_back.png" and "card_empty.png"
    for fn in renpy.list_files ():
        if fn.startswith ("images / card_") and fn.endswith ((". png")):
            name = fn [12: -4]
            renpy.image ("card" + name, fn)
            if name! = "empty" and name! = "back":
                temp.append (str (name))
    # if the picture found> 1,
    # then change the set of card types, but the file names
    if len (temp)> 1:
        all_cards = temp
    else:
        # otherwise turn on the text mode,
        # because the pictures are very small
        img_mode = False

    # the function of initializing the playing field
    def cards_init ():
        global values_list
        values_list = []
        while len (values_list) + max_c <= ww * hh:
            current_card = renpy.random.choice (all_cards)
            for i in range (0, max_c):
                values_list.append (current_card)
        renpy.random.shuffle (values_list)
        while len (values_list) <ww * hh:
            values_list.append ('empty')

# screen game
screen memo_scr:
    # timer
    timer 1.0 action If (memo_timer> 1, SetVariable ("memo_timer", memo_timer - 1), Jump ("memo_game_lose")) repeat True
    # field
    grid ww hh:
        align (.5, .5) # in the center
        for card in cards_list:
            button:
                left_padding 0
                right_padding 0
                top_padding 0
                bottom_padding 0
                background None
                if card ["c_value"] == 'empty':
                    if img_mode:
                        add "card empty"
                    else:
                        text "" size card_size
                else:
                    if card ["c_chosen"]:
                        if img_mode:
                            add "card" + card ["c_value"]
                        else:
                            text card ["c_value"] size card_size
                    else:
                        if img_mode:
                            add "card back"
                        else:
                            text "#" size card_size
                # pressing the button-card
                action If ((card ["c_chosen"] or not can_click), None, [SetDict (cards_list [card ["c_number"]], "c_chosen", True), Return (card ["c_number"])])
    text str (memo_timer) xalign .5 yalign 0.0 size card_size

# the game itself
label memoria_game:
    $ cards_init ()
    $ cards_list = []
    python:
        for i in range (0, len (values_list)):
            if values_list [i] == 'empty':
                cards_list.append ({"c_number": i, "c_value": values_list [i], "c_chosen": True})
            else:
                cards_list.append ({"c_number": i, "c_value": values_list [i], "c_chosen": False})
    $ memo_timer = max_time
    # show the game screen
    show screen memo_scr
    # main game loop
    label memo_game_loop:
        $ can_click = True
        $ turned_cards_numbers = []
        $ turned_cards_values ​​= []
        $ turns_left = max_c
        label turns_loop:
            if turns_left> 0:
                $ result = ui.interact ()
                $ memo_timer = memo_timer
                $ turned_cards_numbers.append (cards_list [result] ["c_number"])
                $ turned_cards_values.append (cards_list [result] ["c_value"]
                $ turns_left - = 1
                jump turns_loop
        # prevent opening of extra cards
        $ can_click = False
        if turned_cards_values.count (turned_cards_values ​​[0])! = len (turned_cards_values):
            $ renpy.pause (wait, hard = True)
            python:
                for i in range (0, len (turned_cards_numbers)):
                    cards_list [turned_cards_numbers [i]] ["c_chosen"] = False
        else:
            $ renpy.pause (wait, hard = True)
            python:
                for i in range (0, len (turned_cards_numbers)):
                    cards_list [turned_cards_numbers [i]] ["c_value"] = 'empty'
                for j in cards_list:
                    if j ["c_chosen"] == False:
                        renpy.jump ("memo_game_loop")
                renpy.jump ("memo_game_win")
        jump memo_game_loop

# loss
label memo_game_lose:
    hide screen memo_scr
    $ renpy.pause (0.1, hard = True)
    centered "{size = 36} Vdul! Re-Try. {/ size}"
    jump memoria_game
    
# winnings
label memo_game_win:
     hide screen memo_scr
     $ renpy.pause (0.1, hard = True)
     centered "{size = 36} {b} Winning! {/ b} {/ size}"
     return

# start-up example
# label start:
     # scene black
     # $ max_time = 60
     # $ ww, hh = 4, 4
     # call memoria_game
     # return
    
    

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

8) 2048

#8 Post by Andredron »

Image
Download the finished project http://renpyfordummies.blogspot.ru/2018/04/2048.html
###by 7dots Ruslan Nebykov
###license: cc by-sa
###free use, when specifying the author

User avatar
ComputerArt.Club
Veteran
Posts: 427
Joined: Mon May 22, 2017 8:12 am
Completed: Famous Fables, BoPoMoFo: Learn Chinese, Santa's workshop, Cat's Bath, Computer Art Club
Location: Taiwan
Contact:

Re: 8 mini games

#9 Post by ComputerArt.Club »

Cool! Do these work with the newest version of Renpy?

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: 8 mini games

#10 Post by gas »

3 in 1 can be really streamlined using some particular python method. I'll try for as it's a nice input.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

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

Re: 8 mini games

#11 Post by Andredron »

ComputerArt.Club wrote: Thu May 24, 2018 4:44 am Cool! Do these work with the newest version of Renpy?
On new versions they (games) work, trouble if there is a grid. They are all in one corner going to gui. 2 solutions are

1) Wise and use grid instead of hbox and vbox

2) Forgot what they write, like

Code: Select all

grid 4 3:
    xfill True
    yfill True
    ......
Last edited by Andredron on Thu May 24, 2018 4:26 pm, edited 1 time in total.

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

Re: 8 mini games

#12 Post by Andredron »

I would be glad, but here as in the saying:
Hatiko waited 6 years and I will wait
viewtopic.php?f=8&t=50002

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

9) QTE

#13 Post by Andredron »

Image

The game is qte. You need to click on certain buttons, earning points for a while. Each repetition deletes points.
Download https://m.vk.com/doc189145553_44265737 ... 657dc8d136

The license is free
Last edited by Andredron on Thu Jun 28, 2018 5:06 pm, edited 1 time in total.

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

Re: 10) Dog fishing

#14 Post by Andredron »

Image
download https://vk.com/doc189145553_440230785? ... 6e949f2048
Management of arrows, arrow forward capture fish


To make control buttons write

Code: Select all

label fish_catcher:
    window hide None

    scene bg background
    with fade

    python:
        fishGame = FishCatcherGame()
        fishGames = renpy.curry(fishGame.player.handleInput);
        ui.add( fishGame)
        ui.imagebutton("assets/minigame_fish_catcher/fish.png" ,"assets/minigame_fish_catcher/fish.png" ,clicked = fishGames("GRAB" ),width = 25,height = 25);
        ui.interact( suppress_overlay=True, suppress_underlay=True )
        

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

11)test Chess

#15 Post by Andredron »

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

Post Reply

Who is online

Users browsing this forum: No registered users