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.
-
DizzyKa
- Newbie
- Posts: 15
- Joined: Sat Sep 24, 2016 4:49 pm
- Projects: @GossamerAcademy
-
Contact:
#1
Post
by DizzyKa » Wed Feb 01, 2017 9:35 pm
I have this strange recurring issue with animations within screens. Sometimes the animations run as expected, and sometimes the animations don't do anything as if they only ever received one update. I looked through the boards for an answer but couldn't find anything specifically for this problem. I find that if I put the animation beneath a window tag it works most of the time, but if the animation is within a frame or fixed the animation doesn't work.
For instance I have the following code in two separate screens, but the animation only works in one of the screens:
Code: Select all
init -1:
image candle_scroll:
"images/ui/char_rec_back_scroll.png"
xalign 0.0
linear 240.0 xalign 110.0
repeat
image candle_scroll_2:
"images/ui/char_rec_back_scroll.png"
xalign -110.0
linear 240.0 xalign 0.0
repeat
screen character_generation():
tag menu
default cur_tab = 0
default selected_item = -1
default hovered_list = []
window:
xpadding 0
ypadding 0
add "images/ui/char_rec_back.png"
add "candle_scroll"
add "candle_scroll_2"
fixed:
imagebutton auto "images/ui/charrec_char_button_%s.png" xpos (795 / 1280.0) ypos (76 / 720.0) action [SelectedIf(cur_tab==0), SetScreenVariable('cur_tab', 0)]
add "images/protag/normal.png" xalign 0.5 ypos -0.11
The "candle_scroll" images should be slowly moving across the screen, but are instead stationary. I tried to figure out how to make a screen re-draw every frame by forcing a new interaction, but that destroys screen state like what button is selected.
The screen where this animation works is technically a menu that I added to the quickmenu bar. The screen where the animation doesn't work I'm displaying using "call screen character_generation".
Any help is appreciated!
-
gas
- Miko-Class Veteran
- Posts: 838
- Joined: Mon Jan 26, 2009 7:21 pm
-
Contact:
#2
Post
by gas » Thu Feb 02, 2017 2:47 pm
You don't have to add them to a window.
There isn't any need from the start.
The window occupy the entire size of the screen, and create some fixed to contains his childs.
So, in a word, you're creating fixed that "Invisibly" become longer in the other side, but are locked inside the window where you anchor them. You are nott moving the window

.
I also suggest you to create transforms AND THEN statements like
add "yourimage.png" at yourtransform
when using screens. This usually work better to me.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.
10 ? "RENPY"
20 GOTO 10
RUN
-
DizzyKa
- Newbie
- Posts: 15
- Joined: Sat Sep 24, 2016 4:49 pm
- Projects: @GossamerAcademy
-
Contact:
#3
Post
by DizzyKa » Thu Feb 02, 2017 5:43 pm
gas wrote:You don't have to add them to a window.
There isn't any need from the start.
The window occupy the entire size of the screen, and create some fixed to contains his childs.
So, in a word, you're creating fixed that "Invisibly" become longer in the other side, but are locked inside the window where you anchor them. You are nott moving the window

.
I also suggest you to create transforms AND THEN statements like
add "yourimage.png" at yourtransform
when using screens. This usually work better to me.
Thanks for your advice! I tried adding the images above the window, then I tried adding the images within their own fixed, then I tried adding just the image path "at" a transform and none of that worked.
However, after I commented out xpadding 0 and ypadding 0 the animations work! I must be fundamentally misunderstanding how screen layout / transform language works. When you define a window the window is offset by default in the x and y directions to create a sort of border to demarcate it as a "window". I don't want this padding, so I removed it, but that makes my animations stationary. I guess because the window is at 0,0 and fills the entire screen using xalign is no longer effective? Confused

-
DizzyKa
- Newbie
- Posts: 15
- Joined: Sat Sep 24, 2016 4:49 pm
- Projects: @GossamerAcademy
-
Contact:
#4
Post
by DizzyKa » Thu Feb 02, 2017 5:48 pm
New findings, if I keep the padding set to zero and use xpos instead of xalign like this nothing moves:
Code: Select all
init -1:
image candle_scroll_3:
"images/ui/char_rec_back_scroll.png"
xpos 0.0
linear 2.0 xpos 110.0
repeat
image candle_scroll_4:
"images/ui/char_rec_back_scroll.png"
xpos -110.0
linear 2.0 xpos 0.0
repeat
screen character_generation():
tag menu
default cur_tab = 0
default selected_item = -1
default hovered_list = []
window:
# xpos 0.0
# ypos 0.991
xpadding 0
ypadding 0
add "images/ui/char_rec_back.png"
add "candle_scroll_3"
add "candle_scroll_4"
add "images/protag/normal.png" xalign 0.5 ypos -0.11
fixed:
imagebutton auto "images/ui/charrec_char_button_%s.png" xpos (795 / 1280.0) ypos (76 / 720.0) action [SelectedIf(cur_tab==0), SetScreenVariable('cur_tab', 0)]
imagebutton auto "images/ui/charrec_locker_button_%s.png" xpos (818 / 1280.0) ypos (195 / 720.0) action [SelectedIf(cur_tab==1), SetScreenVariable('cur_tab', 1)]
However! If I use xpos as a value between 0 and 1 the animations work, like this:
Code: Select all
init -1:
image candle_scroll_3:
"images/ui/char_rec_back_scroll.png"
xpos 0.0
linear 2.0 xpos 1.0
repeat
image candle_scroll_4:
"images/ui/char_rec_back_scroll.png"
xpos -1.0
linear 2.0 xpos 1.0
repeat
What am I missing xD
Users browsing this forum: No registered users