I want to have a setting so that a player can't leave a region. I've done some fiddling around with global boolean variables and cCharacter.Stop Moving, but when I try to leave, it just stops, then I can continue on. Surely there must be a way to totally prevent a character from leaving a region?
Quote from: Virgil on Wed 07/10/2009 22:55:36
I want to have a setting so that a player can't leave a region. I've done some fiddling around with global boolean variables and cCharacter.Stop Moving, but when I try to leave, it just stops, then I can continue on. Surely there must be a way to totally prevent a character from leaving a region?
There is this way: try to make character
return inside the region either by walking or teleporting 1 to few pixels back.
Like this:
cEgo.StopMoving();
if (cEgo.x <= RegionLeftBorder)
{
cEgo.x = RegionLeftBorder + 1;
}
if (cEgo.x >= RegionRightBorder)
{
cEgo.x = RegionRightBorder - 1;
}
etc
Oh, that works great. I suppose the only hitch is that the screen shutters since its longer than the viewport. Oh, well, I don't think there's anything I can do about it.
There is, just use more than one walkable area and deactivate the one(s) outside the region.
Yes, I know about that, but it wouldn't have worked for what I have planned.
In fact I may not even have to use this, its more of a contingency plan. I still learned something though.
Quote from: Khris on Thu 08/10/2009 00:13:19
There is, just use more than one walkable area and deactivate the one(s) outside the region.
I feel dumb... ;)
Quote from: VirgilYes, I know about that, but it wouldn't have worked for what I have planned.
Hmm.. why?
;)
Simply what I have planned. Though I most likely won't use it. Thanks for you help anyway.