Download presentation
Presentation is loading. Please wait.
Published byEgbert Wright Modified over 9 years ago
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.