Setting Map Size with ease

Learn how to make certain types of games and use gameEditor.

Setting Map Size with ease

Postby Hblade » Thu Mar 08, 2012 6:08 pm

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));
}
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest