Character shake not screen [Solved]

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.
Message
Author
User avatar
XxrenxX
Veteran
Posts: 267
Joined: Tue Oct 02, 2012 2:40 am
Projects: Chasing
Deviantart: bara-ettie
Location: Canada
Contact:

Character shake not screen [Solved]

#1 Post by XxrenxX »

Is there a simple code for this? I only want a certain character sprite to shake, as if being hit, not the screen or other characters. Thanks.
Last edited by XxrenxX on Sun Feb 17, 2013 4:45 pm, edited 1 time in total.

User avatar
Chrizine
Regular
Posts: 178
Joined: Fri Nov 26, 2010 1:47 pm
Projects: Perios - Chained Sorceress (WIP), Sword vs. Staff (WIP)
Organization: Motdl Productions
Location: Currently Switzerland
Contact:

Re: Character shake not screen

#2 Post by Chrizine »

That's exactly the problem I am facing at the moment, too... Let's hope for a reply, if i figure something out, I'll post it here. I tried around with vpunch, but it seems you can't apply it to single objects, it is always shaking the screen.
Take a look at Perios - Chained Sorceress!
And also on Sword vs. Staff, my short new project...
And, of course, our blog!
Honest Critique

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Character shake not screen

#3 Post by nyaatrap »

It's not hard with ATL. It's simple or not is depends on you.
If you decide to learn ATL, it's easy. If not, it's hard.

User avatar
Chrizine
Regular
Posts: 178
Joined: Fri Nov 26, 2010 1:47 pm
Projects: Perios - Chained Sorceress (WIP), Sword vs. Staff (WIP)
Organization: Motdl Productions
Location: Currently Switzerland
Contact:

Re: Character shake not screen

#4 Post by Chrizine »

I guess the code in this thread could be helpful: http://lemmasoft.renai.us/forums/viewto ... ransitions
Maybe if one added a layers argument (as seen here: http://www.renpy.org/doc/html/transitions.html), this would serve our purpose? The problem is, I don't know what to put as layers.
Take a look at Perios - Chained Sorceress!
And also on Sword vs. Staff, my short new project...
And, of course, our blog!
Honest Critique

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Character shake not screen

#5 Post by nyaatrap »

renpy.layer_at_list(at_list, layer='master') moves layers. I'm using it, but it's far from simple. If you want, I can post my codes but I don't know it's understandable easily. I think just use ATL on one sprite is easier than using MoveFunction.

User avatar
Chrizine
Regular
Posts: 178
Joined: Fri Nov 26, 2010 1:47 pm
Projects: Perios - Chained Sorceress (WIP), Sword vs. Staff (WIP)
Organization: Motdl Productions
Location: Currently Switzerland
Contact:

Re: Character shake not screen

#6 Post by Chrizine »

It's always worth a try. I'd like to see your code!
Take a look at Perios - Chained Sorceress!
And also on Sword vs. Staff, my short new project...
And, of course, our blog!
Honest Critique

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Character shake not screen

#7 Post by nyaatrap »

define transform first,

Code: Select all

    transform shake:
        ease .06 yoffset 24
        ease .06 yoffset -24
        ease .05 yoffset 20
        ease .05 yoffset -20
        ease .04 yoffset 16
        ease .04 yoffset -16
        ease .03 yoffset 12
        ease .03 yoffset -12
        ease .02 yoffset 8
        ease .02 yoffset -8
        ease .01 yoffset 4
        ease .01 yoffset -4
        ease .01 yoffset 0
to use in one character,

Code: Select all

show char at shake
and layers,

Code: Select all

$renpy.layer.at_list(shake, "master")
But there are some difficulties (or bugs?) in layer.at_list, so you need some more codes to work it well.

User avatar
Chrizine
Regular
Posts: 178
Joined: Fri Nov 26, 2010 1:47 pm
Projects: Perios - Chained Sorceress (WIP), Sword vs. Staff (WIP)
Organization: Motdl Productions
Location: Currently Switzerland
Contact:

Re: Character shake not screen

#8 Post by Chrizine »

Thank you very much! This solved it for me, and since I only need to shake one character at a time, it seems I don't even have to bother about the layers.
Take a look at Perios - Chained Sorceress!
And also on Sword vs. Staff, my short new project...
And, of course, our blog!
Honest Critique

User avatar
XxrenxX
Veteran
Posts: 267
Joined: Tue Oct 02, 2012 2:40 am
Projects: Chasing
Deviantart: bara-ettie
Location: Canada
Contact:

Re: Character shake not screen

#9 Post by XxrenxX »

I just need to tweak it a bit to make it how i want but it works exactly how I want so far. Thanks!

ZeroQ
Newbie
Posts: 20
Joined: Thu Jun 21, 2012 12:05 am
Contact:

Re: Character shake not screen

#10 Post by ZeroQ »

nyaatrap wrote:define transform first,

Code: Select all

    transform shake:
        ease .06 yoffset 24
        ease .06 yoffset -24
        ease .05 yoffset 20
        ease .05 yoffset -20
        ease .04 yoffset 16
        ease .04 yoffset -16
        ease .03 yoffset 12
        ease .03 yoffset -12
        ease .02 yoffset 8
        ease .02 yoffset -8
        ease .01 yoffset 4
        ease .01 yoffset -4
        ease .01 yoffset 0
to use in one character,

Code: Select all

show char at shake
and layers,

Code: Select all

$renpy.layer.at_list(shake, "master")
But there are some difficulties (or bugs?) in layer.at_list, so you need some more codes to work it well.

Thank you, this code is very helpful.

I've played some of your games, like "Astraea Rio" and "Avatar Akari", and I was wondering if you could provide the code you use to make a character dissolve and pan onto or off of the screen.

Any help you could provide would really be appreciated.

Keep up the good work ^_^

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Character shake not screen [Solved]

#11 Post by nyaatrap »

If you downloaded them, then you can see the codes in their game folder. Though, I don't want to past those old codes because those transforms were written without arguments. I didn't know transforms can take arguments at that time. I'm start making new ones for the next game which uses transforms with arguments. They would be like:

Code: Select all

transform movein_from_right(xposition=0.5, zoomlevel=1.0):
    alpha .0 align (.5,.5) xoffset 128 xpos xposition ypos .5 zoom zoomlevel 
    ease .5 alpha 1.0 xoffset 0

Code: Select all

show character1 at movein_from_right(.7,.65)

User avatar
saguaro
Miko-Class Veteran
Posts: 560
Joined: Sun Feb 12, 2012 9:17 am
Completed: Locked-In, Sunrise, The Censor
Organization: Lucky Special Games
itch: saguarofoo
Location: USA
Contact:

Re: Character shake not screen [Solved]

#12 Post by saguaro »

I didn't know transforms could take an argument. Thank you for that.

ZeroQ
Newbie
Posts: 20
Joined: Thu Jun 21, 2012 12:05 am
Contact:

Re: Character shake not screen [Solved]

#13 Post by ZeroQ »

nyaatrap wrote:If you downloaded them, then you can see the codes in their game folder. Though, I don't want to past those old codes because those transforms were written without arguments. I didn't know transforms can take arguments at that time. I'm start making new ones for the next game which uses transforms with arguments. They would be like:

Code: Select all

transform movein_from_right(xposition=0.5, zoomlevel=1.0):
    alpha .0 align (.5,.5) xoffset 128 xpos xposition ypos .5 zoom zoomlevel 
    ease .5 alpha 1.0 xoffset 0

Code: Select all

show character1 at movein_from_right(.7,.65)
Thank you.
I knew about being able to access the code in your game beforehand. The problem is that I'm still fairly new to coding so I couldn't understand most of it.
XP

lowkey
Newbie
Posts: 7
Joined: Mon Jul 27, 2015 3:22 pm
Deviantart: yong-rein
Contact:

Re: Character shake not screen [Solved]

#14 Post by lowkey »

I know this is solved, but I'm new and I want to know how to define a transformation? Like I tried searching it up, but i'm confused. how do I place this is my script?

define transform first,
Code:
transform shake:
ease .06 yoffset 24
ease .06 yoffset -24
ease .05 yoffset 20
ease .05 yoffset -20
ease .04 yoffset 16
ease .04 yoffset -16
ease .03 yoffset 12
ease .03 yoffset -12
ease .02 yoffset 8
ease .02 yoffset -8
ease .01 yoffset 4
ease .01 yoffset -4
ease .01 yoffset 0

to use in one character,
Code:
show char at shake

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: Character shake not screen [Solved]

#15 Post by Donmai »

You should read the quickstart, lowkey. And play through the tutorial game, and study the script of The Question. You can find the quickstart here: http://www.renpy.org/doc/html/quickstart.html

To better answer your question, you can put that transform definition anywhere. Most people put it at the start of the 'script.rpy' file. Or you can create a new 'transforms.rpy' file and put it there.
To use that transform on a sprite you just do as suggested, at the moment of showing that sprite.

Try this: run Ren'py and load 'The Question'. On the launcher screen, click on 'Navigate Script'. On the 'Category' list, make sure the files tab is selected. Click on the '+Add Script File' button. Type transforms.rpy and press the return key. A 'transforms.rpy' will be added to the current project. Highlight the text of the shake transform definition and paste it on the 'transforms.rpy' file. Make sure it looks like this:

Code: Select all

transform shake:
    ease .06 yoffset 24
    ease .06 yoffset -24
    ease .05 yoffset 20
    ease .05 yoffset -20
    ease .04 yoffset 16
    ease .04 yoffset -16
    ease .03 yoffset 12
    ease .03 yoffset -12
    ease .02 yoffset 8
    ease .02 yoffset -8
    ease .01 yoffset 4
    ease .01 yoffset -4
    ease .01 yoffset 0
Save that file.
Now edit the 'script.rpy' file of The Question. Navigate to line 89. Change

Code: Select all

show sylvie surprised
to

Code: Select all

show sylvie surprised at shake, center
Save the file.
Now play the game (choose 'ask her right away'). Keep playing. You will see that Sylvie will "tremble" with surprise when she hear the question.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

Post Reply

Who is online

Users browsing this forum: Google [Bot]