• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Effect object spawning at not right place

N

Nexusrex

Guest
Hello, i've been working on a little platformer. And i've been creating some type of effect by an object that spawns when landing on the wall. But, i did find that the object is created when the player is in collision with any walls..I did like to let the object creates at the landing.

Here is the code i'm using:
Code:
move_contact_solid(direction,12);
on_ground = true;
vspeed=0;
instance_create(x,y,obj_dust);
And thanks in advance.
 
J

Jordan Robinson

Guest
Make sure that the depth of obj_dust is set to a lower number than your player to ensure the effect will be drawn on top of him.

Also, if your player's origin is centered, then instead of creating obj_dust at the player's x and y position, you should change the y position to be y + sprite_height * 0.5 to ensure it is created at his feet.
 
N

Nexusrex

Guest
@Jordan Robinson The problem that if i hit the walls in the roof, it creates the object.
I will try @TheBroman90 way.

Edit: Now, it takes much time like sticking to the wall then falling.
Here is what i've done:
Code:
move_contact_solid(direction,12);
on_ground = true;
if vspeed > 0
{
vspeed = 0;
instance_create(x,y,obj_dust);
}
 
Top