Skip to content

Commit a00c929

Browse files
committed
Update Python-Projects
1 parent 1f6b002 commit a00c929

22 files changed

+38
-102
lines changed

Asteroids.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import turtle
2-
import math
3-
import random
1+
import turtle, math, random
42

53
wn = turtle.Screen()
64
wn.bgcolor("black")
7-
wn.title("Asteroids! by Jonathan")
5+
wn.title("Asteroids!")
86
wn.setup(800, 600)
97
wn.tracer(0)
108

Basic-Pen-Clock.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import turtle
2-
import time
1+
import turtle, time
32

43
wn = turtle.Screen()
54
wn.bgcolor("black")
65
wn.setup(width=600, height=600)
7-
wn.title("Simple Analog Clock by Jonathan")
6+
wn.title("Simple Analog Clock")
87
wn.tracer(0)
98

109
pen=turtle.Turtle()

Connect-Four.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import numpy as np
2-
import pygame
3-
import sys
4-
import math
2+
import pygame, sys, math
53

64
BLUE = (0,0,255)
75
BLACK = (0,0,0)

Deck-of-Cards-Simulation.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import turtle
2-
import time
3-
import random
1+
import turtle, time, random
42

53
wn = turtle.Screen()
64
wn.bgcolor("black")
75
wn.setup(800, 600)
8-
wn.title("Deck of Cards Simulation by Jonathan")
6+
wn.title("Deck of Cards Simulation")
97

108
pen = turtle.Turtle()
119
pen.speed(0)

Golf/get_pip.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import os.path
2-
import pkgutil
3-
import shutil
4-
import sys
5-
import struct
6-
import tempfile
1+
import os.path, pkgutil, shutil, sys, struct, tempfile
72

83
# Useful for very coarse version differentiation.
94
PY2 = sys.version_info[0] == 2

Golf/main.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import subprocess
2-
import sys
3-
import get_pip
4-
import os
1+
import subprocess, sys, get_pip, os
52

63
def install(package):
74
subprocess.call([sys.executable, "-m", "pip", "install", package])

Golf/startScreen.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import pygame
2-
import os
1+
import pygame, os, sys
32
import tkinter as tk
43
from tkinter import messagebox
5-
import sys
64

75
pygame.init()
86

Hangman/main.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import os
2-
os.system("clear")
3-
4-
import random
1+
import os, random
52
from words import words as words
63

4+
os.system("clear")
75
# Initialize
86
word = random.choice(words)
97
guess = "-" * len(word)

Lite-Brite.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
HEIGHT = 170
55

66
wn = turtle.Screen()
7-
wn.title("Lite-Brite Simulator by Jonathan")
7+
wn.title("Lite-Brite")
88
wn.bgcolor("black")
99
wn.setup(WIDTH, HEIGHT)
1010

Maze/Maze.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import turtle
2-
import math
3-
import random
1+
import turtle, math, random
42

53
wn=turtle.Screen()
64
wn.bgcolor("black")
7-
wn.title("Maze by Jonathan")
5+
wn.title("Maze")
86
wn.setup(700,700)
97
wn.tracer(0)
108

Missile Command/Missile-Command.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Import SPGL
2-
import spgl
3-
import math
4-
import random
2+
import spgl, math, random
53

64
# Create Classes
75
class MissileCommand(spgl.Game):
@@ -191,7 +189,7 @@ def tick(self):
191189
# Create Functions
192190

193191
# Initial Game setup
194-
game = MissileCommand(800, 600, "black", "Missile Command by Jonathan", 5)
192+
game = MissileCommand(800, 600, "black", "Missile Command", 5)
195193
game.score = 0
196194

197195
# Create Sprites

Missile Command/SPGL Minimum Example.py

-20
This file was deleted.

Missile Command/spgl.py

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import os
2-
import turtle
3-
import time
4-
import random
5-
import math
6-
import pickle
7-
import platform
1+
import os, turtle, time, random, math, pickle, platform
82

93
# Import message box
104
# This code is necessary for Python 2.x and 3.x compatibility
@@ -322,8 +316,8 @@ def is_collision(self, sprite_1, sprite_2):
322316
def is_circle_collision(self, sprite_1, sprite_2, radius):
323317
# Collision based on distance
324318
a=sprite_1.xcor()-sprite_2.xcor()
325-
b=sprite_1.ycor()-sprite_2.ycor()
326-
distance = math.sqrt((a**2) + (b**2))
319+
b=sprite_1.ycor()-sprite_2.ycor()
320+
distance = math.sqrt((a**2) + (b**2))
327321

