ARTDM 170, Week 14: Organic

  • 331 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
331
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. ARTDM 170, Week 14: Scripting Mechanical and Organic Motion Gilbert Guerrero gguerrero@dvc.edu gilbertguerrero.com/blog/artdm-170/
  • 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;
  • 3. Processing
  • 4. Download Processing http://processing.org
  • 5. Open Processing
  • 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)
  • 7. Sine wave 1 1 sin(angle) sin(angle) 0 0 -1 -1 90 180 270 angle
  • 8. Mechanical Ball Sketch float angle = 0.0; //current angle float speed = 0.1; //speed of motion float radius = 50.0; //range of motion void setup() { size(200, 200); noStroke(); smooth(); } void draw() { fill(0,12); rect(0,0,width,height); fill(255); angle += speed; float sinval = sin(angle); float y = 100 + (sinval*radius); ellipse(100, y, 80, 80); }
  • 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
  • 13. Work on your final projects
  • 14. Homework, due Nov 25 • Work on your final projects ‣ Script user interaction and movement of game elements
  • 15. Thank You