Imagemap or what?

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
iDweadith
Regular
Posts: 63
Joined: Sun Mar 01, 2020 4:15 pm
Contact:

Imagemap or what?

#1 Post by iDweadith » Mon May 25, 2020 7:41 am

So guys, I have a question
In my game I want a character in the mid of the screen, but also, I want that on click on the character it opens a menu with choices and I don't know what's the best way to do that, imagebutton, imagemap?

The image has a transparent png background

User avatar
Per K Grok
Miko-Class Veteran
Posts: 728
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1 & 2
itch: per-k-grok
Location: Sverige
Contact:

Re: Imagemap or what?

#2 Post by Per K Grok » Mon May 25, 2020 9:33 am

iDweadith wrote:
Mon May 25, 2020 7:41 am
So guys, I have a question
In my game I want a character in the mid of the screen, but also, I want that on click on the character it opens a menu with choices and I don't know what's the best way to do that, imagebutton, imagemap?

The image has a transparent png background
You can do this with a plain button

Code: Select all

screen openmenu():
    button area(144, 253, 51, 87) action Jump("menu")
You decide where on the game screen you put the button and its width and height (x, y, w, h). The button can cover the whole character or part of it as you chose.

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

Re: Imagemap or what?

#3 Post by Imperf3kt » Mon May 25, 2020 10:35 am

To be honest, an image button would be easier / more convenient - you can set focus_mask to True and only the non-alpha regions of the image will respond, allowing for more shapes than just a rectangle
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Free Android GUI - Updated occasionally

User avatar
iDweadith
Regular
Posts: 63
Joined: Sun Mar 01, 2020 4:15 pm
Contact:

Re: Imagemap or what?

#4 Post by iDweadith » Mon May 25, 2020 11:48 am

Yes! Focus Mask is what I was looking for Thanks

Post Reply

Who is online

Users browsing this forum: darkhorse