[Solved]Have a character move to the left when clicking on it and showing a menu when clicking on it
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.
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.
- TsukiWorks
- Regular
- Posts: 27
- Joined: Sat Jun 23, 2018 6:50 am
- Projects: The Misunderstood
- Deviantart: TsukiWorks
- Contact:
[Solved]Have a character move to the left when clicking on it and showing a menu when clicking on it
Hello! I'd like to know how to make a character move from its current position when clicked, and also make a menu appear when you click on the character. Thanks in advance!
Last edited by TsukiWorks on Sun Nov 18, 2018 4:18 am, edited 1 time in total.
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- 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-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: Have a character move to the left when clicking on it and showing a menu when clicking on it
You could use a mousearea placed over the character, that jump to an label that move the character and opens the menu.TsukiWorks wrote: ↑Mon Nov 12, 2018 2:23 pm Hello! I'd like to know how to make a character move from its current position when clicked, and also make a menu appear when you click on the character. Thanks in advance!
- TsukiWorks
- Regular
- Posts: 27
- Joined: Sat Jun 23, 2018 6:50 am
- Projects: The Misunderstood
- Deviantart: TsukiWorks
- Contact:
Re: Have a character move to the left when clicking on it and showing a menu when clicking on it
And how do I do that? Sorry, my skills in programming are kinda low...Per K Grok wrote: ↑Tue Nov 13, 2018 1:24 amYou could use a mousearea placed over the character, that jump to an label that move the character and opens the menu.TsukiWorks wrote: ↑Mon Nov 12, 2018 2:23 pm Hello! I'd like to know how to make a character move from its current position when clicked, and also make a menu appear when you click on the character. Thanks in advance!
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- 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-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: Have a character move to the left when clicking on it and showing a menu when clicking on it
TsukiWorks wrote: ↑Tue Nov 13, 2018 2:15 amAnd how do I do that? Sorry, my skills in programming are kinda low...Per K Grok wrote: ↑Tue Nov 13, 2018 1:24 amYou could use a mousearea placed over the character, that jump to an label that move the character and opens the menu.TsukiWorks wrote: ↑Mon Nov 12, 2018 2:23 pm Hello! I'd like to know how to make a character move from its current position when clicked, and also make a menu appear when you click on the character. Thanks in advance!
Sorry, I miss remembered what mousearea can do. Instead you could use button.
You could test something like this.
Code: Select all
image char = "yaz_S1.png"
screen charClick():
button:
area(500,200,100,200)
action Jump("moveLeft")
label start:
scene bg bg1
show char:
pos(500,200)
show screen charClick()
$ renpy.pause( hard=True)
label moveLeft:
show char:
pos(500,200)
linear 3.0 xpos 100
menu:
"Question"
"Yes":
return
"No":
return
- TsukiWorks
- Regular
- Posts: 27
- Joined: Sat Jun 23, 2018 6:50 am
- Projects: The Misunderstood
- Deviantart: TsukiWorks
- Contact:
Re: Have a character move to the left when clicking on it and showing a menu when clicking on it
Thank you very much! I'll test it out and see if it works.Per K Grok wrote: ↑Tue Nov 13, 2018 6:03 pmTsukiWorks wrote: ↑Tue Nov 13, 2018 2:15 amAnd how do I do that? Sorry, my skills in programming are kinda low...Per K Grok wrote: ↑Tue Nov 13, 2018 1:24 am
You could use a mousearea placed over the character, that jump to an label that move the character and opens the menu.
Sorry, I miss remembered what mousearea can do. Instead you could use button.
You could test something like this.
Code: Select all
image char = "yaz_S1.png" screen charClick(): button: area(500,200,100,200) action Jump("moveLeft") label start: scene bg bg1 show char: pos(500,200) show screen charClick() $ renpy.pause( hard=True) label moveLeft: show char: pos(500,200) linear 3.0 xpos 100 menu: "Question" "Yes": return "No": return
- TsukiWorks
- Regular
- Posts: 27
- Joined: Sat Jun 23, 2018 6:50 am
- Projects: The Misunderstood
- Deviantart: TsukiWorks
- Contact:
Re: Have a character move to the left when clicking on it and showing a menu when clicking on it
I tested the code, it's working. But I can still click outside the area (including the textbox). I only want the menu to appear and the character to move when I'm clicking on him. Am I doing something wrong?Per K Grok wrote: ↑Tue Nov 13, 2018 6:03 pmTsukiWorks wrote: ↑Tue Nov 13, 2018 2:15 amAnd how do I do that? Sorry, my skills in programming are kinda low...Per K Grok wrote: ↑Tue Nov 13, 2018 1:24 am
You could use a mousearea placed over the character, that jump to an label that move the character and opens the menu.
Sorry, I miss remembered what mousearea can do. Instead you could use button.
You could test something like this.
Code: Select all
image char = "yaz_S1.png" screen charClick(): button: area(500,200,100,200) action Jump("moveLeft") label start: scene bg bg1 show char: pos(500,200) show screen charClick() $ renpy.pause( hard=True) label moveLeft: show char: pos(500,200) linear 3.0 xpos 100 menu: "Question" "Yes": return "No": return
Code: Select all
image char = "mamoru.png"
screen charClick():
button:
area(400,50,100,200)
action Jump("moveLeft")
label start:
show char:
pos(400,50)
show screen charClick()
$ renpy.pause()
label moveLeft:
show char:
pos(400,50)
linear 1.0 xpos 50
menu:
"Do you believe in love?"
"Yes":
k "What a strage question..."
k "But to be honest with you...I do."
"No":
k "What a strage question..."
k "But to be honest with you...I don't."
Re: Have a character move to the left when clicking on it and showing a menu when clicking on it
Use call screen instead of show.
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- 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-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: Have a character move to the left when clicking on it and showing a menu when clicking on it
I used a hard pause. You cannot pass a hard pause with a mouse-click.TsukiWorks wrote: ↑Sat Nov 17, 2018 5:22 am
I tested the code, it's working. But I can still click outside the area (including the textbox). I only want the menu to appear and the character to move when I'm clicking on him. Am I doing something wrong?
You use an ordinary pause. That will be ended with a mouse-click. That would be what happens when you click outside the button. The pause ends and the program continues to the next lines of code, which is the code that moves the character and shows the menu.
- TsukiWorks
- Regular
- Posts: 27
- Joined: Sat Jun 23, 2018 6:50 am
- Projects: The Misunderstood
- Deviantart: TsukiWorks
- Contact:
Re: Have a character move to the left when clicking on it and showing a menu when clicking on it
I see. I managed to solve the problem by using an imagebutton, but thank you for this other solution!Per K Grok wrote: ↑Sat Nov 17, 2018 12:54 pmI used a hard pause. You cannot pass a hard pause with a mouse-click.TsukiWorks wrote: ↑Sat Nov 17, 2018 5:22 am
I tested the code, it's working. But I can still click outside the area (including the textbox). I only want the menu to appear and the character to move when I'm clicking on him. Am I doing something wrong?
You use an ordinary pause. That will be ended with a mouse-click. That would be what happens when you click outside the button. The pause ends and the program continues to the next lines of code, which is the code that moves the character and shows the menu.
Who is online
Users browsing this forum: No registered users