Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Playing pieces

Author
Message
Sonic 91 Software
20
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 23rd Feb 2006 17:45
I am making a 3d board game for up to 4 players, therefore there are 4 playing pieces available. how can i go about coding so that the same piece isn't selected twice without going through all the different combinations of pieces?

I am a Christian and I know that God loves me. That is what makes my life so great!
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 23rd Feb 2006 20:01
HUH? Confuzzzzeed.......???

The computer should select the piece for you, without you clicking it, or whatever you mean...

MORPG programmer
19
Years of Service
User Offline
Joined: 23rd Aug 2005
Location: runescape
Posted: 24th Feb 2006 03:36 Edited at: 24th Feb 2006 03:41
set a variable, like playerone_had_his_turn = 0. if it is 1, say you cant do that. if it is 0, select the piece. after all players have gone,(say, if playerfour_had_his_turn = 1) then set all player_had_his_turn vars to 0.



that prevents the players from moving twice.

MORPG programmer?
nah, MMORPG gamer is more like it =D
3D modelers needed for new MORPG!! join now!!
Sonic 91 Software
20
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 25th Feb 2006 15:29
what i mean is before the game starts, the player selects how many players are going to be in the game and then selects a playing piece for that player, so say the player selects 3 players, then chooses piece 1 for the 1st player, how can i disable piece 1 from getting selected for the second player?

I am a Christian and I know that God loves me. That is what makes my life so great!
MORPG programmer
19
Years of Service
User Offline
Joined: 23rd Aug 2005
Location: runescape
Posted: 25th Feb 2006 20:20
hmm... sonic 91.. get the book u n00b...

like this:


as you can see, if you wanted four players, the fourth player piece thingy would have to check for player two,three,and one before contunueing.

there are much better ways for doing this, but i'm not big on DBC.

MORPG programmer?
nah, MMORPG gamer is more like it =D
3D modelers needed for new MORPG!! join now!!
SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 25th Feb 2006 22:50 Edited at: 25th Feb 2006 22:51
Quote: "
print "press the piece number you want, player 1!"
input playeronepiece
"


Is that pascal, by chance - or have I not been paying enough attention in my lessons.

Regardless, input has two parameters in both of the dark basic languages - the first being the string to print to the screen, the second being the variable to save the input as...

so you would actually do:
input "press the piece number you want, player 1!",playeronepiece

and so on...
Sonic 91 Software
20
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 27th Feb 2006 10:36
Quote: "hmm... sonic 91.. get the book u n00b..."

excuse me, but i am not a n00b! however, i do have the book and your info helps (but i'll only find out if it works when i try it!)

I am a Christian and I know that God loves me. That is what makes my life so great!
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 28th Feb 2006 07:19
I'd just make it easier and show the pieces on the screen as sprites. Use sprite collision to detect the mouse on the sprites and when they press the mouse button on a sprite the sprite is pasted to the screen (greyed out) and the sprite deleted. Once the sprite is gone they cannot pick that piece again because there can't be sprite collision on that piece anymore. This can be done with as many pieces as you want without an if/then statement for each piece.

Well... it sounds easier to me.


Sonic 91 Software
20
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 28th Feb 2006 11:55
interesting, grog. thanks. i'll keep that in mind.

I am a Christian and I know that God loves me. That is what makes my life so great!
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 28th Feb 2006 23:06
Np.


Sonic 91 Software
20
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 21st Mar 2006 12:42

The above code snippet was posted by MPORG, this does help, but can someone show me to adapt this to work with the inkey$() command?

I am a Christian and I know that God loves me. That is what makes my life so great!
Sonic 91 Software
20
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 25th Mar 2006 11:48
if i try, say,


for some reason it always says "taken" and doesn't allow me to select a piece for players 3 and 4 (code for player 3 and player 4 piece selection not shown, but is the same).

I am a Christian and I know that God loves me. That is what makes my life so great!

Login to post a reply

Server time is: 2025-05-23 19:01:36
Your offset time is: 2025-05-23 19:01:36