Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
16b6aa2
Check it out!
Colvchap Feb 23, 2017
7204bfa
Project Proposal for Sean Szymanski and Colvin Chapman
seanszy Feb 27, 2017
9f26f10
Rectangle Game
seanszy Mar 2, 2017
6baec2a
Pygame Format with minimal function
seanszy Mar 2, 2017
3be3fe0
Example Pygame
seanszy Mar 2, 2017
a71ea8f
World
seanszy Mar 3, 2017
a719eda
updated speed
Colvchap Mar 3, 2017
f5e0393
updated speed
Colvchap Mar 3, 2017
bf3cb41
fixing merges
Colvchap Mar 3, 2017
98f7bfe
Sean's
seanszy Mar 3, 2017
887ddf5
Merge branch 'master' of https://github.com/seanszy/InteractiveProgra…
seanszy Mar 3, 2017
70fb301
working condition with objects
Colvchap Mar 3, 2017
400b3d3
ready for collisions and World
Colvchap Mar 3, 2017
5795de1
Deleted
seanszy Mar 5, 2017
7891a1d
Inventory Added
seanszy Mar 5, 2017
870f0bb
No Infinite Jump
seanszy Mar 5, 2017
991d421
No infinite Jump
seanszy Mar 5, 2017
b7c86b9
change to edit field
Colvchap Mar 5, 2017
11afe18
Merge branch 'master' of https://github.com/seanszy/InteractiveProgra…
Colvchap Mar 5, 2017
4e55ec9
A
seanszy Mar 5, 2017
ca11a18
Merge branch 'master' of https://github.com/seanszy/InteractiveProgra…
seanszy Mar 5, 2017
8f35833
Mouse
seanszy Mar 5, 2017
2d95083
Fixed Physics
seanszy Mar 5, 2017
001ec85
ugh
Colvchap Mar 5, 2017
04866bb
Merge branch 'master' of https://github.com/seanszy/InteractiveProgra…
Colvchap Mar 5, 2017
fa2cf79
not working
Colvchap Mar 5, 2017
ab5f909
probs
Colvchap Mar 5, 2017
139e038
changes
seanszy Mar 5, 2017
34b9fa5
Merge branch 'master' of https://github.com/seanszy/InteractiveProgra…
seanszy Mar 5, 2017
e69454d
Matrix
seanszy Mar 6, 2017
184cffb
index tracker
Colvchap Mar 6, 2017
01f1160
Block Matrix
seanszy Mar 6, 2017
1c43b62
WORKING :)'
seanszy Mar 6, 2017
a6b2d46
Print From Matrix
seanszy Mar 6, 2017
ebfd4c8
WORKING FIELD MATRIX PRINT
seanszy Mar 6, 2017
f089ae2
inventory update
Colvchap Mar 6, 2017
2c139be
Merge Resolved
seanszy Mar 6, 2017
0967113
collision update
Colvchap Mar 6, 2017
0267041
Merge branch 'master' of https://github.com/seanszy/InteractiveProgra…
Colvchap Mar 6, 2017
12bb376
RANGE
seanszy Mar 6, 2017
dcc8b9e
Bottom collision
seanszy Mar 6, 2017
5273e48
refresh
Colvchap Mar 7, 2017
1ab2059
refresh
Colvchap Mar 7, 2017
e14fda5
Mouse
seanszy Mar 7, 2017
2dca810
MOuse
seanszy Mar 7, 2017
40d654e
pulling
Colvchap Mar 7, 2017
1ad7b2d
hi
Colvchap Mar 7, 2017
c30c2ea
Collision
seanszy Mar 7, 2017
ec17b3e
ahhhh
Colvchap Mar 7, 2017
acd487e
Bottom
seanszy Mar 7, 2017
1df2065
TOP
seanszy Mar 7, 2017
e107153
h
Colvchap Mar 7, 2017
b296038
Merge branch 'master' of https://github.com/seanszy/InteractiveProgra…
Colvchap Mar 7, 2017
0b2171d
Left
seanszy Mar 7, 2017
ff668da
good
Colvchap Mar 7, 2017
494837c
Left
seanszy Mar 7, 2017
d9452d7
Left Collision
seanszy Mar 7, 2017
4944bd4
ug
Colvchap Mar 7, 2017
cc0417a
Merge branch 'master' of https://github.com/seanszy/InteractiveProgra…
Colvchap Mar 7, 2017
3a9e0f3
great
Colvchap Mar 7, 2017
a6a3e4c
BOttom Coll
seanszy Mar 7, 2017
f114166
Merge branch 'master' of https://github.com/seanszy/InteractiveProgra…
seanszy Mar 7, 2017
9cc3f0f
broken
seanszy Mar 7, 2017
92a2d4d
pretty much works!
Colvchap Mar 7, 2017
c326272
Working
seanszy Mar 8, 2017
948f02a
Images
seanszy Mar 8, 2017
a5a132f
wasd
Colvchap Mar 8, 2017
d783106
range
Colvchap Mar 8, 2017
3e19f10
BLOCKS
seanszy Mar 8, 2017
ac77fbd
fix
Colvchap Mar 8, 2017
d054d5d
DIRT
seanszy Mar 8, 2017
bf00e17
top
Colvchap Mar 8, 2017
3f85b83
BEDROCK
seanszy Mar 8, 2017
6d51a86
jumpy blocks
Colvchap Mar 8, 2017
769454a
Bedrock
seanszy Mar 8, 2017
6161997
jumpy blocks
Colvchap Mar 8, 2017
239f142
Merge branch 'master' of https://github.com/seanszy/InteractiveProgra…
Colvchap Mar 8, 2017
6eab25a
Self Place
seanszy Mar 8, 2017
80835cd
bed and jump
Colvchap Mar 8, 2017
f12c387
Self-Place, No Print
seanszy Mar 8, 2017
9c0ea98
Merged
seanszy Mar 8, 2017
2b6999d
NEW DIRT
seanszy Mar 8, 2017
a82e171
g
Colvchap Mar 8, 2017
23beccc
Merge branch 'master' of https://github.com/seanszy/InteractiveProgra…
Colvchap Mar 8, 2017
fd18c33
g
Colvchap Mar 8, 2017
f418059
jumpy
Colvchap Mar 8, 2017
7e9d7c4
Nether
seanszy Mar 8, 2017
626f354
Merged Trampoline
seanszy Mar 8, 2017
4c30d1b
9
Colvchap Mar 8, 2017
59c32ea
Nether
seanszy Mar 8, 2017
a185a3c
Merge branch 'master' of https://github.com/seanszy/InteractiveProgra…
seanszy Mar 8, 2017
99f94e6
Removed Wall Jump
seanszy Mar 8, 2017
6a14545
cool
Colvchap Mar 8, 2017
c872ce5
Merge branch 'master' of https://github.com/seanszy/InteractiveProgra…
Colvchap Mar 8, 2017
f3a83fa
Game
seanszy Mar 8, 2017
044b6e0
Merge branch 'master' of https://github.com/seanszy/InteractiveProgra…
seanszy Mar 8, 2017
e06e70f
with some comments
Colvchap Mar 8, 2017
fe05f4d
update
Colvchap Mar 8, 2017
5bbaf33
COmment
seanszy Mar 8, 2017
96602f3
Merge branch 'master' of https://github.com/seanszy/InteractiveProgra…
seanszy Mar 8, 2017
4007fd1
More Comments
seanszy Mar 8, 2017
13561f8
comment updates
Colvchap Mar 8, 2017
62456f4
final comments and menu condition
Colvchap Mar 8, 2017
eda6679
Comment
seanszy Mar 8, 2017
8da6531
Comment
seanszy Mar 8, 2017
ff9ef59
Interactive Programming Final
seanszy Mar 9, 2017
83f3ad3
final
Colvchap Mar 9, 2017
454ca33
mini project 5
Colvchap Apr 22, 2017
59b465f
Create Branch
seanszy Apr 23, 2017
96e5a7e
Updated File
seanszy Apr 23, 2017
3cbac37
Reset User List
seanszy Apr 24, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions Game/NewPygame.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import pygame

