L
Lok_OS
Guest
I have a camera that follows two players in a side-scrolling game, I have managed to set it up so that players can't just walk out of the view with no problems, by checking their x and movement speed compared to view_xview.
However, there is a dash button in the game which makes the players cover so much distance that they'll occasionally clip slightly out of the view when using it.
The code for the dash view checking essentially looks like this:
dashspd in this case is 30.
So the question is, what's the best way to check for collision with a view when dealing with such big numbers? I used the same code when dealing with the normal walk speed and that seems to work fine.
I also tried using Boundary View "x = xprevious" but that makes the camera jitter when putting the player back to xprevious, I want to be able to smoothly stop against the view.
However, there is a dash button in the game which makes the players cover so much distance that they'll occasionally clip slightly out of the view when using it.
The code for the dash view checking essentially looks like this:
if (x + dashspd < view_xview[0])
{
x += dashspd;
}
{
x += dashspd;
}
dashspd in this case is 30.
So the question is, what's the best way to check for collision with a view when dealing with such big numbers? I used the same code when dealing with the normal walk speed and that seems to work fine.
I also tried using Boundary View "x = xprevious" but that makes the camera jitter when putting the player back to xprevious, I want to be able to smoothly stop against the view.