The Rantings of a Teenager in the Prime Crap-itude of High School

Monday, August 08, 2005

New Game

Okay, just a little FYI

I am going to make a Jurassic park Game, so I may be anti social for a while.

Eric, I could use that save game function. Soon.

-Motor.On

6 Comments:

Anonymous Anonymous said...

Yeah. Well, I'd love to help, but I'm sitting at a puttering 26kbit connection right next to lake cumberland. Ok, you can't just write a generic "save game" function. It isn't hard to write a function that would save the state of all of your variables (do i have the plasma blaster or not??), but it's a *little* trickier to make it save the position you are in a strategy game. One way to do it would be to create an int that keeps track of the current decision. Then you'd put a goto in front of each of the decisions and do a switch statement for each one. Also, you'd have to declare all of your variables globally. I'm writing a very simple example right now. I'll send it once I finish and test it.

11:50 PM

 
Blogger Motor.On said...

thx

I know that the position would be hard, so I may make it a save-station type thing. That way, you nly have 4-5 positions that you could save at, but each one has a certain save variable.

I already declare my variables globally, so that isn't a problem.

1:20 PM

 
Blogger Eric said...

Ok. Asif (if you ever read this), isn't there some reason that we SHOULDN'T be declaring 50 variables globablly? Oh yeah, Alan, I was looking over the Knight's Quest source and I saw you declaring variables and then setting them to zero. Save yourself some code. Instead of:

int win;
win=0;

Do:

int win=0;

Yeah I'm sure you knew that. Whatever.

10:13 AM

 
Blogger Asif said...

I would say don't use global variables because the code would be harder to read and debug and stuff. I mean, variables should only be there for when they are needed, and not any longer. If you get an error about global variable xyz847 somewhere, and you have 150 functions accessing it, you would have to check all the functions - if you used local variable with less scope, it would be much easier.

Also, I would stay away from those goto statements. In my opinion, you should never use them.

Java (which would porobably solve a lot of your problems, and is not that different from C++) doesn't even havea goto statement, and as far as I know, nothing exactly like a global variable (it does have public access stuff though).

12:16 PM

 
Blogger Motor.On said...

Asif, the fact is, I never declare a variable as xyz847. I declare it as:

rifle, or
ammo=346.57
or
trex1isasleep=1 (true)

1:41 PM

 
Blogger Eric said...

Can you have numbers in C variables? I need to learn Java. Plus, you had a "win" variable once Alan.

3:14 PM

 

Post a Comment

<< Home