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

Pages: 1 [2]   Go Down

Author Topic: Link Ice-Based Movement  (Read 7509 times)

0 Members and 1 Guest are viewing this topic.
Re: Link Ice-Based Movement
« Reply #20 on: August 04, 2009, 01:06:46 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3374
Wow guys, I'd never tried this before. Looks pretty neat, only problem I see is that corner cutting isn't sensible enough. It should be like if you barely touch the corner it sends you in that direction. Makes getting around much easier.

Other than that, good job. :)

Edit: BTW, this is what I mean:


See, it's not sensible enough!
Don't trick me like that, I thought that was actually a window I could drag for a sec :P
Logged
Quote from: Jason
Your community is a bunch of stuck up turds.
Re: Link Ice-Based Movement
« Reply #21 on: August 04, 2009, 01:50:15 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Okay, I have checked out how the falling in pits works in MC.

1) In a dungeon Link gets set back to the entrance from which he entered the room.
2) In the overworld and in caves Link gets set back to the tile he had last touch the ground. For example:
   * When walking/running in he is set to the tile adjacent to the pit that Link came from.
   * When getting shot by a mushroom Link is set back to the tile from where he grabbed the mushroom.
   * When jumping with the roc's cape he is set back to the tile from where Link jumped up into the air.
3) In the overworld/caves when Link falls from the ice, he gets set back to the last tile where Link had normal ground under his feet. In other where he entered the ice. If Link jumps over normal tiles to other ice tiles those normal tiles don't count. Link actually had to touch the ground.
4) The holes don not suck Link in. He actually has to move into the hole on his own.

Now that I know this I can make it a lot better and easier. I just need to save the last normal tile Link was on and put him back there, and add a check for in the dungeon. I'll be making that later.
Logged
Re: Link Ice-Based Movement
« Reply #22 on: August 04, 2009, 02:06:17 pm »
  • Fight the Power
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1245
Quote
Don't trick me like that, I thought that was actually a window I could drag for a sec
Haha I spent a little bit of time trying to 'close' the window, it kept redirecting me to imageshack.us :P *facepalm*

Quote
Now that I know this I can make it a lot better and easier. I just need to save the last normal tile Link was on and put him back there, and add a check for in the dungeon. I'll be making that later.
How can you possibly check if it's a 'normal' tile or not? I would have just made an object that Link teleports to if he falls.
Logged

Currently Listening to: Mos Def - Summertime
Re: Link Ice-Based Movement
« Reply #23 on: August 04, 2009, 04:15:05 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Quote
Now that I know this I can make it a lot better and easier. I just need to save the last normal tile Link was on and put him back there, and add a check for in the dungeon. I'll be making that later.
How can you possibly check if it's a 'normal' tile or not? I would have just made an object that Link teleports to if he falls.

Actually, it is pretty simple. The special tiles like ice (and later maybe water) have a special effect. So you need something to detect it. In gamemaker it is easy to detect collisions with other objects. If the tile is normal ground than there won't be any object. This is the code I used in the step event:

Code: [Select]
/*************************************************************************************/
//TODO make it more efficient
//check whether Link is falling in a pit, because it overrides
//all other actions
if(falling){
    //check if falling is done. If not add 1 to the action timer
    // else set Link back to the edge he came from.
    if(action_timer == 12){
        action_timer = 0;
        falling = false;
        //move to the edge Link had fallen from.
        move_to_ledge(x,y, grid_x,grid_y,self);
        prev_x = x;
        prev_y = y;
    }else{
        action_timer += 1;
    }
}else{
/*************************************************************************************/
and...
Code: [Select]
/*************************************************************************************/
//check if nothing is at the current position and thus standing on normal ground.
if(place_empty(x,y) && !inDungeon){
    //TODO This can be more efficient.
    grid_x = floor(x/TILESIZE);
    grid_y = floor(y/TILESIZE);
}

//check if the new x and y are colliding with an special object like a Pit
if(position_meeting(x,y,objPit)){
    //TODO make it more efficient.
    //check if Link should fall. Then set all settings to it.
    moving = false;
    falling = true;   
    move_x = 0;
    move_y = 0;
    action_timer = 0;
    inst_id = instance_position(x,y,objPit);
    x = inst_id.x+0.5*TILESIZE;
    y = inst_id.y+0.5*TILESIZE;
}
/*************************************************************************************/

The latest version of my code is attached. The only problem I still can't solve is that it looks as if Link sometimes falls twice.
Logged
Re: Link Ice-Based Movement
« Reply #24 on: August 04, 2009, 04:44:38 pm »
  • Fight the Power
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1245
Yeah, I had forgot ice wasn't just a tile, it's an object. xD

*downloads*
Wow that actually works really well. I didn't know we had another good coder in da house! :D Just another guy to bug when I'm stuck, haha! :D Nah dw, I rarely do that. :]

