Merge remote-tracking branch 'origin'
This commit is contained in:
commit
8a3c1847ee
8 changed files with 17 additions and 4 deletions
20
cowyeet.py
20
cowyeet.py
|
@ -80,12 +80,18 @@ def load_block_texture(path: str):
|
||||||
return pygame.transform.scale(texture, (40 * settings["level_size_multiplier"], 40 * settings["level_size_multiplier"]))
|
return pygame.transform.scale(texture, (40 * settings["level_size_multiplier"], 40 * settings["level_size_multiplier"]))
|
||||||
|
|
||||||
|
|
||||||
|
icon_texture = load_texture("textures/icon.png")
|
||||||
|
full_icon_texture = load_texture("textures/icon_full.png")
|
||||||
|
full_icon_texture = pygame.transform.scale(full_icon_texture, (260, 90))
|
||||||
|
catapult_frame_texture = load_texture("textures/catapult/frame.png")
|
||||||
|
catapult_frame_texture = pygame.transform.scale(catapult_frame_texture, (66 * 5 * settings["level_size_multiplier"], 31 * 5 * settings["level_size_multiplier"]))
|
||||||
stone_block_texture = load_block_texture("textures/terrain/stone_01.png")
|
stone_block_texture = load_block_texture("textures/terrain/stone_01.png")
|
||||||
dirt_block_texture = load_block_texture("textures/terrain/dirt_01.png")
|
dirt_block_texture = load_block_texture("textures/terrain/dirt_01.png")
|
||||||
grass_block_texture = load_block_texture("textures/terrain/grass_01.png")
|
grass_block_texture = load_block_texture("textures/terrain/grass_01.png")
|
||||||
rock_block_texture = load_block_texture("textures/terrain/rock_01.png")
|
rock_block_texture = load_block_texture("textures/terrain/rock_01.png")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# coordinate calculations
|
# coordinate calculations
|
||||||
def center_x(width: int):
|
def center_x(width: int):
|
||||||
return screen.get_width() / 2 - width / 2
|
return screen.get_width() / 2 - width / 2
|
||||||
|
@ -142,8 +148,7 @@ def load_level(lvl):
|
||||||
|
|
||||||
lvl_width, lvl_height = level_data.level_size
|
lvl_width, lvl_height = level_data.level_size
|
||||||
|
|
||||||
level_surface = pygame.Surface((lvl_width * 40 * settings["level_size_multiplier"], lvl_height * 40 * settings["level_size_multiplier"]))
|
level_surface = pygame.Surface((lvl_width * 40 * settings["level_size_multiplier"], lvl_height * 40 * settings["level_size_multiplier"]), pygame.SRCALPHA, 32)
|
||||||
level_surface.fill(summer_sky)
|
|
||||||
|
|
||||||
x = 0
|
x = 0
|
||||||
y = 0
|
y = 0
|
||||||
|
@ -154,7 +159,6 @@ def load_level(lvl):
|
||||||
for block in row:
|
for block in row:
|
||||||
rx = x * 40 * settings["level_size_multiplier"]
|
rx = x * 40 * settings["level_size_multiplier"]
|
||||||
ry = y * 40 * settings["level_size_multiplier"]
|
ry = y * 40 * settings["level_size_multiplier"]
|
||||||
print(block)
|
|
||||||
|
|
||||||
blit_block(block, (rx, ry))
|
blit_block(block, (rx, ry))
|
||||||
x += 1
|
x += 1
|
||||||
|
@ -180,8 +184,8 @@ def blit_block(block, position: tuple):
|
||||||
level_surface.blit(texture_not_found, position)
|
level_surface.blit(texture_not_found, position)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main_menu_page():
|
def main_menu_page():
|
||||||
|
screen.blit(full_icon_texture, (center_x(full_icon_texture.get_width()), 128))
|
||||||
buttons[start_button].blit()
|
buttons[start_button].blit()
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,8 +196,15 @@ def level_selector_page():
|
||||||
|
|
||||||
|
|
||||||
def ingame_page():
|
def ingame_page():
|
||||||
|
screen.fill(summer_sky)
|
||||||
screen.blit(level_surface, (0, screen.get_height() - level_surface.get_height()))
|
screen.blit(level_surface, (0, screen.get_height() - level_surface.get_height()))
|
||||||
|
|
||||||
|
cx, cy = level_data.catapult_pos
|
||||||
|
cx = cx * 40 * settings["level_size_multiplier"]
|
||||||
|
cy = screen.get_height() - level_surface.get_height() + cy * 40 * settings["level_size_multiplier"] - catapult_frame_texture.get_height()
|
||||||
|
|
||||||
|
screen.blit(catapult_frame_texture, (cx, cy))
|
||||||
|
|
||||||
|
|
||||||
def page_selector():
|
def page_selector():
|
||||||
if page == "main_menu":
|
if page == "main_menu":
|
||||||
|
@ -277,6 +288,7 @@ def loop():
|
||||||
|
|
||||||
screen = pygame.display.set_mode(settings["win_size"], flags=pygame.RESIZABLE)
|
screen = pygame.display.set_mode(settings["win_size"], flags=pygame.RESIZABLE)
|
||||||
window_size_reload(settings["win_size"])
|
window_size_reload(settings["win_size"])
|
||||||
|
pygame.display.set_icon(icon_texture)
|
||||||
screen.fill(nero)
|
screen.fill(nero)
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import numpy
|
import numpy
|
||||||
|
|
||||||
level_size = (64, 32)
|
level_size = (64, 32)
|
||||||
|
catapult_pos = (3, 28)
|
||||||
|
|
||||||
data_list = [
|
data_list = [
|
||||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 868 B After Width: | Height: | Size: 6.8 KiB |
BIN
textures/catapult/frame.png
Normal file
BIN
textures/catapult/frame.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 963 B |
Binary file not shown.
BIN
textures/gimp/catapult/frame.xcf
Normal file
BIN
textures/gimp/catapult/frame.xcf
Normal file
Binary file not shown.
BIN
textures/icon.png
Normal file
BIN
textures/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 913 B |
BIN
textures/icon_full.png
Normal file
BIN
textures/icon_full.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Loading…
Reference in a new issue