328322
if distance < radius:
329323
return True

Pac-Man/enemy_class.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import pygame
2-
import random
1+
import pygame, random
32
from settings import *
43

54
vec = pygame.math.Vector2

Pong/Pong.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import turtle
2-
import winsound
1+
import turtle, winsound
32

43
wn = turtle.Screen()
5-
wn.title("PONG - By Jonathan")
4+
wn.title("PONG")
65
wn.bgcolor("black")
76
wn.setup(width=800, height=600)
87
wn.tracer(0)

Side Scrolling Shooter/Side-Scrolling-Shooter.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import sys
2-
import random
3-
import pygame
1+
import sys, random, pygame
42
from pygame import mixer
53

64
pygame.init()
@@ -11,7 +9,7 @@
119

1210
delay=0.1
1311

14-
pygame.display.set_caption("Side - Scrolling Shooter by Jonathan")
12+
pygame.display.set_caption("Side - Scrolling Shooter")
1513
clock = pygame.time.Clock()
1614

1715
WIDTH = 800

Snake.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
# Set up screen
1414
wn = turtle.Screen()
15-
wn.title("Snake by Jonathan")
15+
wn.title("Snake")
1616
wn.bgcolor("green")
1717
wn.setup(width=600, height=600)
1818
wn.tracer(0)

Space Invaders/main.py

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import turtle
2-
import os
3-
import math
4-
import random
5-
import platform
1+
import turtle, os, math, random, platform
62

73
if platform.system() == "Windows":
84
try:
@@ -12,14 +8,14 @@
128

139
wn = turtle.Screen()
1410
wn.bgcolor("black")
15-
wn.title("Space Invaders by Jonathan")
11+
wn.title("Space Invaders")
1612
wn.setup(width=800, height=800)
17-
wn.bgpic("space_invaders_background.gif")
13+
wn.bgpic("Python-Projects\Space Invaders\space_invaders_background.gif")
1814
wn.tracer(0)
1915

2016
# Register shapes
21-
wn.register_shape("invader.gif")
22-
wn.register_shape("player.gif")
17+
wn.register_shape("Python-Projects\Space Invaders\invader.gif")
18+
wn.register_shape("Python-Projects\Space Invaders\player.gif")
2319

2420
# Draw border
2521
border_pen = turtle.Turtle()
@@ -50,7 +46,7 @@
5046
# Create player
5147
player = turtle.Turtle()
5248
player.color("blue")
53-
player.shape("player.gif")
49+
player.shape("Python-Projects\Space Invaders\player.gif")
5450
player.penup()
5551
player.speed(0)
5652
player.setposition(0, -250)
@@ -73,7 +69,7 @@
7369

7470
for enemy in enemies:
7571
enemy.color("red")
76-
enemy.shape("invader.gif")
72+
enemy.shape("Python-Projects\Space Invaders\invader.gif")
7773
enemy.penup()
7874
enemy.speed(0)
7975
x = enemy_start_x + (50 * enemy_number)

Space War/main.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import random
2-
import turtle
3-
import winsound
4-
import time
1+
import random, turtle, winsound, time
52

63
turtle.speed(0)
74
turtle.bgcolor("black")

Stoplight.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import turtle
2-
import time
1+
import turtle, time
32

43
wn = turtle.Screen()
5-
wn.title("Stoplight by Jonathan")
4+
wn.title("Stoplight")
65
wn.bgcolor("black")
76

8-
9-
107
# Draw box around stoplight
118
pen = turtle.Turtle()
129
pen.color("white")

TETRIS.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import random
44

55
wn = turtle.Screen()
6-
wn.title("TETRIS by Jonathan")
6+
wn.title("TETRIS")
77
wn.bgcolor("NavajoWhite2")
88
wn.setup(width=600, height=800)
99
wn.tracer(0)

To-Do-List.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import tkinter
1+
import tkinter, pickle
22
import tkinter.messagebox
3-
import pickle
43

54
root = tkinter.Tk()
65
root.title("To-Do List by Jonathan")

0 commit comments

Comments
 (0)