diff --git a/KiwiSoda.ttf b/KiwiSoda.ttf new file mode 100644 index 0000000..e544946 Binary files /dev/null and b/KiwiSoda.ttf differ diff --git a/README.md b/README.md index 06f6ffe..d25a1e3 100644 --- a/README.md +++ b/README.md @@ -21,4 +21,6 @@ You control the weather to your liking, just be aware, it can turn against you! # Credits Here I will list all the external resources I will use, most likely, fonts. I make most of my assets by my own. -Alright so I think its fair to state I stole some code from my last minijam project at https://git.dvorakmortonxd.dev/dvorakmortonxd/revival-inc , however I dont know if this counts as external resource since, I am literally the one who wrote it. \ No newline at end of file +Alright so I think its fair to state I stole some code from my last minijam project at https://git.dvorakmortonxd.dev/dvorakmortonxd/revival-inc , however I dont know if this counts as external resource since, I am literally the one who wrote it. + +FONT: https://fontenddev.com/fonts/kiwi-soda/ \ No newline at end of file diff --git a/levels.py b/levels.py index 261718c..aadbee4 100644 --- a/levels.py +++ b/levels.py @@ -1,10 +1,32 @@ from render import load_sprite # this makes it so our function for rendering sprites from sprites.png is available in here +import pygame -def level1(screen, sheet, lastclickpos, basicfont, mouse, click, level): # the function for our first level, ignore the unused variables here, you can use them when you edit it - screen.blit(load_sprite(sheet, 0, 0, 57, 36, 912, 576), (0, 0)) # this renders a button I made in the sprites.png, its purely for visual purposes so it doesnt matter where you click rn - if click: # this checks if you clicked, when you clicked it does the following stuff under - level = 2 # sets the level to 2 - print("yo") # prints out "yo" for debugging purposes, otherwise completely unnecessary +def level1(screen, sheet, screen_width, screen_height, lastclickpos, basicfont, mouse, click, big_text, level, tick, slightfont): # the function for our first level, ignore the unused variables here, you can use them when you edit it + screen.blit(load_sprite(sheet, 0, 0, 56, 35, 912, 576), (0, 0)) # this renders a button I made in the sprites.png, its purely for visual purposes so it doesnt matter where you click rn + mainmenu_text = slightfont.render("THE DESTROYER OF CITIES", True, (210, 210, 210)) + playb_collision = pygame.Rect(315, 200, 285, 105) + exitb_collision = pygame.Rect(315, 350, 285, 105) + if playb_collision.collidepoint(mouse.get_pos()): + screen.blit(load_sprite(sheet, 57, 7, 19, 7, 285, 105), (315, 200)) + play_text = basicfont.render("Play", True, (0,0,0)) + if click: + level = 2 + else: + screen.blit(load_sprite(sheet, 57, 0, 19, 7, 285, 105), (315, 200)) + play_text = basicfont.render("Play", True, (255,255,255)) + + screen.blit(play_text, (414, 230)) + + if exitb_collision.collidepoint(mouse.get_pos()): + screen.blit(load_sprite(sheet, 57, 7, 19, 7, 285, 105), (315, 350)) + exit_text = basicfont.render("Exit", True, (0,0,0)) + if click: + level = 0 + else: + screen.blit(load_sprite(sheet, 57, 0, 19, 7, 285, 105), (315, 350)) + exit_text = basicfont.render("Exit", True, (255,255,255)) + screen.blit(exit_text, (414, 380)) + screen.blit(mainmenu_text, (45, 65)) return level # this returns the change we made to the level so that it updates in main.py def level2(screen, sheet, lastclickpos, basicfont, mouse, click, level): # function for level 2 print("ur done") # prints out "ur done" diff --git a/main.py b/main.py index 55ada2a..de5ec58 100644 --- a/main.py +++ b/main.py @@ -5,6 +5,7 @@ window_fps = 60 # the frames per second, this decides how fast the main loop ru def main(fps=window_fps): # the main function pygame.init() # initalizes pygame + tick = 0 screen_width = 912 # the screen width screen_height = 576 # the screen height # THE SCREEN IS 19:12 RATIO @@ -12,7 +13,10 @@ def main(fps=window_fps): # the main function lastclickpos = [0, 0] # last position that was clicked, this changes every time you click somewhere on the game window screen = pygame.display.set_mode((screen_width, screen_height)) # this initalizes the display with the screen_width and screen_height variables pygame.display.set_caption(title) # this actually sets the title of the window from the title variable - basicfont = pygame.font.SysFont(None, 30) # this sets a basic font for now, we can change this to anything later on + basicfont = pygame.font.Font('KiwiSoda.ttf', 50) # this sets a basic font for now, we can change this to anything later on + bigfont = pygame.font.Font('KiwiSoda.ttf', 80) + slightly_smaller_than_bigfont = pygame.font.Font('KiwiSoda.ttf', 70) + smallfont = pygame.font.Font('KiwiSoda.ttf', 30) clock = pygame.time.Clock() # this is used to control the fps of the game if you scroll down the code a bit click = False # variable I use to check if u clicked with the mouse when calling level function from levels. sheet = pygame.image.load("sprites.png") # the sprite sheet which we then use to load specific sprites from @@ -33,7 +37,7 @@ def main(fps=window_fps): # the main function if event.type == pygame.MOUSEBUTTONUP: # what happens when you release a mouse button click = False # sets the click variable to False so level function in levels.py can see again if level == 1: # what happens when the level variable is equal to 1 - level = levels.level1(screen, sheet, lastclickpos, basicfont, pygame.mouse, click, level) # runs the level1 function from levels.py + level = levels.level1(screen, sheet, screen_width, screen_height, lastclickpos, basicfont, pygame.mouse, click, bigfont, level, tick, slightly_smaller_than_bigfont) # runs the level1 function from levels.py # THE REASON WE CALL IT LIKE THIS INSTEAD OF NORMALLY IS SO WE CAN CHANGE THE LEVEL VARIABLE diff --git a/sprites.png b/sprites.png index df9c9e9..6043094 100644 Binary files a/sprites.png and b/sprites.png differ diff --git a/sprites.pxo b/sprites.pxo index 7fc7be5..eff6434 100644 Binary files a/sprites.pxo and b/sprites.pxo differ