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

Homing Attack Trail Effect Help


Wolfbane101

Recommended Posts

Long time no see people! I have alot of things to tell you guys what I'm working on after I fix this little issue. It has to deal with the homing attack effect. I put in a particle effect that is sphere shaped and additive. The problem is that if I reach a certain speed the effect splits apart making the circles appear with gaps, which looks very ugly. I need to be smooth and looking like the trail in Sonic 4 and Generations. If you can help that would be absolutely great. Btw I'm using game maker 8. Best of luck...

Link to comment
Share on other sites

You're working in mmf2 right?

It should be something like this

Every (time here) an animation or action is playing create (effect object) from 0,0 (object)

In other words

bk3h

or

bk4O

You can do this with actions in place of animations which is probably a better idea, I just screencapped an old engine.

Basically, the lower the time, the less of a gap.

Just make sure the object destroys itself once the animation is complete, otherwise you'll be dealing with too many objects to run smoothly.

Link to comment
Share on other sites

Please read posts before demonstrating really bad programming techniques for solving a problem. It said right in it that he was using Game Maker 8.

EDIT: That said, while the method is off, the concept is sound. However frequently you are creating particles, scale that frequency based on the speed of the player. That works if you aren't already creating particles in every frame anyway.

Link to comment
Share on other sites

The problem is its NOT creating objects, its in particle system. Here let me show what the code looks like

        
ps = part_system_create()
pt = part_type_create()
pe = part_emitter_create(ps)

part_system_depth(ps, depth-1);
part_type_shape(pt, pt_shape_sphere);
part_type_blend(pt, 1);
part_type_alpha3(pt, 1,1,1);
part_type_color3(pt, 16711680, 16711680, 16711680);
part_type_direction(pt, direction, direction, 0, 0);
part_type_speed(pt, 0, 0, 0, 0);
part_type_gravity(pt, 0, 0)
part_type_size(pt, 0.5, 0.5, 0, 0);
part_type_life(pt, 40, 40);
part_type_orientation(pt, 0, 0, 0, 0, 1);
part_type_scale(pt, 1, 1);
part_emitter_region(ps, pe, x, x, y, y, ps_shape_rectangle, ps_distr_linear);
part_emitter_burst(ps, pe, pt, 1);
[/CODE]

But with a homing attack, which has a lot of speed, looks like eeewwww

EDIT: These is using speed and direction but I also need it to work for hspeed and vspeed.

post-4768-138639765264_thumb.png

Link to comment
Share on other sites

I think that I can help with this.

First, you don't need the emitter. That's for regions - If it's a specific x and y value, there's a function that can emit particles from it without coding an emitter: part_particles_create.

For each step while the homing attack is in action, use a code like this:


_speed=point_distance(0,0,_xspeed,_yspeed)
_repeats=ceil(_speed/4)
_x=0
_y=0
repeat(_repeats)
{
part_particles_create(ps, x+_x, y+_y, pt, 1)
_x+=_xspeed/_repeats
_y+=_yspeed/_repeats
}[/CODE]

The value of _xspeed is the difference in the x location, the value of _yspeed is the difference in the y location. How you calculate those is up to you.

The value 4 may need to be changed, depending on how fast you need to be going for the problem to arise.

This is more or less what Dimension Winnie said to do.

  • Like 1
Link to comment
Share on other sites

Oops, I just realized a problem. _x and _y should be subtracted, not added. If they're added, the effect will be in front of Sonic when he homing-attacks, not behind him.

_speed=point_distance(0,0,_xspeed,_yspeed)
_repeats=ceil(_speed/4)
_x=0
_y=0
repeat(_repeats)
{
part_particles_create(ps, x-_x, y-_y, pt, 1)
_x+=_xspeed/_repeats
_y+=_yspeed/_repeats
}[/CODE]

Link to comment
Share on other sites

No, this isn't about efficiency, it's about making the effect have a better appearance.

The particle effect involved is basically just making colorful circles that appear wherever the player is. The problem is, if the player is moving quickly there will be a larger gap between the circles and the effect will look like the player is just being chased by growing circles. Wolfbane wants the player character to be followed by something that looks more like just a blue blur, and the only way to keep the effect consistent regardless of the speed of the player is to create the effect more frequently if the player is traveling faster and to space them out between where the player was in the previous frame and the player's new position.

EDIT: In retrospect, I think you are talking about the rep system, aren't you...

No, that isn't about efficiency either. It's about doing away with the horrible power creep that allows people to dispense dozens of rep with a single comment once they get into the couple hundred range or so.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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