Shorter blink code ?

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
Newnewbie
Newbie
Posts: 23
Joined: Sun Dec 08, 2019 4:06 am
Contact:

Shorter blink code ?

#1 Post by Newnewbie »

Hi guys!

I have a got a newb question (again).

I display blink on my characters face. And those are always in the same position. So I declared (example) :

Code: Select all

image blinks:
    "images/blinks0000.png"
    pause 0.8
    "images/blinks0001.png"
    pause 0.8
    repeat
But my question is, should I always indicate the position of my blink under every character dialogue line ? :

Code: Select all

show blinks:
    xpos 335
    ypos 72
Or is there a way to make this shorter?

Like writing a function or something to just write "show blinks" (dunno how we call it)?

Thank you

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Shorter blink code ?

#2 Post by Per K Grok »

Newnewbie wrote: Tue Dec 10, 2019 1:51 pm Hi guys!

I have a got a newb question (again).

I display blink on my characters face. And those are always in the same position. So I declared (example) :

Code: Select all

image blinks:
    "images/blinks0000.png"
    pause 0.8
    "images/blinks0001.png"
    pause 0.8
    repeat
But my question is, should I always indicate the position of my blink under every character dialogue line ? :

Code: Select all

show blinks:
    xpos 335
    ypos 72
Or is there a way to make this shorter?

Like writing a function or something to just write "show blinks" (dunno how we call it)?

Thank you

You should probably look at layered images

https://www.renpy.org/doc/html/layeredi ... ht=layered

User avatar
deltadidirac
Regular
Posts: 123
Joined: Fri Nov 30, 2018 5:00 am
Projects: Artworks and Comics
Tumblr: deltadidirac
Deviantart: Deltadidirac67
Location: Europe
Contact:

Re: Shorter blink code ?

#3 Post by deltadidirac »

Newnewbie wrote: Tue Dec 10, 2019 1:51 pm Hi guys!

I have a got a newb question (again).

I display blink on my characters face. And those are always in the same position. So I declared (example) :

Code: Select all

image blinks:
    "images/blinks0000.png"
    pause 0.8
    "images/blinks0001.png"
    pause 0.8
    repeat
But my question is, should I always indicate the position of my blink under every character dialogue line ? :

Code: Select all

show blinks:
    xpos 335
    ypos 72
Or is there a way to make this shorter?

Like writing a function or something to just write "show blinks" (dunno how we call it)?

Thank you

Try so,

1) create a new folder in images folder (as... images/character_atl)
2) save there your images and DEFINE IT

Code: Select all

image blink01:
	"images/character_atl/blink01.png"
	xalign 0.3 yalign 0.45                           ##########   here I don't remeber if you must use xalign or xpos (try both)
image blink02:
	"images/character_atl/blink02.png"
	xalign 0.3 yalign 0.45
image blink_hide:    ######## this is a transparent rectangular with the same dimension of the eyes ( for your example, you need it to call and create all)
	"image/character_atl/blink_hide.png"
	align 0.3 yalign 0.45    
etc...  #######PS you must and need to define also a "character background" on witch your eyes animation run hover.... ("char_paul_blink.png" e.g.)
3) create your ATL :

Code: Select all

transform blinks01:
	"blink01"
	pause 0.8
	"blink02"
	pause 0.8
	repeat
4) now you can call and execute your animation :

Code: Select all

lable my_label_blink:
	scene my_background_location with dissolve   ######## this is your location
	show char_paul_blink                                     ######## this is the character that have the animation
	show blink_hide at blinks01                            ######## this is your transparent rectangular that call and run your ATL
	a "hi gorgeus!"
	jump elswhere
try to read well my example, because it's a little bit different how is define all and read well the renpy documentation in the renpy site

User avatar
deltadidirac
Regular
Posts: 123
Joined: Fri Nov 30, 2018 5:00 am
Projects: Artworks and Comics
Tumblr: deltadidirac
Deviantart: Deltadidirac67
Location: Europe
Contact:

Re: Shorter blink code ?

#4 Post by deltadidirac »

PS....
I must apologize....
re-reading your post, perhaps I understand bad and you don't use a character without eyes and after you show eyes hover it...
but on contrary perhaps you are using the complete character with eyes open/eyes closed? (in this case is more easy to write all) and your example is right

The more simple way that I know to not going crazy with the definitions and the positions is to build all the png files in the window game dimension....
For eample : if you are building your game in 800X600 pxl so, all your png files (that will need animation) it might create in 800X600 pxl
in this way you have not need to define the position, it's ok only the "show" command....

User avatar
Newnewbie
Newbie
Posts: 23
Joined: Sun Dec 08, 2019 4:06 am
Contact:

Re: Shorter blink code ?

#5 Post by Newnewbie »

Thank you guys :o I'm going to try both!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], decocloud