GML I have a problem, and I am beginner

S

Sicicle

Guest
Hi! I want to make this little platforming game prototype, and I wrote that if object player kills an enemy the object wall will change sprites, the problem is that if I want to change back (by killing another enemy) to the original sprite, the other enemies start glitching through the object wall, glitching .. like vibrating
 

Toque

Member
Make sure both sprites have same size, collision box and both set to middle center.

Of course you can set to whatever you want but I’m guessing they are not set the same and the colllisions are wonky when they are changed.

Just a guess.
 
S

Sicicle

Guest
no, its a simple game with cubes, the sprite is the same, copy and paste, its set to middle center
 
S

Sicicle

Guest
Can you please supply the code you think is causing the issue.
this is the code to change the sprite: (Obj_enemy)

if place_meeting (x,y,obj_player)
{
if (obj_player.y < y-16)
{
with (obj_player) vsp = -7;
with (obj_wall) sprite_index = spr_wall_blue;
instance_destroy();
}

else
{
game_restart();
}

}


this is the code to reverse it: (it's different then what I said previously, I changed it to when the player touches the floor it changes sprites, but the same thing happened)
(obj_player)

if (place_meeting(x,y+1,obj_wall)) with(obj_wall) sprite_index = spr_wall;
 
S

Sicicle

Guest
never mind, I changed the collision box to a random sprite on all objects, and now it works, i really don't know what the problem was, but I am happy that I solved it
 
Top