Hello,
Sorry if this has been asked, it's just that I have found a number of different things on the topic.
Is there an efficient and simple way of using a spritesheet to animate one or more characters in Ren'Py?
Note that the spritesheet will have a custom format.
I don't want the game to have poor performance if I have 10-15 characters on screen.
Any help on the topic would be appreciated. Thanks!
[SOLVED] Spritesheet Support?
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.
- SypherZent
- Veteran
- Posts: 373
- Joined: Fri Sep 02, 2016 3:14 am
- Completed: Multiverse Heroes, Space Hamster in Turmoil
- Location: Puerto Rico
- Contact:
[SOLVED] Spritesheet Support?
Last edited by SypherZent on Sat Jan 07, 2017 11:41 pm, edited 1 time in total.
Creator of Multiverse Heroes & Space Hamster in Turmoil
Want me to code your game?
Check my services thread!
Want me to code your game?
Check my services thread!
- nyaatrap
- Crawling Chaos
- Posts: 1824
- Joined: Mon Feb 13, 2012 5:37 am
- Location: Kimashi Tower, Japan
- Contact:
Re: Spritesheet Support?
The most straight forward way is:
Though it's very redundant way of coding.
There're some other ways to code more efficiently. One example code I'm using is:
Code: Select all
image spriteX:
"sheetX.png"
crop (0,0,width,height)
pause 1.0/framerate
crop (0,1*height, width, height)
pause 1.0/framerate
There're some other ways to code more efficiently. One example code I'm using is:
Code: Select all
init pyton:
def draw_effect(st, at, image_path, last_frame, width=360, height=360, framerate=24):
# Retruns a Filmstrip displayable
number=int(st*framerate)
if number < last_frame:
return Transform("gfx/{}.png".format(image_path), crop=(0,height*number,width,height)), 1.0/framerate
else:
return Null(), None
renpy.image(effect, DynamicDisplayable(draw_effect, image_path, last_frame))
- SypherZent
- Veteran
- Posts: 373
- Joined: Fri Sep 02, 2016 3:14 am
- Completed: Multiverse Heroes, Space Hamster in Turmoil
- Location: Puerto Rico
- Contact:
Re: Spritesheet Support?
Aha! Much simpler than I thought.
Excellent, thank you! Both examples are straightforward and helpful.
Will also take a peek at LiveCrop to see if I can use it.
Thanks for the quick replies!
Excellent, thank you! Both examples are straightforward and helpful.
Will also take a peek at LiveCrop to see if I can use it.
Thanks for the quick replies!
Who is online
Users browsing this forum: Bing [Bot], pockatuck