Skip to content

Commit

Permalink
Merge pull request #107 from LupaDevStudio/105-activate-christmas-bac…
Browse files Browse the repository at this point in the history
…kground-for-specific-time-period

activate christmas background only during winter months
  • Loading branch information
LupaDevStudio authored Jan 3, 2024
2 parents 9beb6c8 + 8d89a59 commit a57ffe1
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
10 changes: 6 additions & 4 deletions screens/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
PATH_TEXT_FONT,
PATH_IMAGES,
PATH_MUSICS,
PATH_SOUNDS
PATH_SOUNDS,
PATH_DAY_CAMP_BACKGROUND,
PATH_NIGHT_CAMP_BACKGROUND
)
from tools.constants import (
NUMBER_ADS_CREDITS
Expand Down Expand Up @@ -82,7 +84,7 @@ class GameScreen(ImprovedScreen):

def __init__(self, **kw):
super().__init__(
back_image_path=PATH_IMAGES + "day_camp_christmas.jpg",
back_image_path=PATH_DAY_CAMP_BACKGROUND,
font_name=PATH_TEXT_FONT,
** kw)

Expand Down Expand Up @@ -134,11 +136,11 @@ def preload(self, *_):

# Load the night camp background
self.night_camp_background = Loader.image(
PATH_IMAGES + "night_camp_christmas.jpg")
PATH_NIGHT_CAMP_BACKGROUND)

# Load the day camp background
self.day_camp_background = Loader.image(
PATH_IMAGES + "day_camp_christmas.jpg")
PATH_DAY_CAMP_BACKGROUND)

# Load the musics and sounds
new_musics = load_sounds(
Expand Down
5 changes: 3 additions & 2 deletions screens/intermediate_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

from tools.path import (
PATH_IMAGES,
PATH_TITLE_FONT
PATH_TITLE_FONT,
PATH_MENU_BACKGROUND
)
from tools.constants import (
FPS,
Expand All @@ -41,7 +42,7 @@ class IntermediateMenuScreen(ImprovedScreen):
def __init__(self, **kw):

super().__init__(
back_image_path=PATH_IMAGES + "menu_background_christmas.jpg",
back_image_path=PATH_MENU_BACKGROUND,
font_name=PATH_TITLE_FONT,
**kw)
self.other_screens_loaded = False
Expand Down
5 changes: 3 additions & 2 deletions screens/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

from tools.path import (
PATH_IMAGES,
PATH_TITLE_FONT
PATH_TITLE_FONT,
PATH_MENU_BACKGROUND
)
from tools.constants import (
FPS,
Expand All @@ -46,7 +47,7 @@ class MenuScreen(ImprovedScreen):
def __init__(self, **kw):

super().__init__(
back_image_path=PATH_IMAGES + "menu_background_christmas.jpg",
back_image_path=PATH_MENU_BACKGROUND,
font_name=PATH_TITLE_FONT,
**kw)
self.opacity_state = -1
Expand Down
26 changes: 26 additions & 0 deletions tools/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@
Module to store all the paths used for the app files and folders
"""

##############
### Import ###
##############

import datetime


#################
### Constants ###
#################

current_datetime = datetime.datetime.now()
IS_WINTER = current_datetime.month in (1, 2, 12)

#############
### Paths ###
#############

# Path for the folders
PATH_RESOURCES_FOLDER = "resources/"
Expand All @@ -28,3 +44,13 @@
# Path for the fonts
PATH_TITLE_FONT = PATH_FONTS + "scratched_letters_V2.ttf"
PATH_TEXT_FONT = PATH_FONTS + "Aquifer.ttf"

# Path for the backgrounds
if IS_WINTER:
PATH_MENU_BACKGROUND = PATH_IMAGES + "menu_background_christmas.jpg"
PATH_DAY_CAMP_BACKGROUND = PATH_IMAGES + "day_camp_christmas.jpg"
PATH_NIGHT_CAMP_BACKGROUND = PATH_IMAGES + "night_camp_christmas.jpg"
else:
PATH_MENU_BACKGROUND = PATH_IMAGES + "menu_background.jpg"
PATH_DAY_CAMP_BACKGROUND = PATH_IMAGES + "day_camp.jpg"
PATH_NIGHT_CAMP_BACKGROUND = PATH_IMAGES + "night_camp.jpg"

0 comments on commit a57ffe1

Please sign in to comment.