Item Pop-up Notification Help?
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.
- HypersDev
- Newbie
- Posts: 18
- Joined: Thu Jul 16, 2020 1:43 am
- Projects: DutyCalls
- itch: ItsHypers
- Contact:
Item Pop-up Notification Help?
Hello!
I have a mini-game where you click on an object, and it adds it to your inventory. Although I want to add a feature where, when you click on the object, it plays a little animations next to the object, (a little +1) using a webm file, or something similar, although I can't figure out how to do it, as I cant figure out how to add a timer, add a transform / location of the file etc. Has anyone done anything like this before?
I have a mini-game where you click on an object, and it adds it to your inventory. Although I want to add a feature where, when you click on the object, it plays a little animations next to the object, (a little +1) using a webm file, or something similar, although I can't figure out how to do it, as I cant figure out how to add a timer, add a transform / location of the file etc. Has anyone done anything like this before?
Re: Item Pop-up Notification Help?
The solution depends of how you show objects for mini-game and how you arrange player's interaction with the game. If you'll provide the code you got, this definetly will help to suggest something more accurate.
- hell_oh_world
- Miko-Class Veteran
- Posts: 777
- Joined: Fri Jul 12, 2019 5:21 am
- Contact:
Re: Item Pop-up Notification Help?
You can try triggering a variable when the object is added to the inventory.
https://www.renpy.org/doc/html/movie.ht ... ie-sprites
Code: Select all
image item add = Movie(...)
define item_add_dur = 0.25
screen test():
default item_added = False
textbutton "add" action [SetScreenVariable("item_added", True), ...]
if item_added:
add "item add" # show the anim...
timer item_add_dur:
action SetScreenVariable("item_added", False)
Last edited by hell_oh_world on Fri Aug 20, 2021 1:30 pm, edited 1 time in total.
-
- Miko-Class Veteran
- Posts: 793
- Joined: Fri Feb 09, 2018 12:05 am
- Location: Canada
- Contact:
Re: Item Pop-up Notification Help?
create a new screen called screen got_a_new_item():
this is a easy way of doing it:
and then anywhere in your game inside a label
this is a easy way of doing it:
Code: Select all
screen got_a_new_item():
hbox:
yalign 0.5
xalign 0.5
text "You got a new item"
Code: Select all
label f:
e "Hello I wnat to buy this item"
a "Okay, here you go, that will be $19.95"
$ item += 1
show screen got_a_new_item
pause 0.5
hide screen got_a_new_item
e "Thank you."
a "Please come again..."
Re: Item Pop-up Notification Help?
Just to add to the other answers, you can use a timer with an action Hide("yourscreen") in the screen so that you won't have to copy and paste the pause and hide screen lines every time you show the screen. See: https://www.renpy.org/doc/html/screens.html#timer
- HypersDev
- Newbie
- Posts: 18
- Joined: Thu Jul 16, 2020 1:43 am
- Projects: DutyCalls
- itch: ItsHypers
- Contact:
Re: Item Pop-up Notification Help?
Sure thing!
The mini-game in question is this one:
viewtopic.php?f=51&t=62952&p=545724#p545724
I want to make it so, once you click a fruit, it visibly shows a +1 fruit icon next to the fruit like a little pop-up.
- HypersDev
- Newbie
- Posts: 18
- Joined: Thu Jul 16, 2020 1:43 am
- Projects: DutyCalls
- itch: ItsHypers
- Contact:
Re: Item Pop-up Notification Help?
How would I get this working with an animated image though? Can you use those in hboxs?rayminator wrote: ↑Fri Aug 20, 2021 1:28 pm create a new screen called screen got_a_new_item():
this is a easy way of doing it:and then anywhere in your game inside a labelCode: Select all
screen got_a_new_item(): hbox: yalign 0.5 xalign 0.5 text "You got a new item"
Code: Select all
label f: e "Hello I wnat to buy this item" a "Okay, here you go, that will be $19.95" $ item += 1 show screen got_a_new_item pause 0.5 hide screen got_a_new_item e "Thank you." a "Please come again..."
-
- Miko-Class Veteran
- Posts: 793
- Joined: Fri Feb 09, 2018 12:05 am
- Location: Canada
- Contact:
Re: Item Pop-up Notification Help?
all you have to do is make the animation into a video webpHypersDev wrote: ↑Tue Aug 24, 2021 4:33 pmHow would I get this working with an animated image though? Can you use those in hboxs?rayminator wrote: ↑Fri Aug 20, 2021 1:28 pm create a new screen called screen got_a_new_item():
this is a easy way of doing it:and then anywhere in your game inside a labelCode: Select all
screen got_a_new_item(): hbox: yalign 0.5 xalign 0.5 text "You got a new item"
Code: Select all
label f: e "Hello I wnat to buy this item" a "Okay, here you go, that will be $19.95" $ item += 1 show screen got_a_new_item pause 0.5 hide screen got_a_new_item e "Thank you." a "Please come again..."
Code: Select all
screen got_a_new_item():
hbox:
yalign 0.5
xalign 0.5
add "anim/your_video.webp"
text "You got a new item"
or this way but I never tested it so it might not work
Code: Select all
image anim:
"images/dark/dark9.png"
pause 0.1
"images/dark/dark8.png"
pause 0.1
"images/dark/dark7.png"
pause 0.1
"images/dark/dark6.png"
Code: Select all
screen got_a_new_item():
hbox:
yalign 0.5
xalign 0.5
add anim
text "You got a new item"
Re: Item Pop-up Notification Help?
Well, you can make it likeHypersDev wrote: ↑Tue Aug 24, 2021 4:32 pmSure thing!
The mini-game in question is this one:
viewtopic.php?f=51&t=62952&p=545724#p545724
I want to make it so, once you click a fruit, it visibly shows a +1 fruit icon next to the fruit like a little pop-up.
Code: Select all
screen fruit_event:
$ Peachx = [275, 1431, 867, 617, 993]
$ Peachy = [294, 244, 108, 315, 297]
$ MushroomX = [443, 90, 1595, 675, 1308]
$ MushroomY = [949, 933, 775, 658, 594]
for i in range(maxint):
imagebutton: #(925, 961)
xanchor 0.5
yanchor 0.5
xpos 925
ypos 961
idle "gui/misc/fruit_event_done.png"
hover "gui/misc/fruit_event_done_hover.png"
action [Jump("FruitText")]
unhovered Hide("displayTextScreen")
if fruit_bools[i] == False:
if chance_random[i] == 1 or chance_random[i] == 2 or chance_random[i] == 3 or chance_random[i] == 4 or chance_random[i] == 5:
# Make peach
# code code code
if chance_random[i] == 6 or chance_random[i] == 7 or chance_random[i] == 8 or chance_random[i] == 9 or chance_random[i] == 10:
# Make mushroom
#code code code
else: # <---
add "plus_one" at plus_transform: # add your image, transform is optional,
# positional properties are required
xanchor 0.5
yanchor 0.5
if chance_random[i] == 1 or chance_random[i] == 2 or chance_random[i] == 3 or chance_random[i] == 4 or chance_random[i] == 5:
xpos Peachx[i]
ypos Peachy[i]
if chance_random[i] == 6 or chance_random[i] == 7 or chance_random[i] == 8 or chance_random[i] == 9 or chance_random[i] == 10:
xpos MushroomX[i]
ypos MushroomY[i]
transform plus_transform:
alpha 0.0 yoffset 0
linear 0.5 alpha 1.0 yoffset -25
linear 0.5 alpha 0.0 yoffset -25
# this might be text or static image or animated image or a movie-sprite
image plus_one:
Text("+ 1", color="#c00", size=55)
Who is online
Users browsing this forum: No registered users