Arrays of images?

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
rockets
Newbie
Posts: 21
Joined: Wed Apr 15, 2015 2:16 pm
Projects: jerkcity_ebooks dating sim
Tumblr: dickmissiles
Contact:

Arrays of images?

#1 Post by rockets »

I'm trying to get one of my scenes to show a random background image from my already-defined background images.
I attempted to use a list to achieve this, but it doesn't seem to be working.
This is the current code I have:

Code: Select all

image bg hall = "hall.jpg"
image bg room = "room.jpg"
image bg field = "field.jpg"

Code: Select all

init python:
    bg_list = [hall,room,field]

Code: Select all

$currentbg = renpy.random.choice(bg_list)
show currentbg

philat
Eileen-Class Veteran
Posts: 1910
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Arrays of images?

#2 Post by philat »

Better way to do it is probably using ATL. http://lemmasoft.renai.us/forums/viewto ... 51&t=16604 Scroll down to randomized lightning and see how to use choice.

Post Reply

Who is online

Users browsing this forum: Google [Bot]