Quote:
Originally Posted by Gus
Basic code for subdividing a level into mini-rooms, as in Oddworld games:
if (p.xPos > 0)
if (p.xPos < 640)
if (p.yPos > 0)
if (p.yPos < 480)
p.cameraFreeze(0, 0, false, true);
if (p.xPos > 640)
if (p.xPos < 1280)
if (p.yPos > 0)
if (p.yPos < 480)
p.cameraFreeze(640, 0, false, true);
if (p.xPos > 0)
if (p.xPos < 640)
if (p.yPos > 480)
if (p.yPos < 960)
p.cameraFreeze(0, 480, false, true);
if (p.xPos > 640)
if (p.xPos < 1280)
if (p.yPos > 480)
if (p.yPos < 960)
p.cameraFreeze(640, 480, false, true);
And so on ...
|
Or, instead of hundreds of lines for barely medium-sized SP levels, you can use this one-liner:
Code:
void onPlayer()
{
p.cameraFreeze(p.xPos-p.xPos%640,p.yPos-p.yPos%480,false,true);
}
__________________
I am an official JJ2+ programmer and this has been an official JJ2+ statement.
|