My only complaint now is that the camera view shouldn't abruptly hop to the new position. I don't know if it's like this in MC, but I think it would look better regardless. Make the camera slowly slide to the player.

Also, you should make a counter to count how many frames 'go by' when link falls. Then, after he reaches the last frame, make him reappear.
Logged

Currently Listening to: Mos Def - Summertime

Jeod

Team Dekunutz, Doubleteam
Re: Link Ice-Based Movement
« Reply #25 on: August 04, 2009, 04:52:01 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1675
I'm not sure how it's handled in Game Maker, but I would have made an invisible object to act like an alternate shadow for Link. It'd have different collisions, so it'd stop on the "normal" tile when Link moves onto the ice. If Link falls, set his position to the alt shadow. If he gets to another normal tile, set the alt shadow's position to Link. Rinse, lather, repeat.

Of course that's how I'd do it in MMF2. I'm unsure if GM has a different/easier way of handling the job.
Logged
"You should challenge your fates. When all else fails, you can still die fighting." ~Yune
___________________________________

Zelda GBC+ Engine for Multimedia Fusion 2
  • Doubleteam Project Page
Re: Link Ice-Based Movement
« Reply #26 on: August 04, 2009, 05:08:33 pm »
  • Fight the Power
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1245
You mean like making the alternate mask collide with the ice and not follow Link around? Yeah, that's also a practical solution, good thinking. The downside is that you have to create a new object, though.
Logged

Currently Listening to: Mos Def - Summertime
Re: Link Ice-Based Movement
« Reply #27 on: August 04, 2009, 05:25:43 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Yeah, I had forgot ice wasn't just a tile, it's an object. xD

*downloads*
Wow that actually works really well. I didn't know we had another good coder in da house! :D Just another guy to bug when I'm stuck, haha! :D Nah dw, I rarely do that. :]

My only complaint now is that the camera view shouldn't abruptly hop to the new position. I don't know if it's like this in MC, but I think it would look better regardless. Make the camera slowly slide to the player.

*Just got my Minish Cap GBA cartridge back.
Just checked it and you are correct. The camera slides to the return position very quick. On short distances it almost seems instantly, but on longer distances you notice the slide.

Also, you should make a counter to count how many frames 'go by' when link falls. Then, after he reaches the last frame, make him reappear.
That is done by the step counter. The falling animation contains 6 frames displayed at and imagespeed of 0.5, so after 12 frames the falling should stop. But 4Sword wanted to place that part in the draw event.

I'm not sure how it's handled in Game Maker, but I would have made an invisible object to act like an alternate shadow for Link. It'd have different collisions, so it'd stop on the "normal" tile when Link moves onto the ice. If Link falls, set his position to the alt shadow. If he gets to another normal tile, set the alt shadow's position to Link. Rinse, lather, repeat.

Of course that's how I'd do it in MMF2. I'm unsure if GM has a different/easier way of handling the job.

Like Darunia said: 'you have to create a new object'. The memory used for one object is far more than just 2 variables. Especially in GM, where an object has standard variables for position, direction, speed, health and of course its bounding box. In the way of code an object is probably also worse, because you need to define it's collision event. Keep it aligned with link or separate. Gamemaker object manager has to manage this object also. In Link you still need to check if you are on normal ground or not and update the x and y position of the shadow (or vice versa). So keeping 2 variables to record the return position is more efficient then creating a new object.
Logged
Re: Link Ice-Based Movement
« Reply #28 on: August 04, 2009, 05:45:02 pm »
  • *
  • Reputation: +8/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6604
About the camera sliding, there was a code that someone did but I cannot recall who did it; it was probably mit because his code is awesome like that. The code for the view thing looks like like:

Code: [Select]
view_xview[0] = (view_xview[0] * 4 + (x - 120)) / 5;
view_yview[0] = (view_yview[0] * 4 + (y - 80)) / 5;

The code for the view that I had in there was mainly just added as a means to check sliding distance relative to things in a fixed position.

About the corner-cutting, it could be altered probably so that it has the ability to be more sensitive, but meh. The way it works differently from past corner-cutting is it checks to see if it is inside an object's bounding box at its previous position. If it is in that bounding box, then it checks to do the corner-cutting because otherwise all Link is running into is a flat wall. Adding more corner-cutting sensitivity in wouldn't be too difficult.

