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 Professional Discussion / simple code to stop turn advancement to the next turn if not mouseclicked in specified locations

Author
Message
Unseen Ghost
23
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 20th Jul 2003 04:50
Hi,
I need help figuring out simple code to prevent the turn from advancing to player 2 turn if mouse hasn't been clicked in the 9 locations on a tic tac toe board. I don't know if I should put the code in the main loop whick I have posted or put it in the sub routines Can anyone help ?

UnseenGhost

P.S- You know how little kids are when they get on the computer.
(they like to click, click, click) LOL
shwuckie
23
Years of Service
User Offline
Joined: 9th May 2003
Location: Australia
Posted: 21st Jul 2003 07:09
one way to handle this would be to use a flag, set the flag to zero at the start of each loop, then after the user has clicked, check if they have clicked somewhere valid (ie in one of the boxes and also if the box is empty) and if so set the flag to one, then at the end of the loop check if the flag doesnt equla zero, and in either case do what it has to do, either loop again until it is set or jumpo to the pat of ya code for the next player

eg: (btw this is psuedocode)

startofloop:
do
flag=0

`game code
if valid_area_clicked then flag=1

`check what to do next based on flag value

if flag=1 then gosub next_player_stuff
else
loop

ok thats not proper code but should give ya the idea, i dont have time to write the code on how to do this at this time

cheers

optic blast! megablast! have a blast!!
Codger
23
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 21st Jul 2003 10:06
check the status of the game if its not player a turn dont let him play

System
PIII 650 MZ H.P. Pavillion
394 Mem GeForce 4 400MX
Unseen Ghost
23
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 22nd Jul 2003 04:12
Thanks,

I will see what I can do.

UnseenGhost

Login to post a reply

Server time is: 2026-07-21 12:50:45
Your offset time is: 2026-07-21 12:50:45