Newie Problem : Various levels in same file

Non-platform specific questions.

Newie Problem : Various levels in same file

Postby AcisAce » Wed Mar 07, 2012 3:48 am

I was looking forward to ask that how can i make different levels in the same .ged file.
Till now i was using the LoadGame command in script editor to link the title to the first level but i think that its not good option because people can then directly start next levels. My game is Based on Zombie Survival so i need help.
I hope someone will help me........
AcisAce
 
Posts: 4
Joined: Mon Mar 05, 2012 4:17 pm
Score: 0 Give a positive score

Re: Newie Problem : Various levels in same file

Postby Hblade » Wed Mar 07, 2012 4:44 am

You'd set up a "MAP" section, then use X and Y, like so:
Code: Select all
switch(MAP)
{
    case 0:
    break;
    case 1:
        view.x=min(2583, max(view.x, 288));
        view.y=min(-216, max(view.y, -648));
    break;
    case 2:
        view.x=min(3170, max(view.x, 3746));
        view.y=min(216, max(view.y, -216));
    break;
    case 3:
        view.x=min(4316, max(view.x, 3746));
        view.y=min(216, max(view.y, -648));
    break;
    case 4:
        view.x=min(6046, max(view.x, 4895));
        view.y=min(-648, max(view.y, -648));
    break;
}


