AP Computer Science Java
This is a resource for teachers and students for AP Computer Science A. This curriculum follows the newly revised 2019 College Board curriculum, which consists of 10 units. In addition, the emphasis is to help students learn how to code 2D arcade games using Processing. In particular, students will work on writing a full platformer game like Super Mario from scratch.
Lecture Notes
The following powerpoint lecture slides are adapted from the book Building Java Programs: A Back to Basics Approach by Stuart Reges and Marty Stepp as well as the Runestone's CS Awesome curriculum.
Unit 1: Primitive Types
Unit 2: Using Objects
- Objects: Instances of Classes (PPT, PDF)
- (OPTIONAL) User Input with Scanner (PPT, PDF)
- Methods (PPT, PDF)
- Strings (PPT, PDF)
- Math Class And Wrapper Classes (PPT, PDF)
Unit 3: Boolean Expressions and if statements
- Boolean Expressions and if-else-else if statements (PPT, PDF)
- Compound Boolean Expressions and Comparing Objects (PPT, PDF)
Unit 4: Iterations
(*Optional*)Computer Animation with Processing
- The Basics(PPT, PDF)
- Working with Images(PPT, PDF)
- Controlling an Image with the Keyboard Lab(ZIP)
- Collision Detection(PPT, PDF)
- Tank Collects Coins Lab(Processing)(ZIP)
- Simple Platformer Game(Mario)(PPT, PDF)
- Simple Platformer(Processing, requires Arraylists)(ZIP)
Unit 5: Writing Classes
- Anatomy of a Java Class (PPT, PDF)
- Writing Methods (PPT, PDF)
- Variables, Scope and Semantics (PPT, PDF)
Unit 6: Arrays
- Introduction to Arrays(PPT, PDF)
- Largest Ball Object Lab(ZIP)
- For Each and Array Algorithms(PPT, PDF)
Unit 7: ArrayLists
Unit 8: 2D Arrays
Unit 9: Inheritance
Unit 10: Recursion
Preparing for the AP Exam
How to Write a Platformer Game in Java
In this short video series course, we will learn how to write a platformer (or side-scrolling) game like Super Mario. We will write this game from scratch with very basic algebra without relying on any physics engine! Here's a short 2-minute preview of the game. The entire Youtube playlist for this curriculum can be found here. The webpage including labs for the curriculum is here.
Coding Challenges
A series of coding challenges. Most are mathematical in focus and require some trignometry. The distribution code is included and provides a template for completing the code. Processing is used for the animation challenges.
- Ball Bounces Off Angles This animation challenge simulates a ball drop on an uneven ground. (Demo, Tutorial, Distribution Code) Solutions can be found here.
- Inverse Kinematics: Pulling A String This animation challenge simulates pulling a string with the mouse. (Demo, Tutorial, Distribution Code)
- Billiard Ball Collisions This animation challenge simulates collisions of billiard balls in 2D. (Tutorial, Distribution Code) Solutions to the two-ball case and the many-ball case with the glitch fix.