[Tutorial] Animation and Transforms by Example

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
User avatar
tiya_nofurita
Miko-Class Veteran
Posts: 669
Joined: Fri Jun 22, 2012 7:23 pm
Completed: ALLBLACK Phase 1, Heart's Blight, Last Rx., EDDA Cafe, Kohana, Half Moon
Projects: ALLBLACK Phase 2
Organization: VN Project Indonesia
Deviantart: SECONDARY-TARGET
itch: NSAID
Location: I can be everywhere
Discord: 3,4-Methylendioxymethamphetamine#4886
Contact:

Re: [Tutorial] Animation and Transforms by Example

#16 Post by tiya_nofurita »

saguaro wrote:Yes, you would just show them both.

Code: Select all

label test:
    show rain    
    show lightning
    etc.
Of course I know that...I mean, um...some synchronization...?
...never mind then. I can managed with it somehow (parallel statement can be used with "repeat" statement just like animation, so it's easy :D )
Thank you for your tutorial again~

Well, kinda embarassed, but it's my first try anyway
Webtoon

"For what reason I live?"
Image

---
Completed project:


"What will you see when you are dead?"

Image

MY VISUAL NOVEL

CharlieTheMad256
Newbie
Posts: 12
Joined: Sat Feb 02, 2013 10:57 am
Projects: The Wind Whisperer (name in progress aka, might change the name)
Location: England
Contact:

Re: [Tutorial] Animation and Transforms by Example

#17 Post by CharlieTheMad256 »

Hey, were do you put the code for basic fade? I've tried putting it in options but that doesn't seem to work. :?

User avatar
Donmai
Eileen-Class Veteran
Posts: 1958
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: [Tutorial] Animation and Transforms by Example

#18 Post by Donmai »

Transform definitions must go into an Init block (I put mine in my main Script.rpy file).
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: [Tutorial] Animation and Transforms by Example

#19 Post by PyTom »

If transforms aren't in an init block, Ren'Py automatically creates an init 0 block and puts them in it. It's only necessary to put one inside an init block by hand if you need to replace an existing transform. (This is true for many statements - image, define, transform, and screen work this way.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
Sabotage
Regular
Posts: 27
Joined: Thu Mar 28, 2013 7:50 am
Projects: Cupcake! [WIP-40%] :: Riddled [Idea-0%]
Contact:

Re: [Tutorial] Animation and Transforms by Example

#20 Post by Sabotage »

Bless this post! I've been looking for this as I have somewhat grown tired of the usual "with dissolve" that we beginners are stuck with. Thanks so much, good sir!

User avatar
AERenoir
Veteran
Posts: 320
Joined: Fri May 27, 2011 8:23 pm
Contact:

Re: [Tutorial] Animation and Transforms by Example

#21 Post by AERenoir »

Hmm, I was wondering what approach should i use if I want a sprite to "transform" into a different one. Like say a character was in disguise. Then when they remove the disguise, I want the sprite to change to a different one. How would I do that with ATL?

TrickWithAKnife
Eileen-Class Veteran
Posts: 1261
Joined: Fri Mar 16, 2012 11:38 am
Projects: Rika
Organization: Solo (for now)
IRC Nick: Trick
Location: Tokyo, Japan
Contact:

Re: [Tutorial] Animation and Transforms by Example

#22 Post by TrickWithAKnife »

Code: Select all

    show clark regular
    clark "Lois, it's time you knew..."
    show clark costumed with dissolve # Change this to whatever effect you like.
    clark "...I love wearing women's clothes!"
"We must teach them through the tools with which they are comfortable."
The #renpy IRC channel is a great place to chat with other devs. Due to the nature of IRC and timezone differences, people probably won't reply right away.

If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.

User avatar
AERenoir
Veteran
Posts: 320
Joined: Fri May 27, 2011 8:23 pm
Contact:

Re: [Tutorial] Animation and Transforms by Example

#23 Post by AERenoir »

Hm, would I need to hide the old sprite? Especially if the "disguise form" looks a lot different from the "reveal form". Example, the disguise was a shady character with trench coat and hat and stuff. Then he removes the disguise and turns out he's actually a very sexy lady or something.

TrickWithAKnife
Eileen-Class Veteran
Posts: 1261
Joined: Fri Mar 16, 2012 11:38 am
Projects: Rika
Organization: Solo (for now)
IRC Nick: Trick
Location: Tokyo, Japan
Contact:

Re: [Tutorial] Animation and Transforms by Example

#24 Post by TrickWithAKnife »

For character sprites, you can use more than one name. For example, if I have an image called "clark happy" and another called "clark sad", Rrnpy would recognise them as being images of the same character. This means when I show one image of Clark, the images of him that were already on the screen would be replaced with the new one.
"We must teach them through the tools with which they are comfortable."
The #renpy IRC channel is a great place to chat with other devs. Due to the nature of IRC and timezone differences, people probably won't reply right away.

If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.

User avatar
Luxliev
Veteran
Posts: 242
Joined: Sat Feb 07, 2015 11:01 am
Soundcloud: Luxliev
Contact:

Re: [Tutorial] Animation and Transforms by Example

#25 Post by Luxliev »

Amazing post and I think that it doesn't have enough views. I've implemented all of the examples into code. For anyone interested here is ready renpy folder.

I don't own any of these pictures, all of them are used for educational purposes only.
Attachments
Animation and Transform.zip
(3.12 MiB) Downloaded 255 times
Newest classical cover: Advance Wars - Sami Theme: https://www.youtube.com/watch?v=657Jt7hJRVc

Forum with my music: http://luxliev.proboards.com/

User avatar
bloodyhair
Regular
Posts: 61
Joined: Tue Aug 11, 2015 7:20 am
Deviantart: Takada-Wang
Contact:

Re: [Tutorial] Animation and Transforms by Example

#26 Post by bloodyhair »

Thank so much! <3 this is really helping a lot to make a smooth transition. I think I only need to get used with it in order to make a better use of it :D

I wonder if you can make a video on how the result of the code would be looks like? I hope that wasn't a hassle for you ><

User avatar
Gryphbear
Regular
Posts: 91
Joined: Wed Jun 16, 2010 11:45 pm
Contact:

Re: [Tutorial] Animation and Transforms by Example

#27 Post by Gryphbear »

Okay. I have 4 images I want to 'cycle' through - only once in sequence - what would you suggest I use? They're 4 sprites that I've created to try to simulate the 'effect' of teleporting. I want to try to condense 10 lines -- but I'm not exactly sure where to start in using ATL.

I've tried the 'rain' example, but it worked -- a bit funkily. It cycled through the first 3-4 then sorta went backwards 1 or 2, then stopped on the last image.

Any tips? I want to create an ATL to show 4 images in a row with some 'delay' inbetween each one, and have it disappear at the end.
WIP: Ring av Guder - (Contemporary Fantasy VN/Dating Sim?)

What do you get when you inherit a mystical ring, meet Norse Dieties, and Werewolves, Satyrs, or Dwarves? Possibilities.

General Completion: 5% - (Still working on story plot.)
Story status: 1% (In progress of revamping)
Scripting: 1% (Prologue is about done)
Character Art: 0% (Would like to find a Bara-type Artist, but will learn to draw them myself if necessary)
BG/CG's: 0% (None so far)

017Bluefield
Regular
Posts: 93
Joined: Mon Dec 30, 2013 1:55 am
Projects: Project Bluefield - Origins
Organization: Autumn Rain
Deviantart: playerzero17
itch: autumn-rain
Contact:

Re: [Tutorial] Animation and Transforms by Example

#28 Post by 017Bluefield »

Is any of this applicable to screens? (e.g. confirm screens)

017Bluefield
Regular
Posts: 93
Joined: Mon Dec 30, 2013 1:55 am
Projects: Project Bluefield - Origins
Organization: Autumn Rain
Deviantart: playerzero17
itch: autumn-rain
Contact:

Re: [Tutorial] Animation and Transforms by Example

#29 Post by 017Bluefield »

Gryphbear wrote: Tue Dec 01, 2015 11:11 pm Okay. I have 4 images I want to 'cycle' through - only once in sequence - what would you suggest I use? They're 4 sprites that I've created to try to simulate the 'effect' of teleporting. I want to try to condense 10 lines -- but I'm not exactly sure where to start in using ATL.

I've tried the 'rain' example, but it worked -- a bit funkily. It cycled through the first 3-4 then sorta went backwards 1 or 2, then stopped on the last image.

Any tips? I want to create an ATL to show 4 images in a row with some 'delay' inbetween each one, and have it disappear at the end.
  • Don't use a repeat at the end. If you do need a repeat, add an integer after it (e.g. repeat 2, repeat 3...)
  • After the last image, use something like linear 1.0 alpha 0.0 to fade it out. (That might require invoking alpha 0.0 or 1.0 at the beginning, but I'm not sure how accurate that is...)

Post Reply

Who is online

Users browsing this forum: No registered users