Image naming

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
User avatar
dvemail
Regular
Posts: 35
Joined: Sat May 28, 2016 1:50 pm
Projects: Working on Patronus
IRC Nick: dvemail
Deviantart: ObdurateDemand
Github: dvemail
Contact:

Image naming

#1 Post by dvemail » Sat Feb 18, 2017 3:29 am

I've looked at the docs and scanned through the cookbook stuff I thought apropos, but I still don't understand the image naming conventions.

I have a directory "game/images/Char1"
In that directory I have three files, "Char1.png", "Char1 left.png" and "Char1 right.png"

In the game I refer to

show Char1 right at right

But I don't get the image at all, just a generic black anime girl outline.
So, a couple of questions

1. Do I have to explicitly define an "image Char1 = " etc for every thing and character, or is any of it automagic?
2. What's the tag order for matching image name components?

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Image naming

#2 Post by Divona » Sat Feb 18, 2017 3:42 am

Ren'Py doesn't do capital letters for auto images. Do:

Code: Select all

show char1 right at right
Completed:
Image

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

Re: Image naming

#3 Post by Imperf3kt » Sat Feb 18, 2017 5:47 am

You can define an image in two ways.
One is
define image <name> = "path.extension"
Where <name> is whatever you decide to call the image with and path.extension is the image name, example Char1.png
You use this outside any labels in your game.

Another way, is to call the image from within the line, so for example:
show image "Char1.png"
But this way will take considerably more typing if you reuse any of the images more than once.

Code: Select all

image char1 = "Char1.png"
image char2 = "Char2.png"
image char3 = "Char3.png"
image char4 = "Char4.png"

label start:
    show char1
    "Hi, I'm character one."
    show char2
    "Hi, I'm character two."
    show char3
    "Hi, I'm character three."
    show char4
    "Hi, I'm character four."

    return
Is the same as

Code: Select all

label start:
    show image "Char1.png"
    "Hi, I'm character one."
    show image "Char2.png"
    "Hi, I'm character two."
    show image "Char3.png"
    "Hi, I'm character three."
    show image "Char4.png"
    "Hi, I'm character four."

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

Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Image naming

#4 Post by IrinaLazareva » Sat Feb 18, 2017 11:36 am


Post Reply

Who is online

Users browsing this forum: _ticlock_