Switches?

Non-platform specific questions.

Switches?

Postby Quill » Tue Dec 30, 2008 12:51 pm

Hello, I'm new to the Game-editor but I feel it's a great program for making games and I'm enjoying it alot.

One question though, is there a 'switch' function in Game editor? When I say switches I mean as an event, put 'Switch1 = on' or similar. Then in other events you can put 'if switch1 = on something happens' and 'if switch1 = off something else happens'.

When I've used another program this really helped the process, but I'm not sure whether game editor has this.
My current projects:
Megaman style platformer test: 50%
Kittyman adventures: Designing. Will start after the platformer engine is finished

Overall goal:
Top down view Dead Rising style game: Designing ideas/characters/map/how to make it on paper
Quill
 
Posts: 6
Joined: Tue Dec 30, 2008 12:40 pm
Location: Sitting in front of my computer-24/7
Score: 0 Give a positive score

Re: Switches?

Postby skydereign » Tue Dec 30, 2008 1:42 pm

This can be done many ways. I believe your 'switch' would be a global variable. You can set the variable to 1, simulating on, and 0 for off. If you know a little scripting then you can use this to make the events you wish. I believe there are several gameEditor tutorials, some built in, that can help teach you. If you don't know much scripting then looking on the forum can help. If you can't find what you are looking for, just ask.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Switches?

Postby Quill » Tue Dec 30, 2008 3:45 pm

Ah thanks. Currently I don't know any script except yvelocity and xvelocity, but that's the reason why I chose this, to start programming.

Thanks again!
My current projects:
Megaman style platformer test: 50%
Kittyman adventures: Designing. Will start after the platformer engine is finished

Overall goal:
Top down view Dead Rising style game: Designing ideas/characters/map/how to make it on paper
Quill
 
Posts: 6
Joined: Tue Dec 30, 2008 12:40 pm
Location: Sitting in front of my computer-24/7
Score: 0 Give a positive score

Re: Switches?

Postby Freddy » Wed Dec 31, 2008 6:09 pm

Yeah, you can make a variable and use it like this:
If(variable = 1)
{ xvelocity = xvelocity + 1}
Hola
User avatar
Freddy
 
Posts: 548
Joined: Sat Jun 02, 2007 3:42 pm
Location: Why do you want to know?
Score: 14 Give a positive score

Re: Switches?

Postby BlarghNRawr » Thu Jan 01, 2009 7:25 pm

if(variable==1)
{xvelocity=xvelocity+1}

forgot an equls
Download Game Music
current projects:
Bold! ?% Started mechanics
Unnamed puzzle game 60% --i need a name!--
User avatar
BlarghNRawr
 
Posts: 767
Joined: Wed Jun 25, 2008 12:36 am
Location: Not using G-E anymore. Now using Source SDK.
Score: 27 Give a positive score

Re: Switches?

Postby DST » Thu Jan 01, 2009 11:08 pm

xvelocity+=variable;
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Switches?

Postby Quill » Mon Jan 12, 2009 8:14 pm

This is great and will/has come in useful. This also has helped me understand how to use variables proporly, so that actually gets one question in my mind out the way (how to make a health system. Simple, use a variable as the health and when the collision event/whatever event happens make the variable go down) but I have one more question. How do you make a title screen? I'm getting a friend to draw the graphics but I'm not sure how to impliment it.

Do you simple have to create an actor that's the title screen somewhere, and when you press the 'start' button (or any button in my case) you then use the create actors event for the characters/ enemies and then use the script to move the view to the main actor?
My current projects:
Megaman style platformer test: 50%
Kittyman adventures: Designing. Will start after the platformer engine is finished

Overall goal:
Top down view Dead Rising style game: Designing ideas/characters/map/how to make it on paper
Quill
 
Posts: 6
Joined: Tue Dec 30, 2008 12:40 pm
Location: Sitting in front of my computer-24/7
Score: 0 Give a positive score

Re: Switches?

Postby skydereign » Mon Jan 12, 2009 11:57 pm

There are many ways to do this, it really depends on what you like and are comfortable with.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Switches?

Postby Fuzzy » Wed Jan 14, 2009 7:04 am

Quill wrote:This is great and will/has come in useful. This also has helped me understand how to use variables proporly, so that actually gets one question in my mind out the way (how to make a health system. Simple, use a variable as the health and when the collision event/whatever event happens make the variable go down) but I have one more question. How do you make a title screen? I'm getting a friend to draw the graphics but I'm not sure how to impliment it.

Do you simple have to create an actor that's the title screen somewhere, and when you press the 'start' button (or any button in my case) you then use the create actors event for the characters/ enemies and then use the script to move the view to the main actor?



That will work, yes.

I avoid situations like what was mentioned before. I am not in favour of if statements. To me, its like having the computer make a decision over and over when the programmer can plan ahead and avoid that. Ifs are branches in the code and make things more cluttered too.

What I like to do is have a variable and use that as a multiplier. For example, when jumping, you dont say this in key down event
Code: Select all
if (jump == 1)
{
yvelocity = 5;
}


Two reasons. First, thats four lines of code. second, you will have to set it to zero again later. Thats at least 4 more lines.

Instead, try to do things like this in draw actor:
Code: Select all
yvelocity = 5*jump; // jump flips on and off in key down event: always comment your code.


See? One line.

now in the key down event put
Code: Select all
jump = abs(jump-1); // takes one off jump, then ignore the negative sign if there is one. result is either zero or one.


And thats only two lines. You can see that its much cleaner looking too. My comments make it a bit longer, but they are important reminders.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: Switches?

Postby Quill » Mon Jan 19, 2009 9:57 pm

That makes sence. I'll try that out next time. Thanks!
My current projects:
Megaman style platformer test: 50%
Kittyman adventures: Designing. Will start after the platformer engine is finished

Overall goal:
Top down view Dead Rising style game: Designing ideas/characters/map/how to make it on paper
Quill
 
Posts: 6
Joined: Tue Dec 30, 2008 12:40 pm
Location: Sitting in front of my computer-24/7
Score: 0 Give a positive score

Re: Switches?

Postby BlarghNRawr » Sat Mar 07, 2009 9:02 pm

that 4 line code dont have to be 4 lines, it can be one line with spaces... like this=> code {more code}

... just putting that out there
Download Game Music
current projects:
Bold! ?% Started mechanics
Unnamed puzzle game 60% --i need a name!--
User avatar
BlarghNRawr
 
Posts: 767
Joined: Wed Jun 25, 2008 12:36 am
Location: Not using G-E anymore. Now using Source SDK.
Score: 27 Give a positive score

Re: Switches?

Postby Fuzzy » Sun Mar 08, 2009 5:36 pm

BlarghNRawr wrote:that 4 line code dont have to be 4 lines, it can be one line with spaces... like this=> code {more code}

... just putting that out there


You are missing the point. Reductionism in coding is a laudable enterprise. Elimination of line feeds is simply an exercise in obfuscation.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Re: Switches?

Postby BlarghNRawr » Sun Mar 08, 2009 6:29 pm

i only understood the word 'of' :shock: ....
Download Game Music
current projects:
Bold! ?% Started mechanics
Unnamed puzzle game 60% --i need a name!--
User avatar
BlarghNRawr
 
Posts: 767
Joined: Wed Jun 25, 2008 12:36 am
Location: Not using G-E anymore. Now using Source SDK.
Score: 27 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron