So...the next task is to design and make a ping pong game using actionscript 3.0 in flash. I've made the bats (or paddles) move vertically up the screen using the following code.
function myEventResponse(myEventObject):void {
trace("keyboard event " + myEventObject.keyCode);
if (myEventObject.keyCode==38) {
bat_1.y = bat_1.y - 20;
}
if (myEventObject.keyCode==40) {
bat_1.y = bat_1.y + 20;
}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, myEventResponse);
stop();
The next stages are to:
Create a "ball" that moves across the screen
Make the ball "bounce" of the three walls (top, bottom and side furthest from bat)
Make the "ball" bounce off the "bat"
Make the game end if the "ball" goes past the "bat"
Set up some means of determining a “score” e.g. time or number of bounces?
Some websites I will be looking at to help me will be:
http://www.senocular.com/flash/tutorials/as3withflashcs3/
http://www.flashperfection.com/tutorials/
Mouse-Events-Actionscript-3-in-Flash-cs3-Tutorial-89504.html
http://www.adobe.com/designcenter/video_workshop/
http://www.flashandmath.com/
Very good and extensive list of links:
http://www.franto.com/blog2/collected-links-to-actionscript-30-examples
No comments:
Post a Comment