The curse of the unexplained flying girls

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
swampie2
Newbie
Posts: 21
Joined: Sun Oct 04, 2015 6:30 pm
Projects: Missing stars
Organization: Somnova
Contact:

The curse of the unexplained flying girls

#1 Post by swampie2 »

So we've been directing some of our scenes and having some troubles with some code:

Code: Select all

image CHAR Happy2 = im.Flip(im.FactorScale("images/Sprites/Side Characters/CHAR/CHAR_P1_E2.png", 0.66), horizontal=True)
show CHAR Happy2:
  offscreenright
  alpha 0.0 xalign 0.8 yalign 1
  easein 1.0 xalign 0.7 yalign 1 alpha 1
So this code has our sprite fade in while moving toward their position from offscreen, however changing the yalign values does nothing, these sprites default to a yalign of .5 even when told otherwise, causing them to float.

We tried simplifying the code to try and find the problem like so:

Code: Select all

image CHAR Happy2 = im.FactorScale("images/Sprites/Side Characters/CHAR/CHAR_P1_E2.png", 0.66)
show CHAR Happy2:
  xalign 0.7 yalign 1
Or altering our syntax

Code: Select all

image CHAR Happy2 = im.Flip(im.FactorScale("images/Sprites/Side Characters/CHAR /CHAR _P1_E2.png", 0.66), horizontal=True)
show CHAR Happy2 :
  offscreenright
  alpha 0.0 align (0.8, 0.1)
  easein 1.0 align (0.7, 0.1) alpha 1
But our sprite still spawns in at yalign 0.5, no matter what the yalign is defined as when we call it. We've had this problem with multiple different sprites across multiple different scenes across multiple computers. What are we doing wrong?
Last edited by swampie2 on Thu Jan 26, 2017 7:17 am, edited 2 times in total.

helcries
Newbie
Posts: 17
Joined: Thu Oct 27, 2016 3:30 am
Contact:

Re: The curse of the unexplained flying girls

#2 Post by helcries »

Have you tried using the following code?

Code: Select all

show CHAR Happy2 at left with fade

show CHAR Happy2 at right with dissolve
It's about the easiest way I know to make sure that the sprites are not in the center of the screen.

User avatar
swampie2
Newbie
Posts: 21
Joined: Sun Oct 04, 2015 6:30 pm
Projects: Missing stars
Organization: Somnova
Contact:

Re: The curse of the unexplained flying girls

#3 Post by swampie2 »

helcries wrote:Have you tried using the following code?
We'd still like control over exact values so we can position our characters and fadeins precisely, it doesn't look like this solution will allow for that.

helcries
Newbie
Posts: 17
Joined: Thu Oct 27, 2016 3:30 am
Contact:

Re: The curse of the unexplained flying girls

#4 Post by helcries »

I THINK you can program a custom location like you can do custom transitions, but again its something that I haven't tried yet, so I'm not 100% sure.

https://www.renpy.org/doc/html/transforms.html

Thats the link I check when I am looking up info in transforms and image placement, it has a link on the bottom that goes into ATL which might give you some better help than I was.

User avatar
swampie2
Newbie
Posts: 21
Joined: Sun Oct 04, 2015 6:30 pm
Projects: Missing stars
Organization: Somnova
Contact:

Re: The curse of the unexplained flying girls

#5 Post by swampie2 »

I'm afraid this doesn't really solve my problem. We're using custom positions, but renpy refuses to read the yalign value.

This code has worked fine for other sprites and even this exact sprite in an earlier script, but for some reason, in this use of the code + a few others, it refuses to read the yalign, ypos or yanchor and instead defaults to 0.5.

I'm not asking how to position the sprite, I'm asking why renpy won't read the value I'm giving it when I'm telling it where it's position is.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: The curse of the unexplained flying girls

#6 Post by Imperf3kt »

According to the documentation, the "offscreenright" defaults to the bottom of the screen.
Judging from this, does your sprite have any transparent space below the actual image?
for example:
REALLYSHITTYSTICKMAN.png
REALLYSHITTYSTICKMAN.png (2.75 KiB) Viewed 1954 times
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Mammon
Miko-Class Veteran
Posts: 712
Joined: Sat Nov 07, 2015 3:09 pm
Completed: Pervert&Yandere, Stalker&Yandere
Projects: Roses Of The Thorn Prince
Contact:

Re: The curse of the unexplained flying girls

#7 Post by Mammon »

First off: loving the title. Actually opened this thinking it was a WiP thread. (That can happen when you browse the lastest topics rather than a particular section.)

I'm not a talented coder in the least so I might not be of help here, but two possible solutions:
-Why yalign, shouldn't you set x to 0.0 to get a character to the bottom of the screen? That's what I did and it worked. Now I'm wondering WHY it worked...
-What I used to get my sprites at a specific locations:

Code: Select all

#outside of script, inside of script.rpy:
transform abd:
     xalign 0.0, yalign 0.8
#in script:
show me at abd
me 'And now I'm at the location "abd" instead of the standard location.'
ImageImageImage

Want some CC sprites?

User avatar
swampie2
Newbie
Posts: 21
Joined: Sun Oct 04, 2015 6:30 pm
Projects: Missing stars
Organization: Somnova
Contact:

Re: The curse of the unexplained flying girls

#8 Post by swampie2 »

Imperf3kt wrote:does your sprite have any transparent space below the actual image?
The sprite has space around the top and sides, but the bottom of the image ends at the bottom of the sprite.
Mammon wrote:Actually opened this thinking it was a WiP thread.
An interesting idea!
Mammon wrote:shouldn't you set x to 0.0 to get a character to the bottom of the screen?
This is true, but I've tried changing the yalign value from 10000 to -10000 and I'm getting no difference, always the default 0.5

User avatar
Mammon
Miko-Class Veteran
Posts: 712
Joined: Sat Nov 07, 2015 3:09 pm
Completed: Pervert&Yandere, Stalker&Yandere
Projects: Roses Of The Thorn Prince
Contact:

Re: The curse of the unexplained flying girls

#9 Post by Mammon »

Swampie wrote:
Mammon wrote:shouldn't you set x to 0.0 to get a character to the bottom of the screen?
This is true, but I've tried changing the yalign value from 10000 to -10000 and I'm getting no difference, always the default 0.5
No, I mean change the xalign instead of the yalign? Even though that shouldn't solve the problem logically, the transform that I quoted in my last post is directly from my game, and the characters are solidly standing on the ground rather than floating even though y is set at 0.8

So your code as seen below, (which actually seems to have an yalign of 1 rather than 0,) might stop floating when you set the xalign to 0.0, which worked for my sprites.

Code: Select all

image CHAR Happy2 = im.Flip(im.FactorScale("images/Sprites/Side Characters/CHAR/CHAR_P1_E2.png", 0.66), horizontal=True)
show CHAR Happy2:
  offscreenright
  alpha 0.0 xalign 0.8 yalign 1
  easein 1.0 xalign 0.7 yalign 1 alpha 1
ImageImageImage

Want some CC sprites?

User avatar
swampie2
Newbie
Posts: 21
Joined: Sun Oct 04, 2015 6:30 pm
Projects: Missing stars
Organization: Somnova
Contact:

Re: The curse of the unexplained flying girls

#10 Post by swampie2 »

No dice, this just moves the character to the far left of the screen, still in the middle height wise.

Code: Select all

image CHAR Happy2 = im.Flip(im.FactorScale("images/Sprites/Side Characters/CHAR/CHAR_P1_E2.png", 0.66), horizontal=True)
show CHAR Happy2 :
  offscreenright
  alpha 0.0 align (0.8, 0)
  easein 1.0 align (0.0, 0) alpha 1

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: The curse of the unexplained flying girls

#11 Post by xela »

Post the sprite you're having an issue with and code you're using, stuff like this is used in almost every game and cannot be broken in a way your suggest. You prolly don't understand difference in behavior when using floats and ints as align values or somehow setup some weird outer container that messes up the alignment.

alpha 0.0 xalign 0.8 yalign 1

this for example aligns to the top of the screen.

alpha 0.0 xalign 0.8 yalign 1.0

this aligns to the bottom of the screen and etc...

It gets increasingly more confusing if you use mix floats and integers within the same set of instructions.
Like what we're doing? Support us at:
Image

User avatar
swampie2
Newbie
Posts: 21
Joined: Sun Oct 04, 2015 6:30 pm
Projects: Missing stars
Organization: Somnova
Contact:

Re: The curse of the unexplained flying girls

#12 Post by swampie2 »

xela wrote:alpha 0.0 xalign 0.8 yalign 1

this for example aligns to the top of the screen.

alpha 0.0 xalign 0.8 yalign 1.0

this aligns to the bottom of the screen and etc...
You're beautiful, this solved the problem. Thanks a bunch guys!

User avatar
Scribbles
Miko-Class Veteran
Posts: 636
Joined: Wed Sep 21, 2016 4:15 pm
Completed: Pinewood Island, As We Know It
Projects: In Blood
Organization: Jaime Scribbles Games
Deviantart: breakfastdoodles
itch: scribbles
Location: Ohio
Contact:

Re: The curse of the unexplained flying girls

#13 Post by Scribbles »

OMG this fixed an issue I was having too! I was using ypos instead of yalign and some of my sprites would be low and others would be high and I had no idea what was going on lol
Image - Image -Image

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: The curse of the unexplained flying girls

#14 Post by xela »

It's not just you, this issue is shared by a whole lot of people... I disagree with the concept of sharing floats and ints for positional argument, it's a lot more trouble than it's worth.

I have found that a good way of thinking about it may be:

pos/offset: ALWAYS USE INTS.
align/anchor: ALWAYS USE FLOATS.

I've been sticking with this setup for as long as I can remember and never had any problems. Divination from that caused so many issues for so many people :( To make matters worse, if you use both in the same set of instruction or sometimes even when passing instructions to new ones, chances are that you will never see your sprite ever again cause Ren'Py would convert everything to floats as it pleases and send your sprite flying to the moon :)
Like what we're doing? Support us at:
Image

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot], snotwurm