Wolfbane101 Posted December 23, 2011 Report Share Posted December 23, 2011 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 More sharing options...
DimensionWarped Posted December 23, 2011 Report Share Posted December 23, 2011 Figure out a maximum tolerable gap, divide the distance traveled in each frame by that gap size to determine the number of objects needed to maintain that gap size, then create new objects to fill in at those distances. Link to comment Share on other sites More sharing options...
Floofy Posted December 23, 2011 Report Share Posted December 23, 2011 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 or 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 More sharing options...
DimensionWarped Posted December 23, 2011 Report Share Posted December 23, 2011 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 More sharing options...
Serephim Posted December 23, 2011 Report Share Posted December 23, 2011 Just walked in to say, dont ever use the timer events on this program, they'll probably end up royally screwing you over in the long run. Link to comment Share on other sites More sharing options...
Wolfbane101 Posted December 23, 2011 Author Report Share Posted December 23, 2011 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 eeewwwwEDIT: These is using speed and direction but I also need it to work for hspeed and vspeed. Link to comment Share on other sites More sharing options...
DimensionWarped Posted December 24, 2011 Report Share Posted December 24, 2011 Particle emitters are objects. You can create extras and turn them on as needed between the position you are in from one frame to the next. Link to comment Share on other sites More sharing options...
VectorSatyr Posted December 25, 2011 Report Share Posted December 25, 2011 Do as DW said earlier. Take the pixels-per-step traveled (Speed) and generate a particle at every x pixels in-between the last and current position, where x is however much you want the spheres to be spaced out. Use lengthdir_x and lengthdir_y to get the positioning correct. Link to comment Share on other sites More sharing options...
jakeroo123 Posted December 26, 2011 Report Share Posted December 26, 2011 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=0repeat(_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. 1 Link to comment Share on other sites More sharing options...
DimensionWarped Posted December 26, 2011 Report Share Posted December 26, 2011 Oh, that's pretty cool! I wasn't familiar with that function. Have some rep. Link to comment Share on other sites More sharing options...
BlazefireLP Posted December 26, 2011 Report Share Posted December 26, 2011 I didn't know the rep system was active again... Link to comment Share on other sites More sharing options...
jakeroo123 Posted December 26, 2011 Report Share Posted December 26, 2011 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=0repeat(_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 More sharing options...
BlazefireLP Posted December 26, 2011 Report Share Posted December 26, 2011 Is that GameMaker code or just any general methodical language that can be adapted to any gamemaker? Link to comment Share on other sites More sharing options...
jakeroo123 Posted December 26, 2011 Report Share Posted December 26, 2011 Is that GameMaker code or just any general methodical language that can be adapted to any gamemaker? It's Game Maker Language. Link to comment Share on other sites More sharing options...
DimensionWarped Posted December 27, 2011 Report Share Posted December 27, 2011 I didn't know the rep system was active again... It's not. Right now admins are the only ones who can use it since we can manually add rep notes with any score. Link to comment Share on other sites More sharing options...
BlazefireLP Posted December 28, 2011 Report Share Posted December 28, 2011 Ah, I see. I guess you guys are still figuring out a way to make it more efficient? I think I remember one of you guys telling me one of you was thinking of a way to improve the way giving rep actually works. Link to comment Share on other sites More sharing options...
DimensionWarped Posted December 28, 2011 Report Share Posted December 28, 2011 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 More sharing options...
Recommended Posts