Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [Request] How to make Link fall down a hole.  (Read 3843 times)

0 Members and 1 Guest are viewing this topic.
[Request] How to make Link fall down a hole.
« on: November 03, 2010, 09:25:56 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 276
Help?
« Last Edit: November 04, 2010, 10:21:25 pm by The Boy »
Logged
I'll add one of these later.

Xiphirx

wat
Re: [Request] How to make Link fall down a hole.
« Reply #1 on: November 03, 2010, 09:27:59 pm »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
Help?


Honestly, it's just a simple collision check.
Logged
  • For The Swarm
Re: [Request] How to make Link fall down a hole.
« Reply #2 on: November 03, 2010, 09:29:12 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 276
Help?


Honestly, it's just a simple collision check.
Yeah, but i can't seem to get it.....
Logged
I'll add one of these later.
Re: [Request] How to make Link fall down a hole.
« Reply #3 on: November 03, 2010, 09:41:07 pm »
  • *
  • Reputation: +8/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6604
It's easy to do if you break it down into what the code should logically do. I had a version of this done with the GM Minish Cap Engine which was nice although I am not sure if Niek ever integrated it into his code; it was a simple fix to previous hole code in that the shadow would continue to draw under Link and whatnot when he was waiting for the view to shift back to him. Otherwise falling into a hole is just making it so upon a position_meeting(x,y,objHole) that Link is unable to move and is over the nearest grid-space over the hole. Once the animation for falling is done, Link moves back to his last viable position and is able to move again once the view returns to being as centered as it can be around him.
Logged
Re: [Request] How to make Link fall down a hole.
« Reply #4 on: November 04, 2010, 04:27:10 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 276
It's easy to do if you break it down into what the code should logically do. I had a version of this done with the GM Minish Cap Engine which was nice although I am not sure if Niek ever integrated it into his code; it was a simple fix to previous hole code in that the shadow would continue to draw under Link and whatnot when he was waiting for the view to shift back to him. Otherwise falling into a hole is just making it so upon a position_meeting(x,y,objHole) that Link is unable to move and is over the nearest grid-space over the hole. Once the animation for falling is done, Link moves back to his last viable position and is able to move again once the view returns to being as centered as it can be around him.
Cheers, but how DO you move it back to it's last liable position? just make a new variable or move it 16 sprites one way?? :huh:
Logged
I'll add one of these later.
Re: [Request] How to make Link fall down a hole.
« Reply #5 on: November 04, 2010, 05:11:49 pm »
  • *
  • Reputation: +8/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6604
I had it previously to where I would have a hole check before any movement was done, and also it relied on doing a position_meeting check for that each step to keep track of your last viable position. Hypothetically it might be better to do the check only in the movement, as that way you wouldn't need to keep track of your last viable position; e.g., if you were going left/right into a hole, if you ran into a hole it would know that if you are not in the hole state your last position must have been viable - Link's position then is just his x minus the pixels he moved, and then the x,y coordinate that forms needs to be modulused to the center of the viable grid-space, the view then transitioning back to being as over Link as it can, and then having control return to Link.
Logged
Re: [Request] How to make Link fall down a hole.
« Reply #6 on: November 04, 2010, 07:58:39 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
It's easy to do if you break it down into what the code should logically do. I had a version of this done with the GM Minish Cap Engine which was nice although I am not sure if Niek ever integrated it into his code; it was a simple fix to previous hole code in that the shadow would continue to draw under Link and whatnot when he was waiting for the view to shift back to him. Otherwise falling into a hole is just making it so upon a position_meeting(x,y,objHole) that Link is unable to move and is over the nearest grid-space over the hole. Once the animation for falling is done, Link moves back to his last viable position and is able to move again once the view returns to being as centered as it can be around him.

You can check this topic if it is in there as it already utilizes a lot of the latest additions to the engine. If it is not in there I must have missed it. But what I have figured out is that MC stores the last position that Link is not meeting any surface object. This includes holes, water, grass, puddles and triggers. In addition Link has to be in a state that he is touching the ground. Currently I use a boolean value levitate but I am planning on changing it to a numerical value height which can be used to set Link's y-displacement, check if he is high enough to jump over certain objects like characters and to use in attacks.

