Need help with Image Buttons! Am I doing something wrong?

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
Sereniv
Newbie
Posts: 2
Joined: Wed Nov 02, 2016 7:15 pm
Contact:

Need help with Image Buttons! Am I doing something wrong?

#1 Post by Sereniv »

Hello! This is my first time posting, on here or in a forum in general so be gentle;;

So below are some test images, just to practice with some code- and originally I was going to do imagemaps, but it only shows whatever is in the designated area- Which would be the door. Unless I'm doing it wrong?

These are the images

Image
Image


I have a few variations, one where they're combined, one where the hover is just the arm and light, etc.
And I just can't get it to where you scroll over one door and it shows left or right without it looking screwy.

But i came across image buttons and that seems like it'll give me what I want?

I want a click adventure- where there are objects to click on, but it'll get more complicated than something that's square, example being the pictures

Also, I really don't understand the imagebutton coding that much so could someone explain to me like a child- with where I place it, how I call the screens, etc.

User avatar
NialGrenville
Regular
Posts: 184
Joined: Tue Aug 30, 2016 6:30 pm
Projects: PaS: The Awakening; The Heart Woods; The Witch and the Fairy
Organization: Gabe Works, Inc.
Contact:

Re: Need help with Image Buttons! Am I doing something wrong

#2 Post by NialGrenville »

You'll want to use Imagemaps instead!

Imagebuttons are attached to the image, not to an object in an image. Like you want.
*Me*, *You, ***Calamazoo: *Singularity-A.I.*: *Proceed to processing
PaS: The Awakening, current status: 42%
The HeartWoods, current status: 0%
The Wonderful Mell! My PFI creator Honest Critique

Sereniv
Newbie
Posts: 2
Joined: Wed Nov 02, 2016 7:15 pm
Contact:

Re: Need help with Image Buttons! Am I doing something wrong

#3 Post by Sereniv »

NialGrenville wrote:You'll want to use Imagemaps instead!

Imagebuttons are attached to the image, not to an object in an image. Like you want.

But whenever I try the image map, this is what I get (ignore the lack of arm):

http://i.imgur.com/xZotKgS.png
rather than
http://i.imgur.com/0HW3KUj.png

Like I want (when hovered over the left option)

Here's what I have

Code: Select all


screen leftchoice:
    imagemap:
        ground "noarmbackground.png"


screen forestoptions:
    imagemap:
        ground "noarmbackground.png"
        hover "leftoption.png"
        
        hotspot (1047, 157, 213, 492) clicked Jump("left")
        hotspot (1379, 167, 210, 521) clicked Jump("right")
        

# The game starts here.

label start:
    "This is the beginning."
    jump forest

label forest:
    call screen forestoptions 


label left:
    show lchoice
    with fade
    
    
label lchoice:
    call screen leftchoice
    
And I've tried so many different ways

(Also the code is just for testing, and part of another code thats why its wonky at the end)

How do I fix the box part? How do I make the guy turn his flashlight on the left or right door depending on which you hover over?

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Need help with Image Buttons! Am I doing something wrong

#4 Post by trooper6 »

So what would I do?

I think what I'd do is have a screen. The screen has at its base the image. The image would have no doors, and the figure with no arm.
Then I would layer two imagebuttons, those buttons? The two doors.
Then last I would layer an image that is a ConditionSwitch. That image is the arm. It would have three states: flashlight off, flashlight left, flashlight right. You would need some variable that the conditionswitch triggers off of. Perhaps something like, door_choice. The default of these variable would be "neutral" and the none image would be the flashlight off.

The hovered action for the left door would be to change the door_choice variable to "left" which would change the ConditionSwitch to the flashlight left image.
The hovered action for the right door would be to change the door_choice variable to "right" which would change the ConditionSwitch to the flashlight right image.
You might have to have the unhovered action for the two door imagegbuttons change the door_choice variable back to "neutral"--but test that out.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: Google [Bot]