martom13 wrote: ↑Sat Oct 28, 2023 12:58 pm
I know that maybe somebody will be upset that I am asking this very basic thing. But even after several mounts I didn´t find it.
![Crying or Very sad :cry:](./images/smilies/icon_cry.gif)
Because probably everyone knows how to do it. So nobody teaching it /showing it.
Nobody will get upset, but please put your code into [ code ] ... [ /code ] (without the spaces) tags next time you post here. It's hard to read otherwise.
$ lucy_love = lucy_love +1
...
$ lucy_love += 1
What is the different? Work both.
It's doing the same, just two methods of writing it in Python. Welcome to the world of programming.
![Wink ;)](./images/smilies/icon_wink.gif)
The latter one is a shorter variant.
The same would apply to this:
Code: Select all
$ mike_love = 5
$ lucy_love = lucy_love + mike_love
# is the same as
$ lucy_love += mike_love
But how I will reset it? Like if main character will go with Jane instead of Lucy. Lucy is upset and he should lost all his points. Then I need $ lucy_love -= ?? I tried just $ lucy_love == 0. Didn´t work.
Or..how to make it not going into minus (below zero).
Code: Select all
# set the variable to 50
$ lucy_love = 50
# increase by 5
$ lucy_love += 5
# decrease by 2
$ lucy_love -= 2
# multiply by 2
$ lucy_love *= 2
# reduce it by 5, but make sure it's not below zero afterwards
$ lucy_love -= 5
if lucy_love < 0:
$ lucy_love = 0
# reduce it by 5, but not below zero (alternative)
$ lucy_love = max(0, lucy_love - 5)
Another issue for example with positions of pictures.
I can´t find how to use command "show" with more possibilities then "at left" "at right" "at center"...
For sure I saw that people are using two or three characters on one side...but HOW?
Can I use xpos, ypos, xalign, yalign with commands like "show" "scene" ?
Because I tried and it didn´t work...but..It could just be wrong spacing.
Actually the "at" statement sounds like it defines only position (which confused me when I was learning about Renpy many years ago). But "at" refers to
ATL transforms, which are definitions for position, but also transformations, so movements, rotations, alpha values etc. So don't think of it as just some kind of position. Also you can create your own ATL statements.
Code: Select all
# show a picture using the "center" transform (which is predefined by Renpy)
show eileen at center
# same thing, different method (and this is how you can use xalign, xpos etc.)
show eileen:
xalign 0.5 yalign 1.0
I saw videos where they use command "image", but again..what is difference from "show".
Those are different things, but some people use them in the wrong way.
The "image" statement is only used for
defining images (usually when Renpy is loading). The "image" statement is *not* for showing images. For most images in your game, you
do not have to define them ever though. Since Renpy is detecting all images inside your "images" folder by default, so they are already available when you start the game. Here you can read more about both statements:
https://www.renpy.org/doc/html/displaying_images.html
When I create button...can I put there something else then "jump" like command for show or counting like $ lucy_love += 1 etc. ?
Yes, here you can read all about screen element actions (stuff you can make a button do for example):
https://www.renpy.org/doc/html/screen_actions.html
Examples:
Code: Select all
screen myscreen():
vbox:
textbutton "Increase Lucy's love!" action SetVariable("lucy_love", lucy_love + 1)
textbutton "Jump somewhere..." action Jump("label_name")