But okay, the previous position is stored, based on not meeting a surface object and being on the ground. Okay to prevent a large number of position_meeting calls for various surface objects, like holes and water, I do one check for a parSurface that all the surface objects inherit from at the beginning of a draw event and store it in a member variable. I do it there, because in the step event Link can have changed his position and the draw event can immediatly react to it by drawing the correct shadow/water ripple/grass/nothing underneath Link. Then at the beginning of the next step event the stored surface object has its object_index checked if Link is on the ground. And if it is equal to objHole then the script LinkPit is executed, which initiates Link falling in a hole if he is not on a platform as well.
Logged
Re: [Request] How to make Link fall down a hole.
« Reply #7 on: November 04, 2010, 08:03:49 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 276
I had it previously to where I would have a hole check before any movement was done, and also it relied on doing a position_meeting check for that each step to keep track of your last viable position. Hypothetically it might be better to do the check only in the movement, as that way you wouldn't need to keep track of your last viable position; e.g., if you were going left/right into a hole, if you ran into a hole it would know that if you are not in the hole state your last position must have been viable - Link's position then is just his x minus the pixels he moved, and then the x,y coordinate that forms needs to be modulused to the center of the viable grid-space, the view then transitioning back to being as over Link as it can, and then having control return to Link.
Cool. Thanks!
Logged
I'll add one of these later.
Re: [Request] How to make Link fall down a hole.
« Reply #8 on: November 04, 2010, 08:33:38 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
I had it previously to where I would have a hole check before any movement was done, and also it relied on doing a position_meeting check for that each step to keep track of your last viable position. Hypothetically it might be better to do the check only in the movement, as that way you wouldn't need to keep track of your last viable position; e.g., if you were going left/right into a hole, if you ran into a hole it would know that if you are not in the hole state your last position must have been viable - Link's position then is just his x minus the pixels he moved, and then the x,y coordinate that forms needs to be modulused to the center of the viable grid-space, the view then transitioning back to being as over Link as it can, and then having control return to Link.
Cool. Thanks!
Be careful, because with a variation that has a delayed effect, like the Swamp in MC and desert sink holes in GB. Just reverting the last x/y move will put you back in the sink hole/swamp. Or am I missing something.
« Last Edit: November 04, 2010, 08:47:17 pm by Niek »
Logged
Re: [Request] How to make Link fall down a hole.
« Reply #9 on: November 04, 2010, 09:35:10 pm »
  • 虫めづる姫君
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2990
I wish I could have made the first response in this thread so I could say, "push him."
Logged
Re: [Request] How to make Link fall down a hole.
« Reply #10 on: November 04, 2010, 10:26:21 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 276
I wish I could have made the first response in this thread so I could say, "push him."
XD thanks, I'll translate that into gmk format now
 "if pushable{
Instance_create(o_http://www.zfgc.com/forum/index.php?action=profile;u=1728)
Execute_file(pushhim!)
}

Logged
I'll add one of these later.
Re: [Request] How to make Link fall down a hole.
« Reply #11 on: November 05, 2010, 01:31:29 am »
  • *
  • Reputation: +8/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6604
I had it previously to where I would have a hole check before any movement was done, and also it relied on doing a position_meeting check for that each step to keep track of your last viable position. Hypothetically it might be better to do the check only in the movement, as that way you wouldn't need to keep track of your last viable position; e.g., if you were going left/right into a hole, if you ran into a hole it would know that if you are not in the hole state your last position must have been viable - Link's position then is just his x minus the pixels he moved, and then the x,y coordinate that forms needs to be modulused to the center of the viable grid-space, the view then transitioning back to being as over Link as it can, and then having control return to Link.
Cool. Thanks!
Be careful, because with a variation that has a delayed effect, like the Swamp in MC and desert sink holes in GB. Just reverting the last x/y move will put you back in the sink hole/swamp. Or am I missing something.
Ah, I forgot all about the swamps and probably ice too. You're right about that then, the code I described above could then be modified giving Link a prev_x and prev_y variable which would be initially when Link walks onto either the swamp or ice when he was currently on neither. The hole then would just revert him back to that prev_x, prev_y. It'd probably be better to test it out with code though, lol, I am just busting out mad theories; really busy with school stuff right now though.
Logged

