Project+Tron+Game

=Tron Game=

This game is going to so awesome! It is based on the Tron game and basically there are 2 players that move on a square screen leaving behind a coloured trail that never disappears. Your goal is to out-drive your opponent because hitting the coloured trail will cause you to crash and soon the field becomes smaller and difficult to navigate!

(2011/01/15)

More detailed instructions on how to make the basic Tron Game: Some sample code of mine: code function runPlayer1 {//this is just the beginning of the function p1x = _root["p1s"+p1track]._x;//p1x means the last X coordinate of player1 p1y = _root["p1s"+p1track]._y;//p1s is the name of the square of player1 _root.control.p1track++; if (p1 == "right") { if (screenData[p1x+5][p1y] == 0) { _root.attachMovie("player1Square","p1s"+p1track,p1track*2+100); _root["p1s"+p1track]._x = p1x+5; _root["p1s"+p1track]._y = p1y; screenData[p1x+5][p1y] = 1; } else { winner = 2; _root.attachMovie("restartButton","restartButton",_root.getNextHighestDepth); _root.gameStarted = false; } } .... } code
 * 1) set the background as gray
 * 2) have a variable store a String with information on the movement of player 1 (on the right side)
 * 3) i.e. player1direction = "up";
 * 4) repeat for player 2 (starts at the left side)
 * 5) set an initial location of each player
 * 6) depending on the direction of each player, load the appropriate coloured square on the field
 * 7) i.e. if player1direction == "left", then _root.attachMovie("magentaSquare","magentaSquare",p1counter*2+evenNumber), where magentaSquare is the ID of the square with the magenta colour, p1counter is an ever increasing value for the layer # of the magenta tile, and evenNumber is any even number such as 100 or 200.
 * 8) after attaching the square, move the _x coordinate to the left of the initial location and save the current location in 2 variables
 * 9) for example if the next loop of the code has player 1 going up, attach the movie like before and move the square above the previous location (saved in the variables)

(2011/1/11)

The next goal is to make AI like in Pong.


 * 1) Let's split the behaviour into 2 categories (macro management vs micro manage of the AI)


 * Macro** has to do with the overall strategical pattern of movement: Do you want the AI to dominate in the centre of the field or to put pressure on one specific half of the field?

code pseudo-code here: split screen into 9 sectors; if player on sector 1{ if player going up{ then intercept player; }else if player going down{ then intercept player; }else if player going right{ then intercept player; }else if player going left{ then intercept player; } }else if player on sector 2{ //etc for 9 different sectors if player going up{.....//each sector has different code }

code


 * Micro** has to do with the fine driving skills: This is more important than Macro management because it has to do with avoiding walls and making the correct turns. The AI should NEVER hit a wall for no reason!

code pseudo-code here: if next square(s) == a wall{ check AI direction; check the two other available directions; if plenty of space{ consult with macro-management code; }else{ do what is needed to survive; } } code

Here is the latest version!

updates:
 * no suicide glitch
 * grid background
 * no lag after multiple games
 * score counter
 * return to menu

media type="file" key="AI Tron Game v7.swf" width="462" height="462"

.