How to make a character jump?
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.
- Moonspeck
- Regular
- Posts: 35
- Joined: Thu Jan 07, 2016 12:30 pm
- Projects: Sentimental Trickster, new BL fantasy dating sim
- Organization: Lovenuts
- itch: lazuli
- Contact:
How to make a character jump?
Hello,
Do you know how to make a character sprite do a little jump? I've been searching for this but couldn't find it anywhere. I have a general idea but I feel it requires a lot of experimentation with movement and ease. Maybe someone has already figured it out? Thanks in advance!
Do you know how to make a character sprite do a little jump? I've been searching for this but couldn't find it anywhere. I have a general idea but I feel it requires a lot of experimentation with movement and ease. Maybe someone has already figured it out? Thanks in advance!
- RicharDann
- Veteran
- Posts: 286
- Joined: Thu Aug 31, 2017 11:47 am
- Contact:
Re: How to make a character jump?
Adjusting the ypos with an ATL transform, supposing you have your characters aligned to the bottom of the screen (that's 1.0 on the y-axis), it could be something like this:
Code: Select all
transform small_jump:
linear .1 ypos .9 #Move the character to 0.9 (a little up, it starts at 1.0) in 0.1 second
linear .1 ypos 1.0 #Move the character back to ypos 1.0
label start:
show mary
m "I'm so happy!"
show mary at center, small_jump
The most important step is always the next one.
- Moonspeck
- Regular
- Posts: 35
- Joined: Thu Jan 07, 2016 12:30 pm
- Projects: Sentimental Trickster, new BL fantasy dating sim
- Organization: Lovenuts
- itch: lazuli
- Contact:
Re: How to make a character jump?
Yes, this is exactly what I needed. Looks good, thank you very much!RicharDann wrote: ↑Wed Oct 18, 2017 3:11 pm Adjusting the ypos with an ATL transform, supposing you have your characters aligned to the bottom of the screen (that's 1.0 on the y-axis), it could be something like this:
Code: Select all
transform small_jump: linear .1 ypos .9 #Move the character to 0.9 (a little up, it starts at 1.0) in 0.1 second linear .1 ypos 1.0 #Move the character back to ypos 1.0 label start: show mary m "I'm so happy!" show mary at center, small_jump
- Belgerum
- Regular
- Posts: 110
- Joined: Thu Nov 06, 2014 12:24 am
- Skype: belgerum09
- Soundcloud: Belgerum
- itch: Belgerum
- Contact:
Re: How to make a character jump?
I would personally use code that's a tiny bit different, if you want to experiment a bit:
This version uses easein and easeout to make the movement a little more smooth, and uses yoffset instead of ypos so that the transform can be used from any starting point, not just the bottom of the screen.
This version uses easein and easeout to make the movement a little more smooth, and uses yoffset instead of ypos so that the transform can be used from any starting point, not just the bottom of the screen.
Code: Select all
transform small_jump:
easein 0.1 yoffset -0.1
easeout 0.1 yoffset 0.1
Re: How to make a character jump?
The jump works beautifully!!!
I'd like to combine the jump with a dissolve expression change, but it doesn't... work.
It gives me an error code that says "end of line expected."
I mean, I know I can do both functions--the jump and the dissolve--one after the other, but I'd like it to be simultaneous. Is this possible?
I'd like to combine the jump with a dissolve expression change, but it doesn't... work.
Code: Select all
show andy sad bothhands with dissolve at right, small_jump
I mean, I know I can do both functions--the jump and the dissolve--one after the other, but I'd like it to be simultaneous. Is this possible?
- Belgerum
- Regular
- Posts: 110
- Joined: Thu Nov 06, 2014 12:24 am
- Skype: belgerum09
- Soundcloud: Belgerum
- itch: Belgerum
- Contact:
Re: How to make a character jump?
You have the order wrong. The "at" statement should be before the "with" statement.
Code: Select all
show andy sad bothhands at right, small_jump with dissolve
- Moonspeck
- Regular
- Posts: 35
- Joined: Thu Jan 07, 2016 12:30 pm
- Projects: Sentimental Trickster, new BL fantasy dating sim
- Organization: Lovenuts
- itch: lazuli
- Contact:
Re: How to make a character jump?
Thank you so much for another great jump code!Belgerum wrote: ↑Wed Oct 18, 2017 6:03 pm I would personally use code that's a tiny bit different, if you want to experiment a bit:
This version uses easein and easeout to make the movement a little more smooth, and uses yoffset instead of ypos so that the transform can be used from any starting point, not just the bottom of the screen.
Code: Select all
transform small_jump: easein 0.1 yoffset -0.1 easeout 0.1 yoffset 0.1
- RicharDann
- Veteran
- Posts: 286
- Joined: Thu Aug 31, 2017 11:47 am
- Contact:
Re: How to make a character jump?
OMG I knew there had to be a way to use it from any starting point but I couldn't find it at all when I looked it up some time ago, that's why so far I had to stick with the code I presented ealier. I'll have to rewrite a lot of my code now but it's well worth it, Thank you thank you so much!Belgerum wrote: ↑Wed Oct 18, 2017 6:03 pm I would personally use code that's a tiny bit different, if you want to experiment a bit:
This version uses easein and easeout to make the movement a little more smooth, and uses yoffset instead of ypos so that the transform can be used from any starting point, not just the bottom of the screen.
Code: Select all
transform small_jump: easein 0.1 yoffset -0.1 easeout 0.1 yoffset 0.1
The most important step is always the next one.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot]