Message-ID: <004601be30cc$621111a0$b1f9c6c3@johans-dator> From: "Johan Henriksson" To: Subject: Re: Once Again, Another Question On StarMaps.. Date: Sat, 26 Dec 1998 13:36:33 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Reply-To: djgpp AT delorie DOT com -----Original Message----- From: Mad Cow To: djgpp AT delorie DOT com Date: Saturday, December 26, 1998 7:13 AM Subject: Once Again, Another Question On StarMaps.. > > > Well, its still X-Mas and look where I am.. > I cant figure out *one* tiny little problem with > this "game" if you can call some thrown together > messed up, garbage code that..but! back to my > problem, i now have a theorm for movement along > a 10x10 StarMap, thanks to Johan, buut..I cant > quite figure out a physical map, ya know? of course > you dont..umm, here, ill show ya.. > > > > >> 1 2 3 4 5 6 7 8 9 0 >> 1 * * * * * * * * * * >> 2 * * * * * * * * * * >> 3 * * # * * * * * * * >> 4 * * * * * * * * * * >> 5 * * * * * * * * * * >> 6 * * * * * * * * * * >> 7 * * * * * * * * * * >> 8 * * * * * * # * * * >> 9 * * * * * * * * * * >> 0 * * * * * * * * * * > >okay, there's my map..right? so say >its player 1's turn, and player 1 wants >to go out and capture say B2, well, here's >my problems on this one... > >A: how do make 2,2 an actual "star" > i.e. a place with 42 resources and stuff like that? > Uhh, sheesh this is hard to explain...gosh... > you know? like when player 1 says i want to go to > 2,2 and get resources from it...well i need help on > making 2,2 a place with stuff in it. and i need it to > "know" its location which is 2,2...uh, if ya get the > the point im tryin' to make then fer one congrats :P > and...well, to be perfectly frank, help! hehe.. It is a little bit hard to figure out the code when I don't really know so much about the game but I give it my best shot. First out, you should use a structure somewhat like this one: typedef struct mappiece { short int object, //This one tells what the mappiece is. 0=empty space 1=star .... resources; } mappiece; mappiece map[10][10]; And this to create the players: typedef struct player_struct { short int x,y,resources; } player_struct; player_struct player[2]; Here is some code you might need to modify: if(mappiece[player[actplayer].x][player[actplayer].y].object==1) if(mappiece[player[actplayer].x][player[actplayer].y].resources>0) { player.resources++; mappiece[player[actplayer].x][player[actplayer].y].resources--; } actplayer is the active player. You don't seem to have grasped the basic techniques of games yet. Make sure you know how to use itteration and matrices right before you start with your game. > > well if you've read this far then thanks fer the time! > all help is once again apprecaited..and thanks again Johan > for that theorm! No problem :)