Skip to content

Pokemon Pong#5

Open
tasandy wants to merge 64 commits intosd16fall:masterfrom
tasandy:master
Open

Pokemon Pong#5
tasandy wants to merge 64 commits intosd16fall:masterfrom
tasandy:master

Conversation

@tasandy
Copy link

@tasandy tasandy commented Nov 4, 2016

No description provided.

This file is not a good project README.
Replace the contents of this file before you submit your project. No newline at end of file
Instructions:
Prevent the ball from hitting the wall on your side by moving Pikachu and using it to bounce the ball back. If the ball hits the wall on your side, your opponent gets a point. The first Pikachu/player to accumulate five points will win the game!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Y'all don't mention quite how to start the program/what the program's requirements are. (mentioning how to run the program, e.g. something as simple as saying that once python + pygame are installed you can call python pokemon_pong.py, would be good)

self.ball.move_ip(self.dx, self.dy)

def collision_wall(self):
#instances if ball hits a wall

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a gameplay standpoint, it might be nice to either briefly pause, or wait for user response, to continue the game (so that after losing a point, the next one doesn't immediately fire off).

self.ball.center = (600,600)
self.dx = -1*self.dx
elif self.rect.left <= 0:
p2_score()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend referencing objects, or calling the objects' functions (ask me in-person if this is unclear), rather than using global functions and variables.

self.pikac.centery = window_height / 2.0 #setting starting location
self.pikac.right = window_width

def move_pika2(self,key):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You seem like you were just about to make this generalizable -- move_pika2 is basically the same as the parent class function move_pika, just checking for different keys!

pika.pikac.centery = window_height / 2.0
pika2.pikac.centery = window_height / 2.0

'''main'''

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify what the "main" functionality is, I recommend putting this in an if statement -- so, something like
if __name__ == "__main__":

pongball.set_ball()
pongball.collision_wall()
#makes the ball bounce in another direction if it collides with a pikachu
if pygame.sprite.collide_rect(pongball, pika) or pygame.sprite.collide_rect(pongball, pika2):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice to check this in a function or something, akin to pongball.collision_wall(), but I understand just checking for collision rectangles here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments