Lip flap and random blinking with ATL? [SOLVED]
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.
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.
- SundownKid
- Lemma-Class Veteran
- Posts: 2299
- Joined: Mon Feb 06, 2012 9:50 pm
- Completed: Icebound, Selenon Rising Ep. 1-2
- Projects: Selenon Rising Ep. 3-4
- Organization: Fastermind Games
- Deviantart: sundownkid
- Location: NYC
- Contact:
Lip flap and random blinking with ATL? [SOLVED]
I'm trying to use this code to make the characters have the blinking animation, but it seems to be non-random in the amount of time characters have their eyes open. How do I add a random number picker or something?
Also, isn't the Animation function deprecated?
Unrelated question: Is it possible to enclose the entire thing in another animation that makes it bob slightly up and down?
Also, isn't the Animation function deprecated?
Unrelated question: Is it possible to enclose the entire thing in another animation that makes it bob slightly up and down?
Last edited by SundownKid on Tue Dec 17, 2013 6:41 am, edited 3 times in total.
- Mild Curry
- Regular
- Posts: 107
- Joined: Fri Jul 02, 2010 3:03 pm
- Projects: That's The Way The Cookie Crumbles
- Organization: TwinTurtle Games
- Contact:
Re: LiveComposite with random blinking?
Randomizing the amount of time between blinks would be hard, because you’d have to keep updating the animation with the new time. Might be possible to write a function that randomizes a number and then shows the animation…I dunno. If you have some python experience you could play around with renpy.random.randint() and renpy.show().
What I would do, though, is just extend the animation so it's a cycle of differently timed blinks, which would appear more natural.
Also, for your second question, bobbing is easily achieved with a transform:
Just declare a transform somewhere (an init block is best):
(this one just goes up and down a little bit at the middle of the screen)
Then, when you’re ready to show the LiveComposite, do this:
http://www.renpy.org/doc/html/atl.html
What I would do, though, is just extend the animation so it's a cycle of differently timed blinks, which would appear more natural.
Code: Select all
Animation("eyes.png", 4.0, "blink.png", 0.1, "eyes.png", 6.0, "blink.png", 0.1, "eyes.png", 1.5, "blink.png", 0.1)
Just declare a transform somewhere (an init block is best):
(this one just goes up and down a little bit at the middle of the screen)
Code: Select all
transform bobbing:
xalign 0.5
yalign 0.5
linear 1.0 yalign 0.49
linear 1.0 yalign 0.5
repeatCode: Select all
show myComposite at bobbing
- SundownKid
- Lemma-Class Veteran
- Posts: 2299
- Joined: Mon Feb 06, 2012 9:50 pm
- Completed: Icebound, Selenon Rising Ep. 1-2
- Projects: Selenon Rising Ep. 3-4
- Organization: Fastermind Games
- Deviantart: sundownkid
- Location: NYC
- Contact:
Re: LiveComposite with random blinking? [unsolved]
EDIT:
Got the bobbing to work using yanchor instead.
I still could use a random number maker to save space.
Got the bobbing to work using yanchor instead.
I still could use a random number maker to save space.
Re: LiveComposite with random blinking? [unsolved]
From one of my really really old porn games, but I think the code still applies todaySundownKid wrote: I still could use a random number maker to save space.
Code: Select all
# -------------------Character Sprites----------------------
#Katja sprites
#base pngs
$ base = Image("katjabase.png")
$ curiousbase = Image("katjabasecurious.png")
$ smilebase = Image("katjabasesmiling.png")
#eye pngs
$ eyenormal = Image( "katjalayeyecurious.png")
$ eyeshift = Image("katjalayeyeshift.png")
$ eyeblink = Image("katjalayeyeblinking.png")
$ eyescared = Image("katjalayeyescared.png")
$ eyesmile = Image("katjalayeyesmiling.png")
#composite curious face 3 states of animation
$ curious = im.Composite((225, 600), (0, 0), "blank.png", (0, 300), base, (0, 300), curiousbase, (0, 300), eyenormal)
$ curiousblink = im.Composite((225, 600), (0, 0), "blank.png", (0, 300), base, (0, 300), curiousbase, (0, 300), eyeblink)
$ curiousshift = im.Composite((225, 600), (0, 0), "blank.png", (0, 300), base, (0, 300), curiousbase, (0, 300), eyeshift)
#composite smiling face 3 states of animation
$ smiling = im.Composite((225, 600), (0, 0), "blank.png", (0, 300), base, (0, 300), smilebase, (0, 300), eyenormal)
$ smilingblink = im.Composite((225, 600), (0, 0), "blank.png", (0, 300), base, (0, 300), smilebase, (0, 300), eyeblink)
$ smilingshift = im.Composite((225, 600), (0, 0), "blank.png", (0, 300), base, (0, 300), smilebase, (0, 300), eyeshift)
#composite non-animated expressions
$ scared = im.Composite((225, 600), (0, 0), "blank.png", (0, 300), base, (0, 300), curiousbase, (0, 300), eyescared)
#animated curious
$ kneutral = Character('Katja', color="#000000", ctc=anim.Blink("arrow.png"), window_left_padding=230,
show_side_image=anim.SMAnimation(
"open",
anim.State("open", Image(curious, xalign=0.0, yalign=1.0)),
anim.State("close", Image(curiousblink, xalign=0.0, yalign=1.0)),
anim.State("shift", Image(curiousshift, xalign=0.0, yalign=1.0)),
anim.Edge("open", 1.0, "open", prob=4),
anim.Edge("shift", 0.3, "shift", prob=2),
anim.Edge("shift", 0.1, "close"),
anim.Edge("open", 0.1, "close"),
anim.Edge("close", 0.1, "open") ,
anim.Edge("close", 0.1, "shift"),
))
#animated smiling
$ ksmile = Character('Katja', color="#000000", ctc=anim.Blink("arrow.png"), window_left_padding=230,
show_side_image=anim.SMAnimation(
"open",
anim.State("open", Image(smiling, xalign=0.0, yalign=1.0)),
anim.State("close", Image(smilingblink, xalign=0.0, yalign=1.0)),
anim.State("shift", Image(smilingshift, xalign=0.0, yalign=1.0)),
anim.Edge("open", 1.0, "open", prob=4),
anim.Edge("shift", 0.3, "shift", prob=2),
anim.Edge("shift", 0.1, "close"),
anim.Edge("open", 0.1, "close"),
anim.Edge("close", 0.1, "open") ,
anim.Edge("close", 0.1, "shift"),
))
#non-animated expressions
$ kscared = Character('Katja', color="#000000", ctc=anim.Blink("arrow.png"), window_left_padding=230,
show_side_image=Image(scared, xalign=0.0, yalign=1.0))
$ kthink = Character(None, color="#000000", ctc=anim.Blink("arrow.png"), window_left_padding=20)
$ kterrified = Character(None, color="#000000", ctc=anim.Blink("arrow.png"), window_left_padding=20, what_slow_cps=20)
$ kmono = Character('Katja', color="#000000", ctc=anim.Blink("arrow.png"), window_left_padding=20)
- SundownKid
- Lemma-Class Veteran
- Posts: 2299
- Joined: Mon Feb 06, 2012 9:50 pm
- Completed: Icebound, Selenon Rising Ep. 1-2
- Projects: Selenon Rising Ep. 3-4
- Organization: Fastermind Games
- Deviantart: sundownkid
- Location: NYC
- Contact:
Re: LiveComposite with random blinking? [unsolved]
That is pretty old, it seems to have been replaced by ATL. Is there a way to do that anim.State stuff (and like, the blink and lip flap in general) with ATL?
Re: Lip flap and random blinking with ATL? [unsolved]
Maybe try adding "repeat" under image girl eyes normal. That worked for me.
- SundownKid
- Lemma-Class Veteran
- Posts: 2299
- Joined: Mon Feb 06, 2012 9:50 pm
- Completed: Icebound, Selenon Rising Ep. 1-2
- Projects: Selenon Rising Ep. 3-4
- Organization: Fastermind Games
- Deviantart: sundownkid
- Location: NYC
- Contact:
Re: Lip flap and random blinking with ATL? [unsolved]
I recently figured it out actually, so you can feel free to let this thread die. The relevant code is now in the Cookbook.
(But you're right, I forgot repeat - added to the code).
(But you're right, I forgot repeat - added to the code).
Who is online
Users browsing this forum: Bing [Bot], Google [Bot]
