Repository navigation
Project Submission #4
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
2c87b85
24678e7
a168e80
42abeb2
8730859
d959455
f4556da
dba8016
8976520
5118db2
2d2ea2d
c15d2ea
4933c21
e4c2e94
afea157
a786ea4
d0b42b6
96e4cd4
b133a20
03ad23a
459d704
f273cc2
31a7cdb
163590c
5b05cd1
30641b9
2c3120d
07ab946
bd1937a
e183459
47cb257
d216f76
cf87127
df10443
a870d23
3dac77b
2435bc3
e82a305
8155d51
231df00
90fad98
2efaecc
231e65f
a7ed21a
453689c
bc190ca
a8d39f8
59af4e5
7d216f1
6894572
4130462
5863d32
f63593d
8f2efc1
646e64c
8bfb444
6f88e50
62e75c2
4b50ce2
9dcf674
245d255
340cbe8
b96b29e
4549dc2
e773ac0
e6a9e17
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,7 @@ | ||
| label,course,description,max,dependencies | ||
| mech,Mechanical Prototyping,Learn techniques for mechanical design... and how to not kill your teammates,5,3bees1 4focs3 4elec2 5mats1 | ||
| bees,Sustainable Beekeeping,Beekeeping. Good for the environment. Ben Linder. Good for the soul. | ||
| ,3,2focs1 3mats2 | ||
| focs,Fundamentals of Computer Science,Step one:FOCS. Step two:Offical Hacker d00d. Step 3:Rule the world.,3,3elec1 | ||
| elec,Electricity and Magnetism,Does anyone know how electricity and magnetism work?,2,0 | ||
| mats,Material Science,Material science. Explore materials. Self-explanatory...right?,2,0 | ||
| robo,Fundamentals of Robotics,Death by Dave, but in a project-based-learning way.,1,2mech5 2bees3 2focs3 2elec2 2mats2 | ||
| label,course,description,max,dependencies,xrange | ||
| mech,Mechanical Prototyping,Learn techniques for mechanical design... and how to not kill your teammates,5,3bees1 4focs3 4elec2 5mats1,841 | ||
| bees,Sustainable Beekeeping,Beekeeping. Good for the environment. Ben Linder. Good for the soul.,3,2focs1 3mats2,51 | ||
| focs,Fundamentals of Computer Science,Step one:FOCS. Step two:Offical Hacker d00d. Step 3:Rule the world.,3,3elec1,367 | ||
| elec,Electricity and Magnetism,Does anyone know how electricity and magnetism work?,2,0,209 | ||
| mats,Material Science,Material science. Explore materials. Self-explanatory...right?,2,0,683 | ||
| robo,Fundamentals of Robotics,Death by Dave but in a project-based-learning way.,1,2mech5 2bees3 2focs3 2elec2 2mats2,525 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,19 +7,19 @@ | |
| import os | ||
| import sys | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would put all the functions below into a class for the screen. You're changing an object in your game essentially which is when classes are really nice :) |
||
| def initialize(): | ||
| def initialize(descriptions): | ||
| """ Initializes graphic screen. | ||
| """ | ||
| pygame.init() | ||
| screen = pygame.display.set_mode((1000, 700)) | ||
| pygame.font.init() | ||
| font = pygame.font.Font(None,30) | ||
| font = pygame.font.Font(None,26) | ||
| pygame.mouse.set_pos([500,350]) | ||
| pygame.mouse.set_visible(True) | ||
| text = setUpE(screen, font) | ||
| text = setUpE(screen, font, descriptions) | ||
| return [screen, text] | ||
|
|
||
| def setUpE(screen, font): | ||
| def setUpE(screen, font, descriptions): | ||
| '''This code is to load the basic backscreen for the program. | ||
| setUpE is NOT to be run whenever the user clicks something, just at beginning.''' | ||
| #loading/scaling images (loads as S___ for start, scaled as F___ for final) | ||
|
|
@@ -53,12 +53,12 @@ def setUpE(screen, font): | |
| screen.blit(FMechProto_Icon,(841,550)) | ||
| #render text | ||
| text = [] | ||
| text.append(font.render("Bees?", 1, (255,255,255))) | ||
| text.append(font.render("Magic", 1, (255,255,255))) | ||
| text.append(font.render("Hacker d00d", 1, (255,255,255))) | ||
| text.append(font.render("beep boop", 1, (255,255,255))) | ||
| text.append(font.render("hm...", 1, (255,255,255))) | ||
| text.append(font.render("Mechie Art", 1, (255,255,255))) | ||
| text.append(font.render("Sustainable Beekeeping: %s" % descriptions[0], 1, (255,255,255))) | ||
| text.append(font.render("Electricity and Magnetism: %s" % descriptions[1], 1, (255,255,255))) | ||
| text.append(font.render("Fundamentals of Computer Science: %s" % descriptions[2], 1, (255,255,255))) | ||
| text.append(font.render("Fundamentals of Robotics: %s" % descriptions[3], 1, (255,255,255))) | ||
| text.append(font.render("Material Science: %s" % descriptions[4], 1, (255,255,255))) | ||
| text.append(font.render("Mechanical Prototyping: %s" % descriptions[5], 1, (255,255,255))) | ||
| #Reload display / return font | ||
| pygame.display.flip() | ||
| return text | ||
|
|
@@ -126,3 +126,12 @@ def updateImg(screen, img, location): | |
| loaded = pygame.transform.scale(pygame.image.load(img), (108, 100)) | ||
| screen.blit(loaded, location) | ||
| pygame.display.flip() | ||
|
|
||
| def update_portfolio(courses, screen): | ||
| labels = list(courses) | ||
| pygame.draw.rect(screen, (255,255,255), (0,10,1000,440)) | ||
| for label in labels: | ||
| if courses[label].lvl: | ||
| img = 'Source/Level_Icons/%s%s.png' % (label, courses[label].lvl) | ||
| xmin = int(courses[label].range) | ||
| updateImg(screen, img, (xmin, 150)) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,13 +7,13 @@ | |
| from gameplay import Gameplay | ||
| import sys | ||
| import pygame | ||
| import ending | ||
| #import ending | ||
| from environment import * | ||
|
|
||
| # INITIALIZE GAME | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code below should be in a function or a class. It's always good practice to wrap things up and not have them free floating in a file. |
||
| BUTTON = pygame.USEREVENT + 1 | ||
| init_courses = courses.populate() | ||
| text_screen = environment.initialize() | ||
| text_screen = initialize([init_courses[label].description for label in list(init_courses)]) | ||
| screen = text_screen[0] | ||
| text = text_screen[1] | ||
| control = Gameplay(init_courses) | ||
|
|
@@ -26,15 +26,16 @@ | |
| sys.exit(1) | ||
| if event.type == BUTTON: | ||
| done = control.add_order(event) | ||
| control.level_up() | ||
| courses = control.level_up() | ||
| update_portfolio(courses, screen) | ||
| mouseOver(text, screen) | ||
| mouseClicks(control.order, BUTTON, screen) | ||
| pygame.display.flip() | ||
| pygame.event.pump() | ||
|
|
||
| # EVALUATE ENDING AND SEND TO VICTORY SCREEN | ||
| victory = control.evaluate_portfolio() | ||
| if victory == 1: | ||
| ending.determine(victory, ["%s: %s" % (control.courses[course].name, 'MAX') for course in control.courses]) | ||
| else: | ||
| ending.determine(victory, ["%s: %s" % (control.courses[course].name, control.courses[course].lvl) for course in control.courses]) | ||
| #victory = control.evaluate_portfolio() | ||
| #if victory == 1: | ||
| # ending.determine(victory, ["%s: %s" % (control.courses[course].name, 'MAX') for course in control.courses]) | ||
| #else: | ||
| # ending.determine(victory, ["%s: %s" % (control.courses[course].name, control.courses[course].lvl) for course in control.courses]) | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outer parens aren't necessary