• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Visual I have elevator objects... but I can get stuck

H

homeyworkey

Guest
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!
 
D

Dracodino300

Guest
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.)
 
H

homeyworkey

Guest
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.)
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?
 
D

Dracodino300

Guest
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?
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.
 
H

homeyworkey

Guest
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.
 
D

Dracodino300

Guest
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.
You'd use a "Test Expression" action, and check for elevator.speed == 0
 
D

Dracodino300

Guest
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?
You want a double equals sign in that if expression (" == "). "=" is for setting a value, "==" is for checking a value.
 
H

homeyworkey

Guest
I did that too, and it didn't work (Same exact code, but == instead of =)
 
D

Dracodino300

Guest
Have you set it so that the player does also not move in this case?
 
H

homeyworkey

Guest
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.
 

Attachments

D

Dracodino300

Guest
Just to make sure, are you also checking the same requirements for the elevator to move?
 
Top