0% found this document useful (0 votes)
30 views8 pages

A1 Instructions Guided

Uploaded by

darkmail6969
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views8 pages

A1 Instructions Guided

Uploaded by

darkmail6969
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

CSCI 1105 ASSIGNMENT 1

Introduction

In this assignment, you’ll use Processing to create your own


version of the 1970s computer game “Pong”! If you’re not
familiar with Pong, it’s a simple 2D game that simulates the
game of table tennis. It usually looks something like this:

Please note: you must complete the assignment that has


been provided to you by YOUR INSTRUCTOR’s Brightspace
page. Each instructor’s section may have different
instructions, and different requirements!
CSCI 1105 ASSIGNMENT 1
Objective

Player 1 Paddle

Player 1 Score Player 2 Score

Ball

Player 2 Paddle

Pong is a two-player game where each player controls one of


the “paddles” on either side of the screen. Each player’s
objective is to hit the “ball” towards their opponent. If you hit
the ball and your opponent does not hit it back (it hits their
side of the screen), then you get a point!

When either player reaches 11 points, that player wins!


CSCI 1105 ASSIGNMENT 1
Requirements

To get full points for this assignment, your solution must


satisfy the following requirements:

1. You must be able to control the movement of at least one of


the paddles using either the keyboard, the mouse, or both
2. You must detect when the ball hits a paddle, and it must
change direction when it does
3. You must keep track of a “score”, and the program must end
once a certain score is obtained

Beyond these requirements, you can add any other


mechanics and behaviour that you want – feel free to get
creative!

If you are not sure if your program satisfies the


requirements, please contact Brent at
([email protected]). He will happily help you out!

IMPORTANT NOTE:
If your program crashes or fails to run in the first place,
you will get a VERY LOW GRADE!
It’s usually better to have a solution that works but does
not satisfy all requirements than it is to have a solution
that might theoretically fulfill the requirements, but
crashes. When in doubt, please ask! Just email Brent –
he’s happy to chat!
CSCI 1105 ASSIGNMENT 1
Requirement 1: Paddle Movement

The first requirement is that your program must allow you to


control one (or more) of the paddles with either the keyboard
or the mouse.

In our implementation of Pong, these are the controls we


used. Yours can be different!

• Player 1 uses the W key to move up, and


the S key to move down
• Player 2 uses the O key to move up, and
the L key to move down

W O

S L
CSCI 1105 ASSIGNMENT 1
Requirement 2a: Ball Movement

The second requirement is probably the hardest to implement.


You must detect when the ball hits a paddle and reverse the
direction of the ball when it does.

But first, we need to get the ball moving!

Usually, the ball should start in the center of the screen and pick a
random direction to start moving.

How the ball starts moving is up to you – it doesn’t have to be


fancy, so start simple! Ours starts moving like this:

Give the ball a random


up/down velocity

Pick a random direction to


start moving in
For example, +5 or -5 on
the x-axis
CSCI 1105 ASSIGNMENT 1
Requirement 2b: Ball Collisions

Here’s the tricky part…

When the ball collides with one of the paddles, it must


bounce back in the other direction. But how do we know
when it collides?

To keep things simple, we suggest treating the “ball” as a


single point, rather than a circle. This would make things
easier, but it’s not a requirement. The “ball” can be any
shape!

When a collision is detected, you should reverse the X-


velocity of the ball (Hint: multiply velocity by -1)

Circle Colliding Circle Not Colliding

Point Colliding Point Not Colliding


CSCI 1105 ASSIGNMENT 1
Requirement 3: Score
The last requirement is to implement a scoring system.

When the ball hits the left edge of the screen, player 2 should
get one point.

When the ball hits the right edge of the screen, player 1 should
get one point.

The first player to obtain a certain number of points wins the


game! You can decide how many points that is, but Pong is
typically first to 11 points. When someone wins, you can just
stop the game or close the game window.

You are welcome to modify how the score works. As long as


there is a score and somebody can win the game, that’s fine!

Player 1 Score Player 2 Score


CSCI 1105 ASSIGNMENT 1
Rubric Notes

The rubric that will be used to grade your assignment is in


Brightspace, right alongside this instructions document.

Something important to note is that we will not be super harsh


about the requirements. If you can make a case for technically
satisfying the provided requirements (and the implementation is
proper and functional), you will probably get the points. We
want you to have fun with this assignment, so feel free to go off
the rails a little bit. Read through the rubric to know what you
should be aiming for to get the grade you want!

When in doubt, ASK! Brent is always happy to chat, or to look


over your assignment and provide feedback before you submit
([email protected]).

Remember: There is also a required write-up portion of this


assignment you need to do. It can be found in Brightspace, next
to this instructions document.

What do you need to submit?


- All Processing files for your assignment (.PDE files)
- Your “readme” document, in PDF or DOCX format

You might also like