West Ranch High School

Skip to main content
Main Menu Toggle


Upcoming Assignments RSS Feed

No upcoming assignments.

Past Assignments


Pong Game Assignment (Core) Checkpoint B:
  • Changing angle when bouncing off of the paddle
    • Reposition the reference point of the paddle to the center of the paddle
    • When you hitTest the paddle, compare the y coordinates of the ball and the paddle and modify the value of yDirection. The num value in the following code line will reduce the amount of angle created. Replace num with a value that creates an appropriate amount of bounce.
  • Scores: You will need to variables to track the scores and two dynamic text boxes to display the score values.
  • Reset after score: Each time a point is scored, you will need to update the score and reset the location of the ball to an appropriate starting location. The ball can either start moving immediately or wait for a keypress to begin again.
  • EndGame: How many points are needed to win? Check the scores each frame to see if you have a winner. What is going to happen when the game ends?. The game should stop and you could display a message indicating the winner


Pong Game Assignment (Core) Checkpoint A: Create a version of the classic arcade game Pong. Core elements include moving ball, moving paddles, hitTestObject for bouncing ball off of paddles and walls, score keeping and display, restarting the game after goal, end game. (35 Points)


  • Create objects for the paddles and the ball. Be sure to give them unique instance names.
  • Moving the paddles: Use the Keyboard Control Code to move the paddles up and down
  • Bouncing off of the paddle: To make the ball change direction try this approach:
    • Create a variable called xDirection and assign it the value 1
      var xDirection=1;
    • Make the ball movement line use the xDirection variable
      ball.x += 5 * xDirection
    • When you hitTest the paddle, change xDirection to -1
  • Moving the ball on an angle requires change in the y value of the ball. Use the same approach as with x.
  • Bouncing off of the borders of the play area: This can be done by creating walls and using the same approach as the paddles. Top and bottom walls will change the yDirection. Left and right walls (behind the paddles) will change the xDirection.


Game Review

Write a review of a game using the concepts in Costikyan's article. The game can be physical or digital. Describe the game. Address how and how well the game fulfills each of the components of Costikyan's definition of a game. Turn in the game review through Google Classroom.

Scoring Rubric

  • 5: All components discussed with insightful commentary on how and how well the components were met
  • 4: All components discussed with commentary on how and how well the components were met
  • 3: All components discussed with commentary on how or how well the components were met
  • 2: At least 3 components discussed
  • 1: Fewer than 3 components discussed


"Find the Target" game: This game is similar to the "snake" type game but without the growing tail component. Modify the file from the Keyboard Control Exercise to add a "target" object that the controlled symbol has to hit. Include a text box to display a score. Start with 1000 points in the score box. Each frame, subtract a point from the score. Use hit testing to determine if the symbol has hit the target. When the hitTestObject occurs, add points to the displayed score. When the target is hit, move the target to a randomly selected location on the stage. Implement an end game for losing when you run out of points and for winning at a specific point level. (20 points)
Notes on scorekeeping and endgame
  • Scorekeeping Variables- in order to keep track of information like a score, we need to create a variable to hold the data. The drag and match project created a variable called "hits" to do this. Look at that code as a reference. You can choose the name of your variable (score, points, etc.)
  • Display the score- Use a dynamic text box to display the score. Change the "anti-alias" setting for the text box to "Use Device Fonts". A line like scorebox.text = score placed in your ENTER_FRAME function will update the score every frame. (remember that the function called by ENTER_FRAME is your repeating loop that happens every frame)
  • Changing the score- score=score+10 is a line that will add 10 points to the score variable. It can also be written: score+=10score++ and score-- are shortcuts for adding or subtracting one from a variable. You need to determine the correct location in your code to change the score.
  • End Game- To end the game you need to test the value of score (or whatever you named it). This will use and "if" statement such as if(score <= 0) { } to determine if the value of score has dropped to zero (or less). Inside the braces, you can add code to display a message in a textbox. You can stop the game by removing the ENTER_FRAME event listener. Copy the addEventListener line for ENTER_FRAME and paste it inside the braces for your end game if statement. Change addEventListener to removeEventListener.


Hit Test Object Tutorial-Use the link below for instructions on making an object move on its own and detecting collisions with other objects. The images are not showing in the tutorial so use the following guidelines for the objects. The rectangle is positioned on the right side of the stage about 100 pixels wide and fill most of the height of the stage. The circle is positioned on the left side of the stage.

You do not need to do the Multiple Object Hit Test part of the tutorial.
You can stop after Step 5-Test Movie.

After completing the tutorial, fill out the worksheet in Google Classroom



  • Random Numbers Tutorial: http://www.ilike2flash.com/2009/08/generate-random-numbers-in-actionscript.html
  • Random Numbers Exercise: Create a new animation file with one button and three text boxes. When you click the button:
    • the first box should show a random number from 1 to 100
    • the second box should show a random number from 20 to 25
    • the third box should show a random number from -15 to +20. (10 points)


Keyboard Control: Follow the tutorial linked below. When you finish part 1, follow the link at the bottom of the page for part 2 that will give you a better approach for Keyboard Control. We will use the part 2 approach for all keyboard related projects.

Keyboard Control Tutorial


Drag and Drop Tutorial: http://edutechwiki.unige.ch/en/Flash_drag_and_drop_tutorial

Complete through part 4: Drag and match learning application - dumb version. You can use whatever images you want in part 4. Pay attention to the textField use in part 3. When you have completed the tutorial, complete the worksheet in Google Classroom


Syllabus Verification Form - This form must be returned with parent signature. 20 points by due date. 15 points if late


Interactive Objects


Complete the "I Have No Words" Assignment in Google Classroom