Page 1 of 1

Setting Map Size with ease

PostPosted: Thu Mar 08, 2012 6:08 pm
by Hblade
You can limit how far you want the view to go simply by using this command
Code: Select all
SetLimitX(-1, 1);
SetLimitY(-1, 1);

Explanation:
SetLimitX(left_screens, right_screens);
left_screens is how many screens the view has torwards the left, and right_screens is how many it can go right.

SetLimitY(top_screens, bottom_screens);
top_screens is how many screens the view can go up, wile bottom_screens is how many screens the view can go down.

Use this to make your levels :) the code is simple too :)
Code: Select all
void
SetLimitX(int lx, int ly)
{
    x=max(lx*view.width, min(ly*view.width, x));
}

void
SetLimitY(int lx, int ly)
{
    y=max(lx*view.height, min(ly*view.height, y));
}