02.02.2013 Views

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Flash</strong> <strong>MX</strong> <strong>2004</strong> <strong>Games</strong><br />

The game uses keys 1 and 3 <strong>to</strong> control the ‘Bat’. The left, right, up and down keys are reserved<br />

for the i-mode browser so you cannot receive key information from these. The keys available are<br />

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, * and #. To receive keyboard input you must use a <strong>Flash</strong> but<strong>to</strong>n. You<br />

cannot target key messages <strong>to</strong> a movie clip or use the ‘Key’ object; these techniques are unavailable<br />

on <strong>Flash</strong> Lite. The syntax for detecting key presses is shown in Listing 19.2.<br />

1 on(keyPress "1"){<br />

2 if (dx>0) dx=0;<br />

3 if (dx>-5) dx--;<br />

4 if (board._x>-51) board._x += dx;<br />

5 }<br />

6<br />

7 on(keyPress "3"){<br />

8 if (dx

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!