Shop More Submit  Join Login
×




Details

Submitted on
April 23, 2008
Image Size
4.4 KB
Resolution
550×400
Link
Thumb
Embed

Stats

Statistics are temporarily unavailable

×
UPDATE: I've uploaded the Actionscript code here:
[link]
I dare someone to make sense of it :P



I always play connect 4 in class at school when I'm bored. I'm actually quite good at it :P So one day I was playing a friend, and I we argued who would draw up the grid on the paper. I ended up doing it, but then I had an awesome idea. We have our own kind of connect 4 game. Instead of playing first-to-get-a-row-wins kinda game, we actually play until the grid is filled up, and tally our rows. The awesome idea was - make one in Flash!

I had the basic idea layed out in my mind, but when it came to working out if a row had occured, it was quite complex. Although, I had already promised my friends I would finish it, so I was determined to get it working.

The basic idea behind working out rows is this - convert the multi-dimensional array of blocks (rows/cols) into a flat array. Then, I worked out the patterns in which rows would occur: horizontal lines would happen with an increment of +1, vertical would be +col, and diagonals would be +col+1 or +col-1 depending on the way it went.

However it wasn't completely there, I still had the errors of rows happening across sides. I fixed that by determining blocks that were row ends, and row starts. If a row end was in a row AND a row start, then the row would be false. If only one of them occured, then it was right.

Total for loops: 18

This is just version 1, I will be adding more features later :)


EDIT: There is a bug with diagonal rows. Apparently they still work across sides... somehow.
Add a Comment:
 
:iconeuphoricmadness:
euphoricmadness Featured By Owner Aug 7, 2012  Hobbyist Photographer
Fun, thx for this. =)
Reply
:iconrecordjockey:
RecordJockey Featured By Owner Jul 23, 2010
me and my friend covered the whole board...neither of us won ^^;
Reply
:icondegraiver:
Degraiver Featured By Owner May 6, 2008  Hobbyist Traditional Artist
Wow, thats brilliant! I dont know how to use arrays very well so that idea never came to me. How long have you been doing flash? You make actionscripting so short. lol I would have done if true if false statments for all sectors. And it was hard enough for tictactoe. Props to you.
Reply
:iconmediadesign:
MediaDesign Featured By Owner May 6, 2008
Thanks mate :D I could've done it all if's and booleans, but then the program would be HUGE! Not that it isn't already. The game as I've found out is very buggy... which is quite disappointing. I'm planning on recoding it.

I've been doing Flash since I was 10, so about 6 years. Unfortunately because of the age I started learning Flash, I never understood math formulas. I just basically mastered everything else :P So now, it's to the math...
Reply
:icondegraiver:
Degraiver Featured By Owner May 6, 2008  Hobbyist Traditional Artist
Crap. Id say ive been using flash for only about 2 years; so all i really understand is if and booleans statments. I cant use arrays very well and the point of math, I dont even know where to begin lol well I hope to see some more great games from you. Put some more coding up so I can learn from you ;D
Reply
:icondegraiver:
Degraiver Featured By Owner May 6, 2008  Hobbyist Traditional Artist
Forgot to mention; I can read your coding just fine =D
Reply
:iconmediadesign:
MediaDesign Featured By Owner May 6, 2008
Really? Wow, even I can't make sense of it anymore lol.
Reply
:iconretoocs:
retoocs Featured By Owner Apr 24, 2008
Nice!!
Reply
:iconmediadesign:
MediaDesign Featured By Owner Apr 24, 2008
Thanks for the :+fav: too :D
Reply
:iconmediadesign:
MediaDesign Featured By Owner Apr 24, 2008
Thanks :)
Reply
Add a Comment: