Making your move

Everything is ready to let the player drop his/her disc. You can check whether each column represents a legal move or not, and you know which row will occupy a falling disc, given a column.

The idea: When the player clicks the mouse, we check if the column he picked is a legal one, in this case we place the disc in the proper row and let the other player move. At the moment, there isn't a computer-controlled opponent yet, so you will have to play both with red and yellow discs.

The development: To make the player drop the disc with a mouse click, you have to import MouseEvent class in to use your old friend MouseEvent.CLICK listener.

import flash.display.MovieClip; import; import; ...

Get Flash Game Development by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.