1 / 23

Programming games

Programming games. Cannonball due. Drawing & printing example. Acquiring video or sound Homework: Catch up: complete projects (rps, Bo, cb). Start video or audio. Plan your project. Cannonball extension. You may consider adding sound to cannonball for your sound/video project. Can use

ahanu
Download Presentation

Programming games

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming games Cannonball due. Drawing & printing example. Acquiring video or sound Homework: Catch up: complete projects (rps, Bo, cb). Start video or audio. Plan your project.

  2. Cannonball extension • You may consider adding sound to cannonball for your sound/video project. • Can use • coding or • sound in frame

  3. Flash terms • Create .fla and .as files using Flash development environment. This is development time. • Runtime (aka execution time) • Test program using the development environment. This does create a .swf file. • Publish creates .html file and .swf file

  4. Development time • Bring instances of movie clip symbols in Library to the Stage. • Give instance names • ActionScript refers to instances by name • Can File/Print • May not do what you want… • I copy and paste code into Word or Dreamweaver

  5. Drawing & printing • Adding content, namely a movie clip symbol to Stage at runtime • Various calculations • Use Properties of symbol (right mouse click) to set up: Export for ActionScript • Print during runtime • Can set up to print several pages. My example just prints one page.

  6. Demonstrate • Drawing example • Note: this is a ‘stub’ for a bigger application.

  7. Features • Create wall symbol. Change settings to Export for ActionScript. • Set up handling for mouse click on board. • One handler for 1st click and another for 2nd click • Use ev.localX and ev.localY to get coordinates. • Use Math.atan2(…) and Point.distance(…) • Use PrintJob

  8. Making your own video for Flash playback • Shoot video • Upload to computer • [Edit] • Produce .flv • Create Flash movie and test • Publish Flash movie • Upload .html, .swf, and all the .flv files to the server

  9. Initial steps • Shoot (?) video • Upload to computer

  10. Producing .flv • Just like images, there are different encodings for videos. • wmv, mov, avi, dv, …. • Adobe Flash CS4 Media Encoder will accept many different types and produce an .flv file (an .flv version of the same video clip) • Can set quality settings • Tradeoff: size (space on server, loading time) versus quality

  11. Start queue • Creating the .flv file takes a while…. • You can do more than one encoding at a time. • The name of each file is the same name, with filetype .flv • Use the pre-set settings OR get into more detail • Higher quality means larger files

  12. Acquire video • Find website with video (or audio) • go to http://file2hd.com/ • Enter URL of site • Check off agree to terms, filter (movies or audio) • click on get files • be patient • choose from list.

  13. Sound Two (at least) methods for incorporating sound into Flash • All coding: create Sound objects, set source of sound, play. Can manipulate volume, pan, etc. using Soundchannel. Also, register and handle events, including when sound has been loaded. • Frame: associate [start of] sound with frame.

  14. Acquire sound • Many types of sound. For coding method, need mp3 • Find on-line sound editors. • Need to know location (URL) of sound file(s).

  15. Coding method import flash.media.Sound; import flash.net.URLRequest; var urlname:String = "missle.mp3"; var requestsf:URLRequest = new URLRequest(urlname); var msound:Sound = new Sound(requestsf); // at appropriate place in the code msound.play(); This file is located in the same folder on my computer. It doesn't have to be.

  16. Frame method • File/Import/Import to Library • Select sound file(s). • Click on appropriate frame in timeline • In property panel, select Sound [file]. • You can select a set effect and/or edit the sound.

  17. Cautions • In either method, need to be aware that sound lasts certain amount of time. • Be careful about starting sound again and again (unless that is what you want)

  18. Examine source • Sound added to frame • Bo the barking dog • consider for collapsing/exploding target • Code • Play sound as event handler for button click • Play random choice of tune from [short] list. • Note: pause, pan, volume features. These require other objects.

  19. Homework • Decide on video or audio • Create or acquire video clip(s) • Create or acquire audio clips. Can use Common Library / sounds. • Keep in mind: this is a short assignment. • You can incorporate sound or video into your final project. • Think about what you want to do for your project • Check with me AND make proposal to blog.

More Related