Hotspot [SOLVED]

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
senisanti
Regular
Posts: 94
Joined: Tue May 07, 2019 4:37 am
Projects: Allball, Smash scrap metal, Santi...
Location: Rennes
Contact:

Hotspot [SOLVED]

#1 Post by senisanti »

Hi friends

I have a lot of problems with the hotspot.

the first problem is that I can't get my images to appear.

Code: Select all

screen cualpre:
    imagemap:
        ground "corrido" and "amalia08" and "susana12" and "catia02" and "jimena24" and "carla06" and "monica09"
        hotspot (934,478,984,513) clicked [Hide("amalia08")]
        hotspot (314,131,390,200) clicked [Hide("susana12")]
        hotspot (1074,202,1163,288) clicked [Hide("catia02")]
        hotspot (605,494,669,553) clicked [Hide("jimena24")]
        hotspot (922,182,1007,242) clicked [Hide("carla06")]
        hotspot (409,418,454,461) clicked [Hide("monica09")]
corrido is a normal background:
the other images are PNG images

I tried many different ways with "and" there is only the last image that appears.
I also tried with several ground, but not possible.

how do I add several images to my ground?

I can't copy the PNG's into my background because the player has to make the girls disappear one and one until there is only 1 left or none left
Last edited by senisanti on Thu Aug 08, 2019 12:41 pm, edited 2 times in total.

User avatar
bonnie_641
Regular
Posts: 133
Joined: Sat Jan 13, 2018 10:57 pm
Projects: Código C.O.C.I.N.A.
Deviantart: rubymoonlily
Contact:

Re: Hotspot

#2 Post by bonnie_641 »

I'm sorry, but I don't understand what you want to do (Do you want to edit the background image? Add more images? What is an animated "gif"?)

Can you explain please?

The way to describe an imagemap is:

Code: Select all

imagemap:
    idle "image_idle.png"
    hover "image_hover.png"
    ground "image_ground.png"

    hotspot (position_x,position_y,width,height) action WHATEVER(event) 
where event: you can add Hide, SetVariable, etc.
I speak and write in Spanish. I use an English-Spanish translator to express myself in this forum. If I make any mistakes, please forgive me.
I try my best to give an answer according to your question. :wink:

User avatar
senisanti
Regular
Posts: 94
Joined: Tue May 07, 2019 4:37 am
Projects: Allball, Smash scrap metal, Santi...
Location: Rennes
Contact:

Re: Hotspot

#3 Post by senisanti »

I want to put a ground then 6 character in PNG that will disappear each in turn depending on the player's choices.

I don't know how to add png images and make them disappear in turn.

User avatar
bonnie_641
Regular
Posts: 133
Joined: Sat Jan 13, 2018 10:57 pm
Projects: Código C.O.C.I.N.A.
Deviantart: rubymoonlily
Contact:

Re: Hotspot

#4 Post by bonnie_641 »

There is an excellent example of the Trooper6 user showing and hiding characters per event.

Read this:
viewtopic.php?t=32215#p371798
I speak and write in Spanish. I use an English-Spanish translator to express myself in this forum. If I make any mistakes, please forgive me.
I try my best to give an answer according to your question. :wink:

User avatar
senisanti
Regular
Posts: 94
Joined: Tue May 07, 2019 4:37 am
Projects: Allball, Smash scrap metal, Santi...
Location: Rennes
Contact:

Re: Hotspot

#5 Post by senisanti »

Neither of the two solutions works...

that of Trooper6 have an error... "could not find a ground image for imagemap"
I downloaded the image file and installed them in my file but still the same error
I tried to change the names... the same.

the xavimat solution, a piece of the code is missing

on the xavimat code the characters appear when the cursor comes on the character's location....
if I click it puts me a error because the "cake" "hamburger" and "icescream" label are missing

I can put them on but that's not what I want...

here the characters appear when we put the cursor then we choose one of them to go somewhere....

I want all the characters to be present on the map and after clicking on one of them it disappears, I can then make the others disappear until only one remains.

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: Hotspot

#6 Post by trooper6 »

My code is used imagebuttons over a ground image, and not imagemaps and hotspots. For what you want, I suggest you also use image buttons rather than an imagemap.
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

User avatar
senisanti
Regular
Posts: 94
Joined: Tue May 07, 2019 4:37 am
Projects: Allball, Smash scrap metal, Santi...
Location: Rennes
Contact:

Re: Hotspot

#7 Post by senisanti »

Yes I tried this weekend with button images but I couldn't go out anymore, every time I had to delete all the characters to be able to leave the screen.

