[SOLVED] 360' Scrollable image viewer code help

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
guiltyGG
Newbie
Posts: 13
Joined: Sat Aug 19, 2017 8:51 am
Contact:

[SOLVED] 360' Scrollable image viewer code help

#1 Post by guiltyGG »

Hi All,

As a game mechanic, I wanted to create something where you'd find an item, open your inventory viewer, click on the item, and be able to -- via a scrollbar or just dragging -- rotate the image around (like those 360' image viewers on click on the 360' View). The player could use this to search for 'clues' or just to get a better impression of an item, etc.

My theory was:
[*]create an image and store a reference to this image object (so I can affect its properties later)
[*]take values from a scrollbar and use to create a new image filepath (image_0.png, image_1.png, etc)
[*]change/update the image via its reference with the new image filepath (my_image = new_filepath)

I thought 'renpy.display.image.images[]' might help me control the image objects/attributes, but ... let's be honest, I'm lost, though very willing to learn ;)

Any help would be appreciated :)
Last edited by guiltyGG on Thu Jan 25, 2018 4:34 am, edited 1 time in total.

guiltyGG
Newbie
Posts: 13
Joined: Sat Aug 19, 2017 8:51 am
Contact:

Re: 360' Scrollable image viewer code help

#2 Post by guiltyGG »

Figured it out -- I forgot that screens constantly update.

So, by:

Code: Select all

$ array_pos = 0
define img = ["pic_01.png", "pic_02.png", ... ]

screen test:
    add img[array_pos]
then updating the array_pos variable elsewhere, you'll change the image to the next image in the array.

Didn't need to explore the inner workings of Ren'Py afterall, but was an informative trip anyway ;)

Post Reply

Who is online

Users browsing this forum: Google [Bot], Imperf3kt