2. Keyboard input
• If your ActionScript game class is
called by a Movie symbol, the user
input may not be recognized until the
user clicks the screen!
• To fix this, add a line of code before
your keyboard event listeners:
stage.focus = stage;
6. Exporting
• Sketches run as Java Applets
• Sketches can be exported to several
formats:
‣ Java applet with index.html page for
web borwsers
‣ Windows, Mac, and Linux
applications (use menus)
9. Add cosine
float cosval = cos(angle);
float sinval = sin(angle);
float x = 100 + (cosval*radius);
float y = 100 + (sinval*radius);
ellipse(x, y, 80, 80);
10. Warp it
float sx = 1.0;
float sy = 0.5;
float x = 100 + (cosval*radius);
float y = 100 + (sinval*radius);
float x2 = x + cos(angle*sx) * radius/2;
float y2 = y + sin(angle*sy) * radius/2;
ellipse(x2, y2, 6, 6);
11. Organic motion
angle += random(-0.2,0.2);
x += cos(angle) * speed;
y += sin(angle) * speed;
print("x="+x+", y="+y+"n");
translate(x,y);
rotate(angle);
line (0, -20, 0, 20);
12. Final Projects
November December
11 18 25 2 9 16
Last day
of class
Design background and
game elements. Embed
in game symbol
Present final projects
(two days)
Script user interaction and
movement of game elements
Add scoring and
game over trigger