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.
-
Valhalla Ent
- Newbie
- Posts: 13
- Joined: Mon Mar 11, 2019 5:35 pm
-
Contact:
#1
Post
by Valhalla Ent » Wed May 13, 2020 9:11 pm
I have a little image notification appear at the top right corner of my screen using this command:
Code: Select all
image notification:
"gallery_notification.png"
xalign 1.1 yalign 0
linear 0.1 xalign 1.0 yalign 0
As you can see, it slides inside the screen. I like this because it does it in a very fluid movement.
I was wondering if there's a way to make that same image slide off-screen after a certain period of time. I was experimenting with "timer" but couldn't figure it out.
I can make it disappear with:
Code: Select all
hide image "notification" with Dissolve(0.2)
but it doesn't have that fluid movement I'm looking for.
-
hell_oh_world
- Miko-Class Veteran
- Posts: 777
- Joined: Fri Jul 12, 2019 5:21 am
- Projects: The Button Man
- Organization: NILA
- Github: hell-oh-world
- Location: Philippines
-
Contact:
#2
Post
by hell_oh_world » Wed May 13, 2020 9:27 pm
use atl events... and probably a screen.
Code: Select all
transform fader:
on show:
alpha 0.0
easein 0.15 alpha 1.0
on hide:
easein 0.15 alpha 0.0
screen notif(image, delay=2):
default hide = False
showif not hide:
add image at fader
timer delay action SetScreenVariable("hide", True) # hides the notif after 2 seconds.
if hide:
timer 0.15 action Hide("notif") # makes the transform happen before hiding the screen.
label start:
show screen notif("gallery_image.png")
"some dialogue"
-
Valhalla Ent
- Newbie
- Posts: 13
- Joined: Mon Mar 11, 2019 5:35 pm
-
Contact:
#3
Post
by Valhalla Ent » Thu May 14, 2020 9:35 am
I get this error:
Code: Select all
[code]
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.
File "game/notification.rpy", line 14: expected 'name' not found.
screen notif(image, delay=2):
^
File "game/notification.rpy", line 19: expected statement.
timer delay action SetScreenVariable("hide", True)
^
-
hell_oh_world
- Miko-Class Veteran
- Posts: 777
- Joined: Fri Jul 12, 2019 5:21 am
- Projects: The Button Man
- Organization: NILA
- Github: hell-oh-world
- Location: Philippines
-
Contact:
#4
Post
by hell_oh_world » Thu May 14, 2020 10:33 am
my bad... i used a reserved keyword.
Code: Select all
transform fader:
on show:
alpha 0.0
easein 0.15 alpha 1.0
on hide:
easein 0.15 alpha 0.0
screen notif(the_image, delay=2):
default hide = False
showif not hide:
add the_image at fader
timer delay action SetScreenVariable("hide", True) # hides the notif after 2 seconds.
if hide:
timer 0.15 action Hide("notif") # makes the transform happen before hiding the screen.
label start:
show screen notif("gallery_image.png")
"some dialogue"
Users browsing this forum: Google [Bot], khezo