1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

GM:S 1.4 room restart if player between wall and vertical platform

Discussion in 'Programming' started by SonicTheHedgehog+123, Feb 12, 2020.

  1. SonicTheHedgehog+123

    SonicTheHedgehog+123 Member

    Joined:
    Feb 9, 2020
    Posts:
    29
    Hello everyone
    I dont know wich code could be the function that I want.
    My task is to make the player restart if he is between the wall and the y-axis of the vertcal platform.
    Here is a picture:
    Screenshot (7).png

    This is a problem that I didnt find a solution on youtube or somewhere else.
    It would be nice if someone could help me.:p
     
    Last edited: Feb 12, 2020
  2. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    7,144
    Just have the vertical object check and see if the player is underneath, and if it is, then check if the player is on the ground or not, and if that's true then restart. Check the collision function but place_meeting() will probably do what you want.
     
  3. SonicTheHedgehog+123

    SonicTheHedgehog+123 Member

    Joined:
    Feb 9, 2020
    Posts:
    29
    Thanks for repliying.
    But how do I put this in code. The only thing I could figure out so far is this code:

    Object Vertical Platform

    Collision Event with object player

    if place_meeting(x,Fledermaus_Bild.y,Fledermaus_Bild)
    {
    room_goto(Restart)
    }
     
  4. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    4,214
    Do two place_meetings at once, one above and one below, and just && them together.
     
  5. SonicTheHedgehog+123

    SonicTheHedgehog+123 Member

    Joined:
    Feb 9, 2020
    Posts:
    29
    something like that:

    if place_meeting(x,y,obj.player) && place_meeting(x,y,obj.wall)
    {
    room_goto(Restart)
    }

    but how should i define if the player is above or below the wall or the plattform?
     
  6. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    4,214
    The x and y variables represents position.
     
  7. SonicTheHedgehog+123

    SonicTheHedgehog+123 Member

    Joined:
    Feb 9, 2020
    Posts:
    29
    But how can I find out the position(that is when the player is meeting with the platform)?

    srry for that many questions:oops:
     
  8. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    4,214
    How about position_meeting?
     
  9. SonicTheHedgehog+123

    SonicTheHedgehog+123 Member

    Joined:
    Feb 9, 2020
    Posts:
    29
    It didint work maybe because my platform is solid.
    However now I must sleep.:bunny:
     

Share This Page