King Tetiro

Leader of Phoenix Heart
Re: [Request] How to make Link fall down a hole.
« Reply #12 on: November 05, 2010, 10:21:44 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
Yeh guys I'm stuck on this now. I've got it to declare previous x and y before any movement.

However once the falling animation ends, Link goes back to lx,ly but still falls. I know why. Because the previous x and y is too close to the pit. How do I prevent this?
Logged
  • Phoenix Heart

Subterfuge

Hero of Effin' Time
Re: [Request] How to make Link fall down a hole.
« Reply #13 on: November 05, 2010, 10:36:07 pm »
  • Hero of Effin' Time
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 37
Personally, I'm just using the code from MC Engine since it not only keeps your last x,y, but it also has code to make sure that the last x,y was on solid ground instead of on ice or jumping off of a cliff. Now I'm trying to modify it get the effect where once you touch the hole, you get slowly pulled toward the center of the tile before you fall like the holes from the Oracle games among other things.
Logged
That which binds us...

Sets us free...

King Tetiro

Leader of Phoenix Heart
Re: [Request] How to make Link fall down a hole.
« Reply #14 on: November 05, 2010, 10:42:57 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
Lol this is embarrassing but I fixed it. I had made a masking error
Logged
  • Phoenix Heart
Re: [Request] How to make Link fall down a hole.
« Reply #15 on: November 05, 2010, 11:39:58 pm »
  • The king of Awesome
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 198
Help?


Honestly, it's just a simple collision check.
Yeah, but i can't seem to get it.....

Have you tried using place_meeting? Or using GMs collision event instead of using GML?  It's really easy.
Haha, I need to read the whole topics page.

Anyway, 4sword was correct. just use linkx_old = xprevious; and linky_old = yprevious; and when the animation finishes just set obj_link.x = linkx_old; obj_link.y = linky_old;  and than just display a flashing link for 5 frames.
« Last Edit: November 05, 2010, 11:46:42 pm by Shiku »
Logged
Re: [Request] How to make Link fall down a hole.
« Reply #16 on: November 06, 2010, 06:02:57 am »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Have you tried using place_meeting? Or using GMs collision event instead of using GML?  It's really easy.
Haha, I need to read the whole topics page.

Anyway, 4sword was correct. just use linkx_old = xprevious; and linky_old = yprevious; and when the animation finishes just set obj_link.x = linkx_old; obj_link.y = linky_old;  and than just display a flashing link for 5 frames.
You forget to mention that it also requires a check for a valid position.
Logged
Re: [Request] How to make Link fall down a hole.
« Reply #17 on: November 06, 2010, 11:20:43 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 276
Help?


Honestly, it's just a simple collision check.
Yeah, but i can't seem to get it.....

Have you tried using place_meeting? Or using GMs collision event instead of using GML?  It's really easy.
Haha, I need to read the whole topics page.

Anyway, 4sword was correct. just use linkx_old = xprevious; and linky_old = yprevious; and when the animation finishes just set obj_link.x = linkx_old; obj_link.y = linky_old;  and than just display a flashing link for 5 frames.
Thanks!
But as Niek said, it does need to check a valid position- what if he's on a sinkhole? he'd just fall down again..
Logged
I'll add one of these later.

Mamoruanime

@Mamoruanime
Re: [Request] How to make Link fall down a hole.
« Reply #18 on: November 06, 2010, 12:10:52 pm »
  • ^Not actually me.
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 9786
... Just do exactly as you said. "Check a valid position".
Logged
Re: [Request] How to make Link fall down a hole.
« Reply #19 on: November 06, 2010, 05:15:43 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 276
... Just do exactly as you said. "Check a valid position".
OH! Thanks
Logged
I'll add one of these later.
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.067 seconds with 74 queries.

anything