Added Christmas Theming
This commit is contained in:
BIN
images/snow.png
Normal file
BIN
images/snow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 459 KiB |
23
main.py
23
main.py
@@ -83,6 +83,23 @@ class RectangleText():
|
||||
self.rectangle.undraw()
|
||||
self.textBox.undraw()
|
||||
|
||||
class RectangleImage():
|
||||
def __init__(self, topLeftX, topLeftY, width, height, imageURL):
|
||||
self.topLeftX = topLeftX
|
||||
self.topLeftY = topLeftY
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.imageURL = imageURL
|
||||
self.image = Image(Point(topLeftX + width / 2, topLeftY + height / 2), imageURL)
|
||||
|
||||
def draw(self, graphicsWindow):
|
||||
self.image.draw(graphicsWindow)
|
||||
|
||||
def getCanvas(self):
|
||||
return self.image.canvas
|
||||
|
||||
def undraw(self):
|
||||
self.image.undraw()
|
||||
|
||||
####################
|
||||
# Global variables #
|
||||
@@ -110,7 +127,8 @@ unpauseButton = RectangleButton(200, 200, 300, 200, "Unpause")
|
||||
unpauseButton.textBox.setSize(18)
|
||||
resetButton = RectangleButton(100, 575, 200, 75, "Reset")
|
||||
resetButton.textBox.setSize(18)
|
||||
backgroundRec = Rectangle(Point(-1, -1), Point(701, 701))
|
||||
# backgroundRec = Rectangle(Point(-1, -1), Point(701, 701))
|
||||
backgroundRec = RectangleImage(-1, -1, 700, 700, "./images/snow.png")
|
||||
gameOverOverlay = RectangleButton(100, 25, 500, 600, "Game Over")
|
||||
gameOverOverlay.rectangle.setFill("grey")
|
||||
gameOverOverlay.textBox.setSize(24)
|
||||
@@ -163,7 +181,7 @@ def draw_grid():
|
||||
|
||||
def undraw_grid(graphicsWindow):
|
||||
backgroundRec.draw(graphicsWindow)
|
||||
backgroundRec.setFill(color_rgb(240, 240, 240))
|
||||
# backgroundRec.setFill(color_rgb(240, 240, 240))
|
||||
|
||||
def add_random():
|
||||
added = False
|
||||
@@ -252,6 +270,7 @@ def update():
|
||||
end_game()
|
||||
|
||||
def initialSetup(graphicsWindow):
|
||||
backgroundRec.draw(graphicsWindow)
|
||||
pauseButton.draw(graphicsWindow)
|
||||
resetButton.draw(graphicsWindow)
|
||||
howToPlayButton.draw(graphicsWindow)
|
||||
|
||||
Reference in New Issue
Block a user