import pygame
from math import pi

def main():
# Initialize the game engine
pygame.init()

# Define the colors we will use in RGB format
BLACK = ( 0, 0, 0)
WHITE = (255, 255, 255)
BLUE = ( 0, 0, 255)
GREEN = ( 0, 255, 0)
RED = (255, 0, 0)

# Set the height and width of the screen
size = [400, 300]
screen = pygame.display.set_mode(size)

pygame.display.set_caption("Example code for the draw module")

#Loop until the user clicks the close button.
done = False
clock = pygame.time.Clock()
text_x = 150
text_y = 20
rectangle_x = 100
rectangle_y = 100
which_object = "Text"
while not done:
clock.tick(10)

for event in pygame.event.get(): # User did something
if event.type == pygame.QUIT: # If user clicked close
done=True
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_t:
which_object = "Text"
if event.key == pygame.K_r:
which_object = "Rectangle"
if which_object == "Text":
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
done = True
if event.key == pygame.K_LEFT:
text_x +=-10
if event.key == pygame.K_RIGHT:
text_x+=10
if event.key == pygame.K_UP:
text_y += -10
if event.key == pygame.K_DOWN:
text_y += 10
if which_object == "Rectangle":
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
done = True
if event.key == pygame.K_LEFT:
rectangle_x +=-10
if event.key == pygame.K_RIGHT:
rectangle_x+=10
if event.key == pygame.K_UP:
rectangle_y += -10
if event.key == pygame.K_DOWN:
rectangle_y += 10
# All drawing code happens after the for loop and but
# inside the main while done==False loop.

