Can anyone tell what is wrong in this code from cookbook?
http://www.renpy.org/wiki/renpy/doc/coo ... icle_Burst
It doesn't work in current Ren'py version.
Particle Burst - Cookbook
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.
Particle Burst - Cookbook
Newest classical cover: Advance Wars - Sami Theme: https://www.youtube.com/watch?v=657Jt7hJRVc
Forum with my music: http://luxliev.proboards.com/
Forum with my music: http://luxliev.proboards.com/
Re: Particle Burst - Cookbook
Prolly the way it is coded, Ren'Py changed quite a bit. I should have been a UDD anyhow...
- firecat
- Miko-Class Veteran
- Posts: 540
- Joined: Sat Oct 25, 2014 6:20 pm
- Completed: The Unknowns Saga series
- Projects: The Unknown Saga series
- Tumblr: bigattck
- Deviantart: bigattck
- Skype: bigattck firecat
- Soundcloud: bigattck-firecat
- Contact:
Re: Particle Burst - Cookbook
i try it on a old version and the current version, there is nothing wrong with it. what kind of error did you get?
Re: Particle Burst - Cookbook
LoL
It does still work it would seem but for me particles just stand still
It does still work it would seem but for me particles just stand still
Re: Particle Burst - Cookbook
How about this?:
Code is mine and is released under: "Do whatever the heck you want with it" license, without any warranties
Code: Select all
transform particle(d, delay, speed=1.0, around=(config.screen_width/2, config.screen_height/2), angle=0, radius=200):
d
pause delay
subpixel True
around around
radius 0
linear speed radius radius angle angle
init python:
class ParticleBurst(renpy.Displayable):
def __init__(self, displayable, interval=(0.02, 0.04), speed=(0.15, 0.3), around=(config.screen_width/2, config.screen_height/2), angle=(0, 360), radius=(50, 75), particles=None, mouse_sparkle_mode=False, **kwargs):
"""Creates a burst of displayable...
@params:
- displayable: Anything that can be shown in Ren'Py (expects a single displayable or a container of displayable to randomly draw from).
- interval: Time between bursts in seconds (expects a tuple with two floats to get randoms between them).
- speed: Speed of the particle (same rule as above).
- angle: Area delimiter (expects a tuple with two integers to get randoms between them) with full circle burst by default. (0, 180) for example will limit the burst only upwards creating sort of a fountain.
- radius: Distance delimiter (same rule as above).
- around: Position of the displayable (expects a tuple with x/y integers). Burst will be focused around this position.
- particles: Amount of particle to go through, endless by default.
- mouse_sparkle_mode: Focuses the burst around a mouse poiner overriding "around" property.
This is far better customizable than the original ParticleBurst and is much easier to expand further if an required..
"""
super(ParticleBurst, self).__init__(**kwargs)
self.d = [renpy.easy.displayable(d) for d in displayable] if isinstance(displayable, (set, list, tuple)) else [renpy.easy.displayable(displayable)]
self.interval = interval
self.speed = speed
self.around = around
self.angle = angle
self.radius = radius
self.particles = particles
self.msm = mouse_sparkle_mode
def render(self, width, height, st, at):
rp = store.renpy
if not st:
self.next = 0
self.particle = 0
self.shown = {}
render = rp.Render(width, height)
if not (self.particles and self.particle >= self.particles) and self.next <= st:
speed = rp.random.uniform(self.speed[0], self.speed[1])
angle = rp.random.randrange(self.angle[0], self.angle[1])
radius = rp.random.randrange(self.radius[0], self.radius[1])
if not self.msm:
self.shown[st + speed] = particle(rp.random.choice(self.d), st, speed, self.around, angle, radius)
else:
self.shown[st + speed] = particle(rp.random.choice(self.d), st, speed, rp.get_mouse_pos(), angle, radius)
self.next = st + rp.random.uniform(self.interval[0], self.interval[1])
if self.particles:
self.particle = self.particle + 1
for d in self.shown.keys():
if d < st:
del(self.shown[d])
else:
d = self.shown[d]
render.blit(d.render(width, height, st, at), (d.xpos, d.ypos))
rp.redraw(self, 0)
return render
def visit(self):
return self.d
# Code above can be ignored, this is what you need:
image boom = ParticleBurst([Solid("#%06x"%renpy.random.randint(0, 0xFFFFFF), xysize=(5, 5)) for i in xrange(50)], mouse_sparkle_mode=True)
# Simpler setup could be:
# image starburst = ParticleBurst("star.png")
# or even:
# image starburst = ParticleBurst("star")
# if you have an image called "star.png" in game/images/ folder or image star had been previously defined.
label start:
scene black
show boom
pause
Re: Particle Burst - Cookbook [SOLVED]
Code loads but it doesn't work, nothing happens.firecat wrote:i try it on a old version and the current version, there is nothing wrong with it. what kind of error did you get?
That's pretty cool! Thanks for sharingxela wrote:How about this?:
Newest classical cover: Advance Wars - Sami Theme: https://www.youtube.com/watch?v=657Jt7hJRVc
Forum with my music: http://luxliev.proboards.com/
Forum with my music: http://luxliev.proboards.com/
- Donmai
- Eileen-Class Veteran
- Posts: 1962
- 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: Particle Burst - Cookbook
Awesome!
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)
TOIRE NO HANAKO (A Story About Fear)
Re: Particle Burst - Cookbook
Thanks, most older stuff in cookbook similar to this should prolly be rewritten in this manner now that we have ATL.