Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

[GM7] Help with particles


Mr.S

Recommended Posts

Using this program here:

http://gmc.yoyogames.com/?showtopic=290449

You can easily create particles. But i have a problem:

I have created a nice effect for when Sonic picks up high speed. But i can not get my particles to follow Sonic or move at all.

Anyone know any ways of getting particles to move? This is the code for my particles:

Create Event (For obj_Burst_particle)

//Create the particle system. Assign it to a variable(Sname is used here).
Sname = part_system_create()
particle1 = part_system_create()

Step Event:

particle1 = part_type_create();
part_type_shape(particle1,pt_shape_flare)
part_type_size(particle1,0.16,0.66,0,0)
part_type_scale(particle1,3.01,1)
part_type_color3(particle1,8421504,8388608,16711680)
part_type_alpha3(particle1,0.63,0.38,0.08)
part_type_speed(particle1,4.74,6.14,-0.08,0)
part_type_direction(particle1,0,180,0,6)
part_type_gravity(particle1,0.50,200)
part_type_orientation(particle1,0,0,0,0,1)
part_type_blend(particle1,1)
part_type_life(particle1,30,30)
emitter1 = part_emitter_create(Sname)
part_emitter_region(Sname,emitter1,x,x,y,y,ps_shape_ellipse,1)
part_emitter_stream(Sname,emitter1,particle1,4)

Any ideas ?

Link to comment
Share on other sites

part_system_position(ind,x,y) Sets the position where the particle system is drawn. This is normally not necessary but if you want to have particles at a position relative to a moving object, you can set the position e.g. to that object.

A few problems I notice with your code:

-First of all, you create an unneeded particle system with "particle1 = part_system_create()" because you re-assign that variable to a particle type.

-Also, you're creating a new emitter and particle at every step without deleting them. This will create a memory leak that you probably won't notice at first since particle types are so low-memory, but will eventually prove to be very bad. What you should do instead is create them in the create event, and only modify them in the step event. However, since the particle type doesn't have any information which changes depending on object state, there's no need for that. Also, since you're going to be using the above function to shift the entire system, I don't think there's any need to move around the emitter either. So you can put that in the create event as well.

Create Event:

Sname = part_system_create()

particle1 = part_type_create()
part_type_shape(particle1,pt_shape_flare)
part_type_size(particle1,0.16,0.66,0,0)
part_type_scale(particle1,3.01,1)
part_type_color3(particle1,8421504,8388608,16711680)
part_type_alpha3(particle1,0.63,0.38,0.08)
part_type_speed(particle1,4.74,6.14,-0.08,0)
part_type_direction(particle1,0,180,0,6)
part_type_gravity(particle1,0.50,200)
part_type_orientation(particle1,0,0,0,0,1)
part_type_blend(particle1,1)
part_type_life(particle1,30,30)

emitter1 = part_emitter_create(Sname)
part_emitter_region(Sname,emitter1,0,0,0,0,ps_shape_ellipse,1)
part_emitter_stream(Sname,emitter1,particle1,4)

Step event:

part_system_position(Sname,x,y)

Destroy event:

part_emitter_destroy(Sname,emitter1);
part_type_destroy(particle1);
part_system_destroy(Sname);

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...