Spring 2007 CSC 108
Introduction to Programming
Dr. Yue-Ling Wong
 

Due: April 25, 2007 (Wed) 11:55PM sharp of Blackboard's time.

  • Completely COMPLETED the file UPLOAD to Blackboard.
  • NOT just having the files sitting on your computer
  • Don't try to start to upload only at 11:54PM. Start upload early.

LATE POLICY:
25% reduction in project grade: if uploaded within April 25 11:55 PM - April 26 11:55PM
50% reduction in project grade: if uploaded within April 26 11:55 PM - April 27 11:55PM
75% reduction in project grade: if uploaded within April 27 11:55 PM - April 28 11:55PM
ZERO: if not uploaded before April 28 11:55PM

General Requirements for Project and Programming Assignments

Coding Style

  1. Line up the pairing curly braces
  2. Don't forget end-of-statement semi-colon
  3. No extra semi-colon
  4. No unnecessary semi-colon or curly braces
  5. Declare all timeline and global variables at the top of the script
  6. Indentation
  7. Spaces:
    • No space between a function name and the parenthesis after it
    • One space between the keyword if and the parenthesis after it
    • One space between the keyword for and the parenthesis after it
    • No space before ++ and --

Syntax

  1. Use the new Actionscript 2.0 syntax to declare variables and specify data type. Don't forget to specify return type for functions and methods, and the data type for the parameter.

Best Practices

  1. Document your code using comments. Provide a brief description for each custom-defined function, class property and method using comments.
  2. Organize code using functions, one task per function
  3. NO hard-coding values; define variables or constants. If the value does not change during the course of the program, declare a variable using the naming convention for constants. (Note: Actionscript does not let you custom-define constants.)
  4. NO hard-coding _root.variable and _root.movieclipInstance in class definitions. Make use of parameter passing.
  5. Scope of variables:
    Choose proper scope for variables. If a variable is only used within a function, define it as a local variable, not a timeline variable. Avoid using global variables.
  6. Use the naming conventions that discussed in the lecture for variables, functions, class name, class properties and methods.
  7. Efficiency:
    • No unnecessary parameters, variables, functions, class properties and class methods
    • No code duplication
    • No unnecessary statements within onEnterFrame

General Practices for Working with Flash

  1. Use a separate layer (topmost layer) for frame labels. Name it "label".
  2. Use a separate layer for frame scripts. Name it "action". All frame scripts should be stored in this "action" layer only. It should be right below the "label" layer. If there is no label layer, then the "action" layer will be the topmost layer.
  3. Code centralization: place all the function definitions and code in frame 1 of the "action" layer on the main timeline, if possible.
  4. Movieclip instance name: start with "mc_"

 

Other Consideration

  • Attention to details.

Final Project Description
About the game programming project:

  1. The completed project does not have to be a full-blown game. Actually, it does not have to be a "game"--it is a programming project. Making it a game project may make the project more fun to program, but it does not have to be a game. The key criteria are problem-solving and programming challenges.
     
  2. The project will be graded based on (i) the programming challenges of the project, (ii) how you tackle the challenges, (iii) the extent of completed work, and (iv) use of best practices and good coding styles.
    Thus,
    • Choosing an extremely challenging project but not being able to get any part of your code working will mean a very low grade.
    • Completing an easy project does not mean a high grade either.
       
  3. What I mean "programming challenges" of the project are the analytical thinking and problem-solving required for the programming task, not just direct copying and pasting the code from the existing labs and homeworks.
     
  4. Programming criteria:
    1. Have to use OOP (Object-oirented Programming). This means you need to create classes and objects. Even better if you can apply inheritance and polymorphism.
       
    2. Have to use the keyword var to declare variables, and include data types for all variable declaration and function definition.
       
    3. Have to use good coding styles--you know... the semi-colon, indentation, space or no space,...
       
    4. Best practices in coding and working with Flash
       
  5. Your project can be based on any of the labs and extent it. But again, it needs to have some new programming challenges and problem-solving, not just copying and pasting the code from the labs with simple modifications. "New" here means something that has not already been done exactly in the labs or programming assignments in this course.
     
    For examples:
    • Extending the tic-tac-toe lab:
      • Just turning it into a Connect Four is NOT what I have in mind.
      • But what you may think about is to add the feature of the computer player that has some levels of artificial intelligence to prevent the player from winning or actually try to win.
         
    • Extending the 3d fly-through lab: what you may think about:
      • add code to turn it into a 3d shooting game so that pressing a key makes a movieclip instance representing a bullet fly forward into the 3d space, and also add code to do 3d collision detection between the bullet and the target (this won't be just hitTest() anymore, but it is not as hard as you may think)
      • combine 3d fly-through with the 2d side-scrolling platform game (similar to the concepts in the soon-to-be-released Mario game for Wii, called Super Paper Mario; look up on the Web to see how it looks with the 3d and 2d are combined in this game)
      • turn it into a racing game by adding timer, opponents, traps, hoops, and even add collectible items.
        This is a situation where OOP with inheritance and polymorphism works well.
         
    • Extending the platform game lab:
      • Just adding levels with different platform and item design is NOT what I have in mind.
      • But what you may think about:
        • add different characters that can do similar things as the hero (such as walk and jump) and different things (benefit or damage) to the hero
          This is a situation where OOP with inheritance and polymorphism works well.
        • add more than 2 designs of platform, and make each shorter than the stage width, so that at any moment, the platform you see on stage is made up with 2 different designs.
          This will change the code you wrap (or "recycle") the two platforms in the endless scrolling in the lab. But you can use the similar thought-process to analyze the different scenarios and figure out the code.
           
  6. Possible project ideas or games that you can draw ideas from:
    • Show sorting a deck of cards
      You have learned three sorting algorithms. You can trace out the sorting process of an array in quizzes. So, now, how about programming to show the sorting algorithms visually using a deck of cards?
       
    • Breakout
      This can be based on the Pong game. The OOP will work well with creating those many bricks.
       
    • Study one of the interesting examples in the textbook Actionscript Animation, for examples, springing (Chapter 8), bouncing off angles (Chapter 10), billiard ball physics (Chapter 11), 3d fills (Chapter 16), inverse kinematics (Chapter 14)
      The Flash files of the textbook are available from the publisher's Web site.
       
    • Battleship
      You will need to use 2d arrays.
       
    • Pac-man
       
    • Tetris
       
    • The old arcade of Donkey Kong
      Very much like the platform game lab, but you need to have barrels rolling down onto each platform level.
       
    • Space Invader
       
    • Frogger
       
    • Any kind of chess
       
    • The early versions of Zelda games that use the top-down view, have exit and entrance from one room to another
      (A good situation to apply OOP: Each room is an object instantiated from the Room class.)
       
    • Tic-tac-toe with a conputer player (see above suggestions about extending the labs)
       
    • 3d first-person shooting game (see suggestions above about extending the labs)
       
    • 3d first-person racing game (see suggestions above about extending the labs)
       
    • Super Paper Mario (see suggestions above about extending the labs)
       
  7. Choose a project that you truly want to program. You will have more fun programming it and will get more satisfaction at the end. Don't choose something only because you think it will be easy. No matter how easy or how difficult the project is, there will be moments that you (anyone too, not just you) get stuck due to logical errors or silly typos. These moments will be especially frustrating if you don't really like the project.
     
    If you have project ideas that you are interested in but don't know how to go about programming it now, don't drop your ideas--one of the purposes of doing the project is to learn something new anyway. Talk to me. I can tell you if it is doable as a class project and I can give you pointers. Besides, the project does not have to be a "full-blown" game. I will give you feedback about the key programming challenges you need to have tackled by the time you turn in the project.
     
    That's why we will have individual meetings to discuss and decide your project idea. Have several ideas ready when you come talk to me.
     
Copyright © Dr.Yue-Ling Wong, Wake Forest University.