Adding mechanic.rpy to my game

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Mescalino
Newbie
Posts: 9
Joined: Fri Sep 15, 2017 5:40 am
Soundcloud: Mescalino
Contact:

Adding mechanic.rpy to my game

#1 Post by Mescalino »

I have created a file called mechanic.rpy
This is the code:

Code: Select all

#--------------------------------------------------------------------#
# * Configuration variables
#--------------------------------------------------------------------#
default friendship = 0
default love = 0
default lust = 0

#---------------------------------------------------------------------
# * GUI
#---------------------------------------------------------------------
screen gui_screen():

    add "gui/p lust.png" xalign 0.01 yalign 0.015
    add "gui/p stats.png" xalign 0.11 yalign 0.055


    text "{b}[friendship]{/b}" xalign 0.025 yalign 0.245 color "#000000"
    text "{b}[love]{/b}" xalign 0.0655 yalign 0.245 color "#000000"
    text "{b}[lust]{/b}" xalign 0.129 yalign 0.075 color "#010101"

init python:
    def ch_friendship(amount):
        global friendship
        friendship += amount

    def ch_love(amount):
        global love
        love += amount

    def ch_lust(amount):
        global lust
        lust += amount
I have 2 images one with a singel heart (lust) and one with 2 hearts (Friendship and love)
Pretty straightforward

How do i include this file in my game. When i start my game i dont see anything happening.

I asume i have to give some sort of include statement to my script.pry file but i dont know how.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Adding mechanic.rpy to my game

#2 Post by Remix »

Ren'py will have already found and included all .rpy files

All you really need to do is show the screen somewhere and it should work

label start:
... show screen gui_screen
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: Andredron