ID:261350
 
Hello all...I have been gone for a long time because I was grounded...or atleast I thought I was, but thats a different story. While I was gone I decided to make a tic-tac-toe game, and I have everything I need, except the most important part....HOW TO WIN!

I'm not sure how to go about doing this. Do I run a check whenever somone clicks on a square to go, to see if there is an X above the one they just put down and an X below it or something? I tried using the get_dir(), but it would make me win no matter what, so I know that's not right ;). If somone could point me in the right direction I would really appreciate it.

?The Wizard of How¿
try get step.
Example, you have three in a row, you just placed your last piece.

Have that piece check in every direction. If it finds another peice north of you, check north of that piece. If there's one there, run WinGame squences. Do something similar for each direction when you place a piece.
In response to Foomer
Yeah, but what would I use to do that? I tried get_step and get_dir, but I couldnt get it. Thanks Foom
In response to The Wizard of How
get_dir returns a number, here's one way you can do this; make some vars:

mob
var
North
South
East
West
//Now set the vars at mob/New()
New()
North = src.y+1
South = src.y-1
East = src.x+1
West = src.x-1


Now, when checking the direction do it like so:

mob
proc
dircheck()
for(var/obj/O in src.South)//do this for all the directions
if(O.color = src.color)
//do stuff here if they match


Now, when you make a new piece appear on the board call that proc.
In response to Nadrew
Sorry Im being so stupid about this, but This error comes up and I'm not sure how to fix it;

src.kind:bad var

In this line;

if(T.kind == src.kind)

Can somone help me please......again?
In response to The Wizard of How
kind has to be a obj var and a mob var, set the mobs kind to what their team is at login, and then when you make a obj set it's kind to src.kind.