Drag And Drop I have elevator objects... but I can get stuck

Discussion in 'Programming' started by homeyworkey, Jul 11, 2018.

  1. homeyworkey

    homeyworkey Member

    Joined:
    Jun 27, 2018
    Posts:
    42
    Hi, so keep in mind before I go through this problem that I'm very amateur and the fix you're going to give me I probably won't understand unless you explain it to me in depth. Keep it in D&D please and not code, because we've been learnt this in class and next semester is when we're going to start making a website- I don't want to convert work or learn a lot whenI won't be using GM2 for the rest of the year (Unless in spare time). Okay here's the problem:

    I have two elevators, one that goes straight up, and one that goes straight down. This only happens when the character collides with it. These elevators fall through all objects, but if my character is inbetween the ground and the elevator, then it would get stuck in place and you won't be able to move (the elevator is stuck too). Not sure about going on fixing this without ruining it in the first place.

    The code I have already is pretty barebones, basically if character has hit elevator the elevator goes up/down in vertical -3/3 speed and the character goes this same speed up/down if colliding

    Thanks!
     
  2. Dracodino300

    Dracodino300 Member

    Joined:
    Sep 14, 2016
    Posts:
    76
    I think the most straightforward fix would be to make it so that, if the player is touching the ground and the elevator, the elevator still doesn't move. It only moves if you are touching the elevator and NOT the ground.

    (Also, in case you want a more complex solution, you can mix-and-max the D&D system with code, if you only want code for this part.)
     
  3. homeyworkey

    homeyworkey Member

    Joined:
    Jun 27, 2018
    Posts:
    42
    That fix seems sufficient, and I'm not looking for something too complex so early on into learning this.. but you make me ask the question, how would I do that in D&D?
     
  4. Dracodino300

    Dracodino300 Member

    Joined:
    Sep 14, 2016
    Posts:
    76
    I'm a GM:S 1.4 user so it may be a little different than I would, but for me you'd do:
    1. Use the collision event for collision with elevator.
    2. Do a collision check for the ground.
    3. If no collision, perform the action as normal.
     
  5. homeyworkey

    homeyworkey Member

    Joined:
    Jun 27, 2018
    Posts:
    42
    Okay, so I've got that, but if collision is with platformer block AND elevator I only want it to load the last save point when elevator speed is 0... but I don't know how to check that. If I don't check if the speed is 0 then it would just load my last checkpoint if I'm simply holding onto the wall while going up/down.
     
  6. Dracodino300

    Dracodino300 Member

    Joined:
    Sep 14, 2016
    Posts:
    76
    You'd use a "Test Expression" action, and check for elevator.speed == 0
     
  7. homeyworkey

    homeyworkey Member

    Joined:
    Jun 27, 2018
    Posts:
    42
    So, I tried this and it didn't work.
    Posted an image of my code, and this was in the collision event with Elevatordown_object. What do I do to fix it?
     

    Attached Files:

  8. Dracodino300

    Dracodino300 Member

    Joined:
    Sep 14, 2016
    Posts:
    76
    You want a double equals sign in that if expression (" == "). "=" is for setting a value, "==" is for checking a value.
     
  9. homeyworkey

    homeyworkey Member

    Joined:
    Jun 27, 2018
    Posts:
    42
    I did that too, and it didn't work (Same exact code, but == instead of =)
     
  10. homeyworkey

    homeyworkey Member

    Joined:
    Jun 27, 2018
    Posts:
    42
  11. homeyworkey

    homeyworkey Member

    Joined:
    Jun 27, 2018
    Posts:
    42
  12. Dracodino300

    Dracodino300 Member

    Joined:
    Sep 14, 2016
    Posts:
    76
    Was on holiday :p what wasn't working about it?
     
  13. homeyworkey

    homeyworkey Member

    Joined:
    Jun 27, 2018
    Posts:
    42
    Nothing, you just got stuck like before. :/
     
  14. Dracodino300

    Dracodino300 Member

    Joined:
    Sep 14, 2016
    Posts:
    76
    Have you set it so that the player does also not move in this case?
     
  15. homeyworkey

    homeyworkey Member

    Joined:
    Jun 27, 2018
    Posts:
    42
    So what, this? (Attached image of updated code) Thought I'd also remind you this is in the character_object and this code occurs only when it's colliding with Elevatordown_object

    This code still doesn't work, and the player is stuck indefinitely between the block and the elevator.
     

    Attached Files:

  16. Dracodino300

    Dracodino300 Member

    Joined:
    Sep 14, 2016
    Posts:
    76
    Just to make sure, are you also checking the same requirements for the elevator to move?
     

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