Need help triggering a function when the player moves past a y coordinate SOLVED

Started by BigHairyEyeball, Wed 02/08/2017 21:43:57

Previous topic - Next topic

BigHairyEyeball

Basically, I'm setting up a "trap" the player has to solve - the player needs to retrieve an item to progress in the game, but walking forward triggers a trap that kills him. I've got everything else worked out, but I can't seem to find the bit of code that tracks when the character walks past a certain point on the board. i.e., if the character walks past 122 on the y coordinate, an event starts. Is there a line of code that controls this?

Thanks in advance!

horusr

You can use room edges for that. Or put a hotspot and when player walks on it it triggers function. Or you can use repeadetly_execute and check player.Y and if it is bigger than that then trigger function

Cassiebsg

Or create a Region for the event. I would probably just check the players y coord, and then act accordingly. All depends what is easier for you.
There are those who believe that life here began out there...

BigHairyEyeball

How do you check the player's Y coordinate? Is there a specific line of code for it? I literally am teaching myself as I go, so some of the particulars are beyond me.

In addition, this may sound like a weird question, but has anyone had any problems with the LeaveRoom functions in rooms after using a hotspot to transition from one room to another? I've got this one area where you click on the middle of the screen to advance to the next room, but after that room, the LeaveRoom code isn't working for some reason.

Sorry to be such a pain about this. I literally spent the whole evening banging my head against the code and nothing seemed to work.

Kara Jo Kalinowski

charactername.y to get the y value. It's a property of that character

horusr

What Morgan saya.
Code: ags
if (player.Y > 122) 
{//code you have} 


Don't forget to put it in repeadetly_execute ()


BigHairyEyeball

... got it to work. Also, figured out that I've been forgetting to use the event handler on my screen whenever I create a changeroom function. Holy shnike.

Don't code tired, kids.

SMF spam blocked by CleanTalk