# Clear the screen and set the screen background
screen.fill(WHITE)

# Draw on the screen a GREEN line from (0,0) to (50.75)
# 5 pixels wide.
myfont = pygame.font.SysFont("monospace", 15)
keys=pygame.key.get_pressed()

text_color = (0, 0, 0)
text_position = (text_x, text_y)
label = myfont.render("Sean and Colvin's Game", 100, text_color)
screen.blit(label, (text_position))
#pygame.draw.lines(screen, BLACK, False, [[0, 80], [50, 90], [200, 80], [220, 30]], 5)
#pygame.draw.aaline(screen, GREEN, [0, 50],[50, 80])

#pygame.draw.polygon(screen, BLACK, [[100, 100], [0, 200], [200, 200]], 5)
#pygame.draw.arc(screen, RED, [210, 75, 150, 125], 3*pi/2, 2*pi, 2)
#pygame.draw.circle(screen, BLUE, [60, 250], 40)
pygame.draw.rect(screen, BLACK, [rectangle_x, rectangle_y, 50, 20])

pygame.display.flip()

# Be IDLE friendly
pygame.quit()


if __name__ == '__main__':
main()
18 changes: 18 additions & 0 deletions Game/Older Game/get_compliment
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
def get_complement(nucleotide):
""" Returns the complementary nucleotide
nucleotide: a nucleotide (A, C, G, or T) represented as a string
returns: the complementary nucleotide
>>> get_complement('A')
'T'
>>> get_complement('C')
'G'
"""
# TODO: implement this
if nucleotide == "C":
return("G")
el if nucleotide == "G":
returns("C")
el if nucleotide == "A":
return("T")
el if nucleotide == "T":
return ("A")
20 changes: 20 additions & 0 deletions Game/Older Game/get_compliment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
def get_complement(nucleotide):
""" Returns the complementary nucleotide
nucleotide: a nucleotide (A, C, G, or T) represented as a string
returns: the complementary nucleotide
>>> get_complement('A')
'T'
>>> get_complement('C')
'G'
"""
# TODO: implement this
if nucleotide == "C":
return("G")
if nucleotide == "G":
return("C")
if nucleotide == "A":
return("T")
if nucleotide == "T":
return ("A")

get_complement("A")
3 changes: 3 additions & 0 deletions Game/Older Game/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import math
a = eval("(math.sin(3.14159/6))")
print ((a))
83 changes: 83 additions & 0 deletions Game/PygameTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
"""Animates a bouncing ball.

Author : Oliver Steele <oliver.steele@olin.edu>
Course : Olin Software Design Fall 2016
Date : 2016-10-24
License: MIT LICENSE
"""

import pygame

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


class Ball(object):
def __init__(self):
self.radius = 20
self.reset()

def step(self):
self.y += self.dy
self.dy += .08
if self.y > 480 - self.radius and self.dy > 0:
self.dy *= -1
self.dy *= 0.99

def reset(self):
self.x = 320
self.y = 240
self.dy = 0

def contains_pt(self, pt):
return (self.x - pt[0]) ** 2 + (self.y - pt[1]) ** 2 < self.radius ** 2


class BallView(object):
def __init__(self, model):
self.model = model

def draw(self, surface):
model = self.model
pygame.draw.circle(surface, BLUE, (model.x, int(model.y)), model.radius)


class BallEnergyView(object):
def __init__(self, model):
self.model = model

def draw(self, surface):
model = self.model
ke = model.dy ** 2
pe = (480 - model.y) ** 2
pygame.draw.line(surface, BLUE, (10, 480), (10, 480 - int(ke * 20)), 20)
pygame.draw.line(surface, BLUE, (40, 480), (40, 480 - int(pe / 10)), 20)


def main():
pygame.init()
screen = pygame.display.set_mode((640, 480))
ball = Ball()
ball_view = BallView(ball)
ball_energy_view = BallEnergyView(ball)

running = True
while running:
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONDOWN:
if ball.contains_pt(pygame.mouse.get_pos()):
ball.reset()
if event.type == pygame.QUIT:
running = False

ball.step()

screen.fill(BLACK)
ball_view.draw(screen)
ball_energy_view.draw(screen)

pygame.display.update()

pygame.quit()
if __name__ == '__main__':
main()
134 changes: 134 additions & 0 deletions Game/RectangleClass.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import pygame

import pygame
from math import pi

######################
#Model
######################

pygame.init()
size = [400, 300]
screen = pygame.display.set_mode(size)
BLACK = ( 0, 0, 0)
WHITE = (255, 255, 255)
BLUE = ( 0, 0, 255)
GREEN = ( 0, 255, 0)
RED = (255, 0, 0)

class Rectangle():
def __init__(self, x = 10, y = 10, width = 20, height = 10, color = BLACK):
self.x = x
self.y = y
self.width = width
self.height = height
self.color = color
def draw_rectangle(self):
pygame.draw.rect(screen, self.color, [self.x, self.y, self.width, self.height])
def draw_shot(self):
self.x = self.x + 10
self.y = self.y
pygame.draw.rect(screen, self.color, [self.x, self.y, self.width, self.height])

def main():
# Initialize the game engine
pygame.init()

# Define the colors we will use in RGB format
color_matrix = [BLACK, BLUE, GREEN, RED]
# Set the height and width of the screen
size = [400, 300]
screen = pygame.display.set_mode(size)

pygame.display.set_caption("Example code for the draw module")
shoot_object_list = []
#Loop until the user clicks the close button.
done = False
clock = pygame.time.Clock()
text_x = 150
text_y = 20
rectangles_x = 100
rectangles_y = 100
rectangle_list = []
which_object = "Rectangle"
color = 0
draw_rectangle = 0
while not done:
clock.tick(10)
for event in pygame.event.get(): # User did something
if event.type == pygame.QUIT: # If user clicked close
done=True
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_c:
color+=1
if color == 3:
color = 0
if event.key == pygame.K_t:
which_object = "Text"
if event.key == pygame.K_r:
which_object = "Rectangle"
if which_object == "Text":
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
done = True
if event.key == pygame.K_a:
text_x +=-10
if event.key == pygame.K_d:
text_x+=10
if event.key == pygame.K_w:
text_y += -10
if event.key == pygame.K_s:
text_y += 10
if which_object == "Rectangle":
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
done = True
if event.key == pygame.K_a:
rectangles_x +=-10
if event.key == pygame.K_d:
rectangles_x+=10
if event.key == pygame.K_w:
rectangles_y += -10
if event.key == pygame.K_s:
rectangles_y += 10
if event.key == pygame.K_f:
draw_rectangle_x = rectangles_x
draw_rectangle_y = rectangles_y
rectangle_color = color_matrix[color]
rectangle = Rectangle(draw_rectangle_x, draw_rectangle_y+5, 10, 10, rectangle_color)
shoot_object_list.append(rectangle)
if event.key == pygame.K_g:
draw_rectangle_x = rectangles_x
draw_rectangle_y = rectangles_y
rectangle_color = color_matrix[color]
rectangle = Rectangle(draw_rectangle_x, draw_rectangle_y+5, 10, 10, rectangle_color)
rectangle_list.append(rectangle)
if event.key == pygame.K_z:
rectangle_list = []


##########################
#VIEW
##########################
screen.fill(WHITE)
myfont = pygame.font.SysFont("monospace", 15)
keys=pygame.key.get_pressed()
text_color = (0, 0, 0)
text_position = (text_x, text_y)
label = myfont.render("Sean and Colvin's Game", 100, text_color)
screen.blit(label, (text_position))
for rectangles in rectangle_list:
rectangles.draw_rectangle()
for shooters in shoot_object_list:
shooters.draw_shot()
pygame.draw.rect(screen, BLACK, [rectangles_x, rectangles_y, 50, 20])
pygame.draw.rect(screen, color_matrix[color], [0, 0, 20, 40])

pygame.display.flip()

# Be IDLE friendly
pygame.quit()


if __name__ == '__main__':
main()
Loading