1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

GML I have a problem, and I am beginner

Discussion in 'Programming' started by Sicicle, Jan 29, 2019.

  1. Sicicle

    Sicicle Member

    Joined:
    Jan 29, 2019
    Posts:
    4
    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
     
  2. Relic

    Relic Member

    Joined:
    Jun 27, 2017
    Posts:
    744
    Can you please supply the code you think is causing the issue.
     
  3. Toque

    Toque Member

    Joined:
    May 25, 2017
    Posts:
    1,128
    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.
     
  4. Sicicle

    Sicicle Member

    Joined:
    Jan 29, 2019
    Posts:
    4
    no, its a simple game with cubes, the sprite is the same, copy and paste, its set to middle center
     
  5. Sicicle

    Sicicle Member

    Joined:
    Jan 29, 2019
    Posts:
    4
    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;
     
  6. Sicicle

    Sicicle Member

    Joined:
    Jan 29, 2019
    Posts:
    4
    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
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice