"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G
Umm i mean't, like in RTS game, i click some where, and the soldier walks there. The problem is, he won't dodge any rocks / buildings. So he just bump and bump to it :/ Tell me addres for one? ;F
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G
Um, try putting little sprite "detectors" on the objects that will block your path (ie. buildings, rocks etc) and when the character of your game comes near that object, make your character move a little left, or right, up or down, then to the direction of the desired possition. The psuedocode will be like:
loop
{
if charcter is moving up or down and bumps detector,
go left for 1 second then look at direction desired.
if charcter is moving left or right and bumps detector,
go up for 1 second then look at direction desired.
}
of course you must have the desired possition saved (like a value; or just place a sprite, so that that will be the marker for the possition) until you click on another region.
also you can calculate the distance of the x or y of the character in relation to the x or y of the detector and move to the desired way. By this you can have the best possible path for your character (well, best possible means for this crude code)
example
loop
{
if character is moving up or down and bumps detector
-check if which left or right edge of the detector
the character is nearer.
-go to that direction for 1 second then look at
desired direction.
if character is moving left or right and bumps detector
-check if which upper or lower edge of the detector
the character is nearer.
-go to that direction for 1 second then look at
desired direction.
}
Of course this will loop unitl, eventually, the object will not be detected by the detector sprite and continue on its way.
Just convert it to a Click code, I'm much at ease doing pseudocodes.
Don't worry, this works 'coz i've tried it in CNC once and you won't need any extensions. Only the painstaking proccess of putting detectors on every objects. (well you can copy the whole object with the detectors around it and just paste it)
Theres a 1 second time for it to look back to the desired direction, so it will not shake... (it'll be slow though). If you want it fast, decrease the time (the faster the loop time the more "shakey it will be")
Oh, you can also have shapes for your detectors so it will conform to your object.
Besides... as i've told you, this is just a crude alternative.
why not put the detectors around the object and have them detect the 'backdrop' instead?
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G
If you want to know a really long and boring but otherwise easy way then you simply say that when the object is trying to move into a specific zone from a spcific zone it first moves in the direction of a specific point (eg the corner of whatevers in the way). There are obviously a lot of permutations and you're engine needs the objects to know where they're going, and you can't just throw down the terrain and call it a map. But if you can be bothered to do it it'll work.
Why the hell am I on the computer at 1 in the morning? No, don't answer.