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.
-
burnt_offering
- Regular
- Posts: 107
- Joined: Sun Feb 23, 2014 4:21 pm
- Completed: The Stroke of Midnight
- Organization: Ace Of Spades
- IRC Nick: burnt_offering or TheTapDancer
- Skype: aceofspadesvn
- itch: aceofspadesvn
- Location: London
-
Contact:
#1
Post
by burnt_offering » Thu Nov 20, 2014 9:05 am
Basically, I've been trying to code a gameplay element, in which at one point there's a door with a number lock on it.
Now, the code was fairly okay:
Code: Select all
screen GenCodeInput:
tag puzzle
use navigation
imagemap:
ground "gencode.png"
idle "gencode.png"
hover "gencodehover.png"
hbox:
for i in (0,9):
textbutton str(i):
if code==0:
code=i
elif code<10:
code= 10*code + i
elif code>9999:
codestring=str(code)
for ch in codestring:
codestring2 = str(codestring[-4:])
code = int(codestring2)
code = 10*code + i
ground "gencode(%code).png"
textbutton clear:
code=0
The problem is that this requires 10000 images, one for each possible number, which simply isn't feasible. Is there some way I can do this more efficiently?
-
Milkymalk
- Miko-Class Veteran
- Posts: 752
- Joined: Wed Nov 23, 2011 5:30 pm
- Completed: Don't Look (AGS game)
- Projects: KANPEKI! ★Perfect Play★
- Organization: Crappy White Wings
- Location: Germany
-
Contact:
#2
Post
by Milkymalk » Thu Nov 20, 2014 9:52 am
How about the way real code locks do it? 10 images for the numbers 0-9, 4 of them to display a 4-digit number?
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)
-
burnt_offering
- Regular
- Posts: 107
- Joined: Sun Feb 23, 2014 4:21 pm
- Completed: The Stroke of Midnight
- Organization: Ace Of Spades
- IRC Nick: burnt_offering or TheTapDancer
- Skype: aceofspadesvn
- itch: aceofspadesvn
- Location: London
-
Contact:
#3
Post
by burnt_offering » Thu Nov 20, 2014 10:52 am
Milkymalk wrote:How about the way real code locks do it? 10 images for the numbers 0-9, 4 of them to display a 4-digit number?
I guess if I used a different variable for each position I could do that.
Users browsing this forum: Bing [Bot]