switch(map), map is a variable. You can use what ever event you want to change the maps.
view.x=min(var1, max(view.x, var2); Var1 is the max X position the map can go, var2 is the minimum ammount the view can set.
same with y, only the first set of numbers is the lowest, and the second is the highest.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4365
Joined: Fri Dec 08, 2006 11:14 pm
Score: 168 Give a positive score

Re: Newie Problem : Various levels in same file

Postby SuperSonic » Wed Mar 07, 2012 5:24 pm

@AcisAce: It is actually better to use multiple files than to put your whole game in one big exe. But to fix the problem you stated, you can simply export your game as a dat file instead of exe and still use loadgame() :wink:

@Hblade: This is a little off topic but I never fully understood the max() function. Could you explain it please? :P
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1444
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Newie Problem : Various levels in same file

Postby skydereign » Thu Mar 08, 2012 12:22 am

SuperSonic wrote:@AcisAce: It is actually better to use multiple files than to put your whole game in one big exe. But to fix the problem you stated, you can simply export your game as a dat file instead of exe and still use loadgame() :wink:

This is arguable. The reason I find using a single file is better is you don't have to recode it in every file. If gE allowed for importing actors, this would no longer be an issue. Also using a single file allows for quick moving between levels and menus, and you don't need to worry about saving variables over the jumps.

SuperSonic wrote:@Hblade: This is a little off topic but I never fully understood the max() function. Could you explain it please? :P

All max does is return the larger of the two numbers passed. So max(2, 5) would return a 5. min does the opposite. You can use these functions to limit variables one way or another.
Code: Select all
x = min(100, x+1); // increases x, but sets 100 as the max x value
// it does this because it returns the smaller number between the two
// if x+1 is smaller, it returns x+1 (meaning x was increased)
// but if x+1 is bigger, it returns 100

Again, min works the same way, but opposite. Now you can use both min and max in tandem to limit a variable in both directions.
Code: Select all
x = max(0, min(100, x));
// this limits x between 0 and 100
// min(100, x) returns the smaller of the two, meaning the value returned is no greater than 100
// then max(0, <value that is no greater than 100>) returns the larger of the two, meaning the return value must be greater than 0

Usually when using the min function, you are setting a max limit (no greater than), while when you use the max function you are setting a minimum limit (no less than). At first it may seem a bit backwards but it makes sense given the functions.
User avatar
skydereign
 
Posts: 3426
Joined: Mon Jul 28, 2008 8:29 am
Score: 566 Give a positive score

Re: Newie Problem : Various levels in same file

Postby SuperSonic » Thu Mar 08, 2012 12:36 am

skydereign wrote:This is arguable. The reason I find using a single file is better is you don't have to recode it in every file

Yeah, that's true. I guess you could solve that by creating an engine. You know, that way you wouldn't have to recode everything :D
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1444
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Newie Problem : Various levels in same file

Postby skydereign » Thu Mar 08, 2012 12:49 am

SuperSonic wrote:Yeah, that's true. I guess you could solve that by creating an engine. You know, that way you wouldn't have to recode everything :D

An engine? You mean the complete controls of your game, and similar? If that's the case then you are assuming it is perfect and no changes would need to be done, which in turn would be perfectly fine. I've found that assumption to be pretty much never accurate though, which is why I prefer a single file.
User avatar
skydereign
 
Posts: 3426
Joined: Mon Jul 28, 2008 8:29 am
Score: 566 Give a positive score

Re: Newie Problem : Various levels in same file

Postby SuperSonic » Thu Mar 08, 2012 1:02 am

skydereign wrote:An engine? You mean the complete controls of your game, and similar? If that's the case then you are assuming it is perfect and no changes would need to be done, which in turn would be perfectly fine. I've found that assumption to be pretty much never accurate though, which is why I prefer a single file.

I'm not exactly sure what you mean. But when I say "engine", I usually mean a system that has all of the code for your game and simply loads external files such as bmp's and level data :D
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1444
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Newie Problem : Various levels in same file

Postby skydereign » Thu Mar 08, 2012 1:59 am

Ah, I thought you were still talking about a multiple ged approach. Yeah, generally speaking that would be the 'optimal' approach to multiple levels as far as speed is and reusability is concerned. Of course it is the approach that takes the longest to setup.
User avatar
skydereign
 
Posts: 3426
Joined: Mon Jul 28, 2008 8:29 am
Score: 566 Give a positive score

Re: Newie Problem : Various levels in same file

Postby SuperSonic » Thu Mar 08, 2012 2:57 am

skydereign wrote:Ah, I thought you were still talking about a multiple ged approach. Yeah, generally speaking that would be the 'optimal' approach to multiple levels as far as speed is and reusability is concerned. Of course it is the approach that takes the longest to setup.

Yeah, but it's worth it :P
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1444
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re:A Good idea :without scripting

Postby AcisAce » Thu Mar 08, 2012 3:29 am

a better idea is what ive got yesterday while i was resting.
we take a dot like sprite and put it on one corner of the view and make it views parent.
now whenever the level ends the dot will be programmed to move to a new area of the game where the next level starts
Hows that ?


Dont mind if its a stupid idea
Actually i am very new to this game editor and the language C too.
AcisAce
 
Posts: 4
Joined: Mon Mar 05, 2012 4:17 pm
Score: 0 Give a positive score

Re: Newie Problem : Various levels in same file

Postby skydereign » Thu Mar 08, 2012 3:41 am

You could do that, but if you are going to do it that way, skip the whole parenting and individual actor. Just change the view's position when you want to move to another level. You can set the view's position like you could any other actor.
Code: Select all
view.x=1000;
view.y=1000;
// that moves the view to (1000,1000)
User avatar
skydereign
 
Posts: 3426
Joined: Mon Jul 28, 2008 8:29 am
Score: 566 Give a positive score

Re: Newie Problem : Various levels in same file

Postby AcisAce » Thu Mar 08, 2012 8:41 am

hell..
why didnt i think of that ???
that was better.. view is itself an actor
AcisAce
 
Posts: 4
Joined: Mon Mar 05, 2012 4:17 pm
Score: 0 Give a positive score

Re: Newie Problem : Various levels in same file

Postby MrJolteon » Thu Mar 08, 2012 9:05 am

AcisAce wrote:hell..
why didnt i think of that ???
that was better.. view is itself an actor

There's no need to post the same post three times in a row...
Owner of the #GameEditor IRC channel at esper.net
User avatar
MrJolteon
 
Posts: 1877
Joined: Sat Aug 09, 2008 3:25 pm
Location: Fifth Layer
Score: 75 Give a positive score

Re: Newie Problem : Various levels in same file

Postby Hblade » Thu Mar 08, 2012 5:43 pm

MrJolteon wrote:There's no need to post the same post three times in a row...

I cleaned it up :3
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4365
Joined: Fri Dec 08, 2006 11:14 pm
Score: 168 Give a positive score

Re: Newie Problem : Various levels in same file

Postby SuperSonic » Thu Mar 08, 2012 6:38 pm

MrJolteon wrote:There's no need to post the same post three times in a row...

That is usually an accident. It happened to me once :P
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1444
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 0 guests