Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acord-Games: Bring Pong into Python-Games #37

Closed
Gizmotronn opened this issue Sep 16, 2019 · 5 comments
Closed

Acord-Games: Bring Pong into Python-Games #37

Gizmotronn opened this issue Sep 16, 2019 · 5 comments

Comments

@Gizmotronn
Copy link
Contributor

As title says

@Gizmotronn
Copy link
Contributor Author

Current code for the pong game (not using pygame):

# Simple Pong Game for Beginners
# Youtube: https://www.youtube.com/watch?v=C6jJg9Zan7w
# Part of Stellarios by ACORD - http://acord.tech/stellarios

import turtle # module that lets you do basic graphics in Python

wn = turtle.Screen() # creates a variable called "wn" that is the game windows
wn.title("Pong by ACORD") # sets the title that would appear on the window
wn.bgcolor("black") # sets the game window bg color
wn.setup(width=800, height=600) # sets the game window size
wn.tracer(0) # stops the window from updating

# Paddle A
paddle_a = turtle.Turtle() # creates a game object. "turtle" = module, Turtle = class
paddle_a.speed(0) # Speed of animation - maximum possible speed
paddle_a.shape("square") # default - 20px*20px
paddle_a.color("white")
paddle_a.shapesize(stretch_wid=5, stretch_len=1) # Stretches the width and length of "paddle_a"
paddle_a.penup()
paddle_a.goto(-350, 0) # Sets the initial coordinates for the Paddle_A


# Paddle B
paddle_b = turtle.Turtle() # creates a game object. "turtle" = module, Turtle = class
paddle_b.speed(0) # Speed of animation - maximum possible speed
paddle_b.shape("square") # default - 20px*20px
paddle_b.color("white")
paddle_b.shapesize(stretch_wid=5, stretch_len=1) # Stretches the width and length of "paddle_a"
paddle_b.penup()
paddle_b.goto(350, 0) # Sets the initial coordinates for the Paddle_A

# Ball
ball = turtle.Turtle() # creates a game object. "turtle" = module, Turtle = class
ball.speed(0) # Speed of animation - maximum possible speed
ball.shape("square") # default - 20px*20px
ball.color("white")
ball.penup()
ball.goto(0, 0) # Sets the initial coordinates for the Paddle_A

# Main Game Loop
while True:
    wn.update() # every time the loop runs, it updates the screen

As you can see, we use turtle to draw the board in the game. This is building our development and documentation skills, as well as making games that can be played on our Raspberry-pi & Arduino enabled devices: A0-D2, OSR, etc as part of S2-RD/Stellarios/ACORD

@Gizmotronn
Copy link
Contributor Author

This is currently on the https://github.com/irisdroidology/python-learning repository, but we need to move it to https://github.com/acord-robotics/stellarios/tree/acord-games

@Gizmotronn Gizmotronn mentioned this issue Sep 17, 2019
@Gizmotronn
Copy link
Contributor Author

#38

@mfaridn03
Copy link
Contributor

I am able to work on this

@Gizmotronn
Copy link
Contributor Author

Also: #46

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

No branches or pull requests

4 participants