Resizing and flipping images... at the same time!!

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
spearcarrier
Regular
Posts: 33
Joined: Wed Jul 08, 2015 2:22 am
Projects: The Heavenly Bride
Organization: The Apocalypse Writers
Deviantart: spearcarrier
Contact:

Resizing and flipping images... at the same time!!

#1 Post by spearcarrier » Fri Aug 21, 2015 12:23 pm

Hi guys. Got a question for ya's.

The 'displayables' in my game are kind big, but I'd like to keep them that way. I may resize them later, but for now their large size has possibilities. It's also set in the game for them to flip so they can face the other way.

But I can't find anything in the documentation on how to combine to transformations onto the same displayable. Except with matrix of course. And I will be honest, a lot of the documentation reads like Greek to me.

So how would I flip my image AND resize it at the same time?
Blog portal: http://www.apocalypsewriters.com
Current soul-sucking webcomic of doom project: http://www.theheavenlybride.com
Current visual novel project: The Brat
Sometimes I act and sing: http://www.apocalypsewriters.com/Kat_Blue
Deviantart: http://spearcarrier.deviantart.com

User avatar
Donmai
Eileen-Class Veteran
Posts: 1919
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Resizing and flipping images... at the same time!!

#2 Post by Donmai » Fri Aug 21, 2015 2:09 pm

Code: Select all

    transform flipzoom(zoom_factor):
        zoom zoom_factor
        xzoom -1 #this line flips the image 
        

# The game starts here.
label start:
    
    show eileen happy at flipzoom(.5), center 
    # reduces the image size to a half. You will need to reposition the image (in this case, center)
    e "You've created a new Ren'Py game."
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
spearcarrier
Regular
Posts: 33
Joined: Wed Jul 08, 2015 2:22 am
Projects: The Heavenly Bride
Organization: The Apocalypse Writers
Deviantart: spearcarrier
Contact:

Re: Resizing and flipping images... at the same time!!

#3 Post by spearcarrier » Fri Aug 21, 2015 2:42 pm

Aaaand that was Greek. I apologize, but I have no idea where that goes in relation to the parts that tell the image to flip or.. anything. I do get that you put this somewhere somehow, and maybe then you don't have to put a lot of code to flip all of the images? Maybe???? You just use that when you want to flip an image?

But I think I understand you mean that the .5 resizes the image by half, which is handy. But but... where does this... transform thing GO. See i got to the part in the documentation about transforms and had to give up. I need a for dummies handbook! LOL
Blog portal: http://www.apocalypsewriters.com
Current soul-sucking webcomic of doom project: http://www.theheavenlybride.com
Current visual novel project: The Brat
Sometimes I act and sing: http://www.apocalypsewriters.com/Kat_Blue
Deviantart: http://spearcarrier.deviantart.com

User avatar
spearcarrier
Regular
Posts: 33
Joined: Wed Jul 08, 2015 2:22 am
Projects: The Heavenly Bride
Organization: The Apocalypse Writers
Deviantart: spearcarrier
Contact:

Re: Resizing and flipping images... at the same time!!

#4 Post by spearcarrier » Fri Aug 21, 2015 3:11 pm

Okay, I *think* I have it. Sort of. I'm a by example sort of person and I found all sorts of examples, but they all had no context. So I'm looking at these strings of numbers and trying to read the documentation over and over again and just plain getting curse word frustrated because I might as well be reading Sumerian. I'm just EXTREMELY kinesthetic. Fortunately the girl working on this for me had put some transforms in the game already and I happened to notice them. I'm still real lost on what part is what and goes where, but I have something sort of going along.
Blog portal: http://www.apocalypsewriters.com
Current soul-sucking webcomic of doom project: http://www.theheavenlybride.com
Current visual novel project: The Brat
Sometimes I act and sing: http://www.apocalypsewriters.com/Kat_Blue
Deviantart: http://spearcarrier.deviantart.com

User avatar
Donmai
Eileen-Class Veteran
Posts: 1919
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Resizing and flipping images... at the same time!!

#5 Post by Donmai » Fri Aug 21, 2015 7:26 pm

Translating from Greek:
You put the transform definition block anywhere. Usually I put it on a separate rpy file called (duh) 'transforms.rpy'.
'zoom_factor' is a variable to which you will give a value when calling the transform. If you want the image to appear at 75% its original size, give zoom_factor a value of 0.75. And so on.
You call the transform when showing the image, as demonstrated, with the zoom value you want.
Yes, to do a horizontal flip of an image in ATL you just need to give xzoom a negative value.
That's all, folk.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
spearcarrier
Regular
Posts: 33
Joined: Wed Jul 08, 2015 2:22 am
Projects: The Heavenly Bride
Organization: The Apocalypse Writers
Deviantart: spearcarrier
Contact:

Re: Resizing and flipping images... at the same time!!

#6 Post by spearcarrier » Fri Aug 21, 2015 7:32 pm

I appreciate the effort. Before you answered this post, my sprites were doing weird things across the page and looked like they were dancing on crack. Now they're resized appropriately and behaving. I owe you one.
Blog portal: http://www.apocalypsewriters.com
Current soul-sucking webcomic of doom project: http://www.theheavenlybride.com
Current visual novel project: The Brat
Sometimes I act and sing: http://www.apocalypsewriters.com/Kat_Blue
Deviantart: http://spearcarrier.deviantart.com

User avatar
Donmai
Eileen-Class Veteran
Posts: 1919
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Resizing and flipping images... at the same time!!

#7 Post by Donmai » Fri Aug 21, 2015 8:20 pm

No problem. BTW I only know some ATL and basic scripting. When I see people here discussing python programming, to me it's like they are talking in Sumerian :lol: .
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
spearcarrier
Regular
Posts: 33
Joined: Wed Jul 08, 2015 2:22 am
Projects: The Heavenly Bride
Organization: The Apocalypse Writers
Deviantart: spearcarrier
Contact:

Re: Resizing and flipping images... at the same time!!

#8 Post by spearcarrier » Fri Aug 21, 2015 8:24 pm

Forget Sumerian. I studied Klingon in college. It's harder. This stuff is Klingong, but high Klingon. The stuff encrypted Klingon messages are made of.
Blog portal: http://www.apocalypsewriters.com
Current soul-sucking webcomic of doom project: http://www.theheavenlybride.com
Current visual novel project: The Brat
Sometimes I act and sing: http://www.apocalypsewriters.com/Kat_Blue
Deviantart: http://spearcarrier.deviantart.com

Post Reply

Who is online

Users browsing this forum: Bing [Bot], nyeowmi