Moving in relation to certain conditions
GuaveMedia
Member, PRO Posts: 1,262
Hey guys,
I need your help please. In my game I have a magnet effect put in. So some collectable items can be magnetized and move then to the main character where they are collected. My items spawn some particles to show some effect for people too.
When there are many items and the effect is turned on, I sometimes get a short lag which really annoys me. It's not like that the game is unplayable but it would be cool if I could somehow fix it.
Item: constrain magnitude to characters position
When effect is on, interpolate self X and Y to playerX and playerY.
When overlaps spawn particles etc. Nuts physics moveable etc. is off!
Is there are better way to do an effect? I thought interpolate something is the best concerning performance.
Any advice would be awesome!
Thanks and cheers!
I need your help please. In my game I have a magnet effect put in. So some collectable items can be magnetized and move then to the main character where they are collected. My items spawn some particles to show some effect for people too.
When there are many items and the effect is turned on, I sometimes get a short lag which really annoys me. It's not like that the game is unplayable but it would be cool if I could somehow fix it.
Item: constrain magnitude to characters position
When effect is on, interpolate self X and Y to playerX and playerY.
When overlaps spawn particles etc. Nuts physics moveable etc. is off!
Is there are better way to do an effect? I thought interpolate something is the best concerning performance.
Any advice would be awesome!
Thanks and cheers!
Comments
Make a rule around the player movement rules that checks if the movement rules should be active or not.
However, there's no way to check for collision with the GS particle system that I'm aware of. You could try spawning an invisible object in the same area as the particles that will check for collision.
I know that the code is correct but I was just asking if there is a different way which could save some performance?
Particle effect: yep, there's sometimes a delay in GS when you start them. How to fix? *shrug* that's GS for ya. Maybe have them off screen and moved in when neede if it's a constant stream of particles?
Moving objects towards player:
I'd do it by checking a radius (assuming the magnetic effect has a limit) to x/y global attributes that are constrained to player location. Have the objects check those values instead of player location. You MIGHT get a speed/framerate increase as you no longer have multiple objects checking the player object and instead a set of global variables, but it's just a theory.
I also realized I totally misread part of your initial post re: physics stuff.
Concerning particles, should animate work better? Having an animation?
@PixelMetal thanks!
If you have more actors "magnetized" do they all spawn particles? Than is it possible to turn them of on some. So have only 1 or 2 spawning particles
To test you can click the particle behavior off and see if it is any better.
Lump Apps and My Assets
Guys just one more question, when having a big scene in height, can I somehow load the whole scene. Like I always have the feeling when I move to a new unshown part of the scene there is a short lag. Is there a way to really load all so things do not get laggy.
thx
Any help would be awesome
Perhaps it is something else?
Lump Apps and My Assets
Do you have preloading on?
Is there anything spawned when you are seeing new things?
Lump Apps and My Assets
Preloading is on or off/ tried it but didn't make a big difference
Nothing spawned, all is build before
Do they animate even when they are not in view? Or does the animation start when the get into view?
Lump Apps and My Assets
But thx for the help