Creating a new object as an alternate shadow for Link, not sure what you mean by that, but the mask that Link uses works well enough, I'd think.

Also, about getting onto ice, falling in a pit, and returning to previous solid ground or start position, the way in which enters the ice (and how it also checks to see whether or not he had previously been on the ice) allows to have an "entry point" which can easily be determined. It might not need new variables either, just assigning new values to xstart and ystart.
Logged
Re: Link Ice-Based Movement
« Reply #29 on: August 04, 2009, 05:51:38 pm »
  • Fight the Power
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1245
Quote
Creating a new object as an alternate shadow for Link, not sure what you mean by that, but the mask that Link uses works well enough, I'd think.
What Jeod meant by that was making two shadows: the one you already made which follows Link absolutely everywhere he goes, all the time, and an alternate one which wouldn't be able to enter ice zones, or water, for example. It would stop moving once you collided into these zones and if Link was to fall into a hole, he would be teleported to the alternate mask. If he gets to a new normal tile, though, the alternate mask would teleport to him.
Logged

Currently Listening to: Mos Def - Summertime
Re: Link Ice-Based Movement
« Reply #30 on: August 04, 2009, 06:10:10 pm »
  • *
  • Reputation: +8/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6604
I just must have been confused over the fact that it was described as a mask; something more used for active collision testing. Makes more sense as a position; would probably work best with the xstart/ystart variable assignment I talked about in my last post.
Logged
Re: Link Ice-Based Movement
« Reply #31 on: August 04, 2009, 06:19:12 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Okay, I change grid_x to xstart and grid_y to ystart. But I still don't use the x and y position of Link, but the x and y on the grid of the tile.

Second, moved the first piece of code to the draw event.

Third added the camera shift code provided by 4Sword.

new file attached.
Logged
Re: Link Ice-Based Movement
« Reply #32 on: August 04, 2009, 06:32:06 pm »
  • *
  • Reputation: +8/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6604
Using the grid position rather than the direct x/y probably makes more sense to do because otherwise Link would rematerialize right up next and close to the ice. The way Link falls and returns though seems to be pretty good so far. Nice job.

About what is in the draw event, I might tweak it a bit, not too sure as it does a lot of the code well, but mainly the edits would anticipate future changes to the code. And yeah, I'm working on the sensitivity stuff too.

Also, it might be helpful, if we come up with a better way to introduce updates to the code as redownloading GMK files takes up space.
Logged

Jeod

Team Dekunutz, Doubleteam
Re: Link Ice-Based Movement
« Reply #33 on: August 04, 2009, 06:38:25 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1675
Someone needs to invent a way to make patch exe files...
Logged
"You should challenge your fates. When all else fails, you can still die fighting." ~Yune
___________________________________

Zelda GBC+ Engine for Multimedia Fusion 2
  • Doubleteam Project Page
Re: Link Ice-Based Movement
« Reply #34 on: August 04, 2009, 07:06:43 pm »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Using the grid position rather than the direct x/y probably makes more sense to do because otherwise Link would rematerialize right up next and close to the ice. The way Link falls and returns though seems to be pretty good so far. Nice job.
thnx.

About what is in the draw event, I might tweak it a bit, not too sure as it does a lot of the code well, but mainly the edits would anticipate future changes to the code. And yeah, I'm working on the sensitivity stuff too.
Okay. I do have an idea about increasing efficiency. I would recommend using a FSM with the Link object. Like I said in one of my earlier posts; We should merge the booleans for moving and falling into one variable, because the one cannot be true if the other is true. Using another FSM for the use of items might be required if we don't want to make the first FSM to complex.

Also, it might be helpful, if we come up with a better way to introduce updates to the code as redownloading GMK files takes up space.
Agreed, but I don't think GMK's work very well with SVN. Well one advantage is that normal movement, ice movement and falling in pits are the components that influence Link's other movements. All the other movements are/might be activated by items, but they don't really influence each other (well maybe the use of the sword).
Logged
Re: Link Ice-Based Movement
« Reply #35 on: August 18, 2009, 11:40:03 am »
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3725
Argh, I've been a complete idiot with setting the coordinates for pitfalling.

I had made the code following code:
Code: [Select]
inst_id = instance_position(x,y,objPit);
x = inst_id.x+0.5*TILESIZE;
y = inst_id.y+0.5*TILESIZE;


It is better to make it like this:
Code: [Select]
x = (floor(x/TILESIZE)+0.5)*TILESIZE;
y = (floor(y/TILESIZE)+0.5)*TILESIZE;

What an idiot mistake.
Logged
Pages: 1 [2]   Go Up

 


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



Page created in 0.064 seconds with 70 queries.

anything