Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming games Reflection Bouncing things, Memory Server-side: Survey. ActionScript 2 examples. Homework: Finish Video or Audio. Post proposal for your.

Similar presentations


Presentation on theme: "Programming games Reflection Bouncing things, Memory Server-side: Survey. ActionScript 2 examples. Homework: Finish Video or Audio. Post proposal for your."— Presentation transcript:

1 Programming games Reflection Bouncing things, Memory Server-side: Survey. ActionScript 2 examples. Homework: Finish Video or Audio. Post proposal for your game.

2 Sound volume and pan SoundTransform object –property of SoundChannel object that is assigned playing of a Sound object. Demonstrate NOTE: what is done here in functions that respond to button events could be done anywhere!

3 Reflection Check out if you can think about the applications and summarize what you/your code does (events, instances on Stage,etc.) coin flip: button (from Common Libraries), set up CLICK event, function uses Math.random(), makes only one of two movie clip instances visible rock-paper-scissors ? Bo ? cannonball ? video or audio ?

4 Demonstrate Bouncing things Memory Survey –Ballot showed previously saved data on client computer. This survey accumulates all 'votes' in one place: on the server Video clips in database

5 Bouncing Things.fla file has import morestuff.* The morestuff package is a folder that contains files for each of these classes: –Canvass –Stuff –Ball –Star –Rect Note: Star, Ball and Rect each are subClasses of Stuff

6 General idea Creating and moving stars, circles, rectangles around involves –Code in common –Code distinct for the 3 things (types of stuff…) How to do this? –ANSWER: Inheritance Ball, Star, Rect are each subclasses of the Stuff class

7 Common coding Creation –Getting information from the mouse actions to determine width, height, direction of motion –Choosing random color Movement –Setting up Timer for moving Checking on collision with walls

8 Distinct coding Details of creation Note: Star and Rect rotate random amount

9 Ball.as package morestuff{ import flash.geom.*; import flash.events.*; import flash.display.*; import flash.utils.*; public class Ball extends Stuff { //subclass has no properties public function Ball(size:int, pt1:Point, pt2:Point ) { this.width = size; this.height = size; super(size,pt1,pt2); }

10 Memory/Concentration memorygame.fla Memory package: contains Card class In.fla file, card (back of card) in Library, is linked to Card class

11 Memory/Concentration Requires a pause Use Timer object

12 Server-side Html files and swf files are downloaded from server to client (your) computer and executed How to store information that lasts? Answer: user server-side programs and files or databases AKA middleware Example: php Database: MySql

13 Presidential Survey Flash to php to file back to php back to Flash Uses URLRequest and URLLoader objects

14 ActionScript 2.0 examples Project for this course must be ActionScript 3.0!! But…you may get ideas from the old examples –Origami and/or instructions in general demonstrate –other ActionScript 2.0 had code in buttons and movieclips. Must change to code in frames with use of addEventListener. ActionScript 2.0 had Var name for text fields. Must change to instance name with use of result.text

15 Coding for advance button advbtn.addEventListener(MouseEvent.CLICK, advance); function advance(ev) { goToAndPlay(nextframe); } In the last frame of each animated sequence, reset nextframe variable to be the start of the next sequence: nextframe = "Turnover";

16 Jigsaw If you do this application, initial version has explicit check button. What needs to be changed to make checking automatic? remove check button Remove code addEventListener setting up event handling for the button DO NOT remove the checkit method Do add call to checkit to stopdragging method Also need to make a change to mixup. Didn't need this when checkit called from.fla file

17 Saving work Save often!!!! Also, need to coordinate saving –the.fla file and –publishing to produce.html and.swf file Flash does not do this for you!!!!!!

18 Location of files when creating packages In Publish/Settings, browse to identify folder CONTAINING the package folder This appears to need to be at top of drive The.fla file needs to be in the same drive –????

19 Publish/Settings Create a folder at top of drive as3 In Publish/Settings, browse to this folder –C:\as3 In as3, create a folder called jigsaw or whatever the package name is. In C:\as3\jigsaw –Put the file Piece.as –General case: put files for each class.

20 Class names The convention is that class names start with a capital letter Consistency is required –In ActionScript and in Publish/Settings In this (and other things) find and replace is your friend…

21 Notice in Jigsaw Piece(s) rotate around transformation point The transformation point is (should be) midway horizontally and vertically even if this is not on/in the piece

22 Homework Projects Past due –Complete your versions of rps, Bo –Complete first stage and rest of cannonball due next class: Video or Audio Due 2 weeks: Original project –(can be enhancement of sample projects. Need to change & add to programming.) –Can be jigsaw or bouncing stuff –Can be more elaborate video or audio project ???? –MAKE PROPOSAL to Flash proposal moodle forum.


Download ppt "Programming games Reflection Bouncing things, Memory Server-side: Survey. ActionScript 2 examples. Homework: Finish Video or Audio. Post proposal for your."

Similar presentations


Ads by Google