Simple solution for platform acts like an elevator in GameLab

I am trying to create a platform that lowers from sprite.y = 100 to sprite.y =300, once it hits sprite.y= 300, it reverses direction and then returns back to sprite = 100

Best method. Trying to do in-game lab with code blocks given to students.

(Game Lab - Code.org)
What I expect to happen: [replace with a detailed description of the behavior you’re trying to create]

Coding an platform that floats down from sprite.y = 100 to sprite.y = 300, then reversus
]
What I’ve tried: Tried the For Loops, While Loops. I can get float one way or the other. Or have it travel to the bottom and then repeat. I have tried making a float-down function and then a float-up function but am having trouble getting it to complete the float down then reverse.

Hi @srogers1,

Nice looking game! I find that when I need something to go back and forth or up and down, you are really evaluating 2 criteria:

Which direction is it currently moving?
When does it reach the boundary and need to return?

So, I usually set up another variable. In this case it was var platReturn yes or no. The if statement then needs to ask 2 questions (using the && in the math blocks).
if (platform.y < 300 && platReturn == “no”). Here is my remixed solution. I hope I understood your question and helped you figure out how to solve it but if not, let us know.

~Michelle