![]() |
Movement Sliding
Hi,
well u all know that the classic movement "slides" around edges... whats the best way to put this into a scripted movement? Only thing i could think of is testing coordinates at a slightly offset place and if theres no wall move the char towards this place =/ Any better solutions? |
I was also wondering how this would be accomplished :x
|
To do it, theres a few certain rules to consider.
1) We only need to do the sliding when only one direction is being pressed. If the player is trying to walk on a diagonal, the sliding should not be done. (It's fairly easy to prove this). 2) We only need to do sliding if the player has not moved as a result of ther normal movement. 3) The wall detection doesn't care about walls directly to the side of the player, only those directly in front of, and those on the diagonals to the players base. Basically, you take the area in front of the player, and then shift it left or right (from the characters facing direction) up to 1 tiles worth, each direction relating to each sliding direction. If these tiles are clear, then the player can slide in that direction. The reason we need to look at the shifts 0 to 1 is because we dont know how much the player is clipping the wall, how large the gap they are sliding into is (we don't want to over measure and detect the wall on the other side). 4) It is worthwhile to note that because this is not looking at the tiles to the side of the player, this allows the player to move onto a wall to accomplish the sliding, which may sound odd, but is actually how the original movement behaves. 5) If you use a sliding speed greater than 1/16 (1 pixel) per timeout, then you need to check that the player is not overshooting the free area. For example, if you have a gap which is perfectly the width of the player, its likely that they will need to slide in order to line up with it. If the sliding speed is too fast, they will slide back and forth between the two sides, and never align with the gap. If you want any clarification on the things I've said, dont hesitate to ask! ^^ |
Quote:
thanks for the others =D |
1 Attachment(s)
Quote:
The first example is demonstrating where we check to see if they can slide, with the player walking to the right. In the second example, we are still checking the same area, and as it is clear, we should make the player slide, even though it will move them up over the top wall to do this. Hope that clarifies things a bit. ^^ |
Yes, it does.
thanks |
Quote:
For example, if the player is holding up and right, then we can either face upwards and slide to the right, or face to the right and slide upwards. The other 2 checks, facing right and sliding downwards, and facing up and sliding to the left, would feel unnatural to the user, and should be avoided. |
using my control movement script (movement functions, uploaded on graal.net), I came up with this specifically. Does it just about perfectly, except my movement scripts go exactly to the wall rather than rounding.
PHP Code:
|
Quote:
>> temp.case_two = tilesSwitch(temp.case_x,temp.case_y,7/8,7/8);; |
Quote:
Add: the one I'm using now just uses the onTiles function I made because I am finally able to detect NPCs correctly for Stefan adding an npc.var for whether or not the NPC is blocking. Now I just need to wait for Stefan to add read access to players[i].paused, players[i].rating, and players[i].ratingd, and then reimplement the AP system somehow... though reimplementing the AP system is going to be hard. Gotta look for NPCs that don't use the heal() function, gotta make exceptions for spar and event levels, and I gotta add a earnedhp variable so the maxhp variable can override it (which will be a fun challenge). hp = how many hearts maxhp = how many hearts you can have currently. earnedhp = how many hearts you have by default maxhp can go under earnedhp depending on AP, but I don't want to cap it because perhaps there would be some event in which you want to give a player 20 hearts. But yea, that's the easiest way to manipulate to include the AP system based on how everything's already built for Classic. I don't know how I got on this tangent. |
|
Quote:
|
Quote:
Quote:
|
| All times are GMT +2. The time now is 09:37 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.