but I'll try again and if I find the same problem again I'll contact you back here, thank you!

User avatar
senisanti
Regular
Posts: 94
Joined: Tue May 07, 2019 4:37 am
Projects: Allball, Smash scrap metal, Santi...
Location: Rennes
Contact:

Re: Hotspot

#8 Post by senisanti »

I'm back where I was Saturday morning...

I created this code, thanks to some of your examples I managed to make a very short code for only one of my characters...
but I'm blocked like Saturday... after "action" how I make a button disappear... "hide" doesn't work...

I manage to do like you... almost..... if I put "show ("blabla") I add a screen blabla and it makes me appear what I want but I don't want that, I want the character to disappear

here is my code

Code: Select all

screen theone():
    add "bgtheone"
    vbox xalign 0.99 yalign 0.22:
        imagebutton auto "icon/jimena01_%s.png":
            action 
I want this button to create in "icon" named "jimena01" to disappear...

I will then add 5 times the same code to add the 5 other characters....

when the player will have deleted 5 characters he will have recruited in his team the character that remains on the screen and at that moment I don't know how to automatically close the screen either...
so I'm getting ahead of myself... how to make my burton disappear and close the screen?

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: Hotspot

#9 Post by trooper6 »

Your code isn’t working, because it isn’t complete—it doesn’t do anything. What is supposed to happen when a person clicks a button besides the image disappearing? Presumably you are trying to store some information somewhere...so what are you doing?

Also how complicated is this game you are planning?
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

User avatar
senisanti
Regular
Posts: 94
Joined: Tue May 07, 2019 4:37 am
Projects: Allball, Smash scrap metal, Santi...
Location: Rennes
Contact:

Re: Hotspot

#10 Post by senisanti »

Code: Select all

screen theone():
    add "bgtheone"
    vbox xalign 0.99 yalign 0.22:
        imagebutton auto "icon/jimena01_%s.png":
            action Show ("blablabla"), Hide ("jimena01")]

screen blablabla():
    add "something"
    vbox xalign 0.99 yalign 0.72

so the code works, but now I'm doing what you did, almost...

you can see in my code that "show" shows something...
but "hide" is useless...

I'm not interested in "show", I just want "hide"... but why "hide" doesn't hide the image?

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: Hotspot

#11 Post by trooper6 »

That is because Hide is used to hide screens not images.

This is some code that gets rid of buttons that have been clicked on and also has a button that closes the screen.

Code: Select all

screen theone():
    frame xalign 0.99 yalign 0.22:
        vbox:
            if b1:
                textbutton "Button1" action ToggleVariable("b1")
            if b2:
                textbutton "Button2" action ToggleVariable("b2")
            if b3:
                textbutton "Button3" action ToggleVariable("b3")
            textbutton "Done" action Hide("theone")

default b1 = True
default b2 = True
default b3 = True

# The game starts here.
label start:
    show screen theone()
    "Let's test this thing."

    return
I still suspect this isn't really the best way of going about whatever you are wanting to do...because you aren't really explaining what you ultimately want to do. But that code will work for you.
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

User avatar
senisanti
Regular
Posts: 94
Joined: Tue May 07, 2019 4:37 am
Projects: Allball, Smash scrap metal, Santi...
Location: Rennes
Contact:

Re: Hotspot

#12 Post by senisanti »

your code it's great but textbutton..i don't use
I believe that my knowledge of the English language is not enough to explain what I want to do.

I want to

in the game
e "blablablabla..."
call screen theone

in the screen "the one", I want

a background image, then 6 PNG images that appear on the background image, when the players click on a png image it disappears the seconde clic disapear an another, the third too...
when there is more image then the screen closes and the player returns to the story

I want something that looks like a hidden object game but the players don't have to find all the objects but eliminate the "character" objects.

this comes in my game after a very long paragraph of the game that gives a lot of information about characters, if the player has understood what he has to do well he will have to eliminate the characters and maybe keep some certain according to his needs.

it is a bit like an exercise in understanding that can lead the player to defeat if he makes the wrong choices.

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: Hotspot

#13 Post by trooper6 »

My example code used textbuttons just so I could test it. You can replace the textbuttons with your imagebuttons.
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

User avatar
senisanti
Regular
Posts: 94
Joined: Tue May 07, 2019 4:37 am
Projects: Allball, Smash scrap metal, Santi...
Location: Rennes
Contact:

Re: Hotspot

#14 Post by senisanti »

I finally managed to create something that's very good with all the information you gave me.
Thank you very much for the patience and time you have given me.

Post Reply

Who is online

Users browsing this forum: No registered users