Persistent player char not appering after room transition

Discussion in 'Programming' started by Hans66, Aug 14, 2019.

Tags:
  1. Hans66

    Hans66 Member

    Joined:
    Aug 14, 2019
    Posts:
    2
    I have a problem im trying to create a top down 2d rpg and am trying to create a room transition. I have set the player to persistent. I am fairly new to gamemaker language have done some programming in C in my CS class. my room transition code looks like underneath. I have tried to put the room transition object higher and lower in my object tree and that seems to make it so the char is still invisible but can transition back to the original room but is then not visible. All my char sprites are in a group that have look up down left right sprites etc. All my input and game and player object is persistent my input object is initilized in my game object. with instance_create_layer(x,y,"Instances_room1",input); any help would be much obliged thanks in advance here is my room transition code in my player object:

    case "DOWN":
    {
    facing = 2;
    image_speed = anim_speed-1;

    spr_walk = spr_player_down;
    spr_attack = spr_player_attack_down;
    sprite_index = spr_walk;
    vx = 0;
    vy = player_speed;
    image_xscale = 1;
    check_input_all();
    break;

    }
    }
    check_collision_all(vx,vy,obj_solid);
    var inst = instance_place(x,y,obj_room_transition);
    if (inst != noone)
    {
    room_goto(inst.targetroom);
    }
     
  2. Hans66

    Hans66 Member

    Joined:
    Aug 14, 2019
    Posts:
    2
    I got it i had not named the two layers in different rooms the same name. for the instance of the player to appear in 2 rooms the layers need to be the same name in all rooms created with instance create. Begginers mistake
     

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