-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixed typo with new link * added pre init calls for game * Add executable permissions to setup.py * added how to screen * sped up the pizza to trashcan prozess * added Experience
- Loading branch information
Showing
7 changed files
with
107 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .base_scene import SceneBase | ||
from .help_scene import HelpScene | ||
from .game_scene import GameScene | ||
from .title_scene import TitleScene |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import pygame | ||
from . import SceneBase | ||
from game.objects import Text, Button, STATE | ||
|
||
class HelpScene(SceneBase): | ||
def __init__(self, context): | ||
SceneBase.__init__(self, context) | ||
self.buttons = [] | ||
self.createGameMenu() | ||
|
||
def ProcessInput(self, events, pressed_keys): | ||
for event in events: | ||
if event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN: | ||
# Move to the next scene when the user pressed Enter | ||
pass | ||
|
||
if event.type == pygame.MOUSEBUTTONDOWN: | ||
for button in self.buttons: | ||
button.isClicked(event) | ||
|
||
if event.type == pygame.MOUSEBUTTONUP: | ||
for button in self.buttons: | ||
button.isClicked(event) | ||
|
||
if event.type == pygame.MOUSEMOTION: | ||
for button in self.buttons: | ||
button.isHovered(event) | ||
|
||
def Update(self): | ||
pass | ||
|
||
def Render(self): | ||
# For the sake of brevity, the title scene is a blank red screen | ||
self.screen.fill((244, 101, 36)) | ||
self.screen.blit(self.context.help_img, | ||
( (self.context.width - self.context.help_img.get_width()) // 2, | ||
((self.context.height - self.context.help_img.get_height()) // 2))) | ||
for button in self.buttons: | ||
button.drawOn(self.screen) | ||
#self.screen.blit(self.start_button.draw(), | ||
# ( (self.context.width - self.start_button.width) // 2, | ||
# ((self.context.height - self.start_button.height) + self.title.get_height()) // 2)) | ||
#pygame.draw.rect(self.screen, (0, 100, 100), pygame.Rect(100, 100, 200, 200)) | ||
|
||
|
||
def createGameMenu(self): | ||
P, K, Y = 300, 5, 30 | ||
currX = P | ||
self.quit_button = Button(self.context, "Quit") | ||
self.quit_button.setPen(self.context.font) | ||
self.quit_button.setColor((255, 255, 255)) | ||
self.quit_button.setBackgroundImg(self.context.button_bg, STATE.NORMAL) | ||
self.quit_button.setBackgroundImg(self.context.button_bg_active, STATE.ACTIVE) | ||
self.quit_button.setOnLeftClick(self.handleQuitButtonClick) | ||
self.quit_button.setLocation(P, Y) | ||
currX+= self.quit_button.width | ||
self.home_button = Button(self.context, "Menu/Home") | ||
self.home_button.setPen(self.context.font) | ||
self.home_button.setColor((255, 255, 255)) | ||
self.home_button.setBackgroundImg(self.context.button_bg, STATE.NORMAL) | ||
self.home_button.setBackgroundImg(self.context.button_bg_active, STATE.ACTIVE) | ||
self.home_button.setOnLeftClick(self.handleHomeButtonClick) | ||
self.home_button.setLocation(currX + K, Y) | ||
self.buttons += [self.quit_button, self.home_button] | ||
""" | ||
helper methods below this point | ||
""" | ||
def handleQuitButtonClick(self): | ||
self.context.quit() | ||
|
||
def handleHomeButtonClick(self): | ||
self.SwitchToScene(self.context.starting_scene, self.context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters