1 / 7

Programming Games

Programming Games. Show your rock-paper-scissors. Demonstrate bouncing ball. Demonstrate and examine Bo the dog . Homework: Modify Bo to make your own. Time event. Flash has Timer objects. You/your code needs to do 3 things:

cecile
Télécharger la présentation

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 Show your rock-paper-scissors. Demonstrate bouncing ball. Demonstrate and examine Bo the dog. Homework: Modify Bo to make your own.

  2. Time event • Flash has Timer objects. • You/your code needs to do 3 things: • create the Timer object, setting the time and, optionally, the number of events • var btimer = new Timer(100); • var limitedtimer = new Timer(1000,3); • set up the event handling • btimer.addEventListener(TimerEvent.TIMER,movb) • start the timer • btimer.start();

  3. Collisions • There are no balls, dogs, walls, etc. • Collisions are detected by doing calculations and, as appropriate, changing variables. • Bouncing ball example: if (rightwall.hitTestPoint(ball.x,ball.y, true)) { xd=-1; }

  4. Bouncing ball • ball as movie clip instance on the Stage along with 4 instances of the movie clip symbol wall each with its own instance name! • Timer object: set up event to happen every interval of time and invoke function • that function moves the ball in x and y specified amounts and checks for hitting walls. When that happens, the appropriate deltas are changed. Demonstrate. Skim tutorial.

  5. Bo the barking dog • The movie clip symbol has several frames representing moving legs… • The whole symbol is moved within a virtual box. Instead of bouncing, Bo disappears and reappears at the other side. • This is combination of cel and computed animation. Demonstrate. Examine code.

  6. Assignment • Read Bouncing Ball tutorial and Bo the dog tutorial. • Download source for Bo the dog. • Change • all the graphics • something in the code • make dog/whatever speed up and slow down • add a button to change speed • add a slider to change speed. Look at examples, use Help. • change to bounce instead of exiting one side, etc. • ?

  7. Other applications • If you complete this, you can look at other Bo the Barking Dog programs • source code • tutorial/notes

More Related