Resized models and started pathfinding system
This commit is contained in:
29
main.py
29
main.py
@@ -26,6 +26,7 @@ pacman_startpoint = {0,0}
|
||||
movedirection = {"up":False, "down":False, "left":False, "right":False}
|
||||
|
||||
map1 = list()
|
||||
movement_map = list()
|
||||
|
||||
def generate_map(*mapfile):
|
||||
#Generate row
|
||||
@@ -37,15 +38,28 @@ def generate_map(*mapfile):
|
||||
for byte in line:
|
||||
#print(byte)
|
||||
if(byte == "#"):
|
||||
map1.append({"id":id,"object": pygame.image.load("models/wall_1.svg"), "x":startpos_x, "y":startpos_y})
|
||||
startpos_x +=60
|
||||
map1.append({"id":id,"object": pygame.image.load("models/wall_1.png"), "x":startpos_x, "y":startpos_y})
|
||||
|
||||
if(byte == " "):
|
||||
#movement_map.append({"x":startpos_x, "y":startpos_y})
|
||||
movement_map.append({"id":id,"object": pygame.image.load("models/wall_1.png"), "x":startpos_x, "y":startpos_y})
|
||||
|
||||
startpos_x +=20
|
||||
id += 1
|
||||
#print(line)
|
||||
startpos_x = 0
|
||||
startpos_y += 60
|
||||
startpos_y += 20
|
||||
|
||||
def generate_movement_path():
|
||||
|
||||
pass
|
||||
|
||||
generate_map()
|
||||
|
||||
pacman_posx = movement_map[0]["x"]
|
||||
pacman_posy = movement_map[0]["y"]
|
||||
|
||||
|
||||
while(gamestate==True):
|
||||
MAINSCREEN.fill(WEISS)
|
||||
PLAYGROUND.fill(WEISS)
|
||||
@@ -80,11 +94,11 @@ while(gamestate==True):
|
||||
pacman_posy -= pacman_movespeed
|
||||
|
||||
if(movedirection["down"] == True):
|
||||
if(pacman_posy <= (MAINSCREEN_SIZE[1]-30)):
|
||||
if(pacman_posy <= (MAINSCREEN_SIZE[1]-18)):
|
||||
pacman_posy += pacman_movespeed
|
||||
|
||||
if(movedirection["right"] == True):
|
||||
if(pacman_posx <= (MAINSCREEN_SIZE[0]-30)):
|
||||
if(pacman_posx <= (MAINSCREEN_SIZE[0]-18)):
|
||||
pacman_posx += pacman_movespeed
|
||||
|
||||
if(movedirection["left"] == True):
|
||||
@@ -95,9 +109,12 @@ while(gamestate==True):
|
||||
|
||||
MAINSCREEN.blit(pacman, (pacman_posx,pacman_posy))
|
||||
for row in map1:
|
||||
print(row)
|
||||
#print(row)
|
||||
MAINSCREEN.blit(row["object"], (row["x"],row["y"]))
|
||||
|
||||
#for coordinate in movement_map:
|
||||
# print(coordinate)
|
||||
|
||||
|
||||
pygame.display.flip()
|
||||
clock.tick(60)
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
######## #################################
|
||||
########## ################# ###########
|
||||
#################################################
|
||||
######################################################
|
||||
######### ###########
|
||||
######### ################################ ###########
|
||||
######### ################################ ###########
|
||||
######### ################################ ###########
|
||||
######### ################################ ###########
|
||||
######### ################################ ###########
|
||||
######### ################################ ###########
|
||||
######### ################################ ###########
|
||||
######### ################################ ###########
|
||||
######### ################################ ###########
|
||||
######### ################################ ###########
|
||||
######### ################################ ###########
|
||||
######### ################################ ###########
|
||||
######### ###########
|
||||
######################################################
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 632 B After Width: | Height: | Size: 391 B |
Binary file not shown.
|
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 150 B |
@@ -2,9 +2,9 @@
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="210mm"
|
||||
height="297mm"
|
||||
viewBox="0 0 210 297"
|
||||
width="5.2916665mm"
|
||||
height="5.2916665mm"
|
||||
viewBox="0 0 5.2916667 5.2916665"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
|
||||
@@ -24,8 +24,8 @@
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:zoom="0.72426347"
|
||||
inkscape:cx="396.95499"
|
||||
inkscape:cy="561.25984"
|
||||
inkscape:cx="158.09164"
|
||||
inkscape:cy="188.46733"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1009"
|
||||
inkscape:window-x="-8"
|
||||
@@ -37,12 +37,13 @@
|
||||
<g
|
||||
inkscape:label="Ebene 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
id="layer1"
|
||||
transform="translate(-63.199261,-98.269371)">
|
||||
<rect
|
||||
style="fill:#4d4d4d;stroke-width:0.264583"
|
||||
style="fill:#4d4d4d;stroke-width:0.0923575"
|
||||
id="rect1"
|
||||
width="14.977859"
|
||||
height="15.343174"
|
||||
width="5.2916665"
|
||||
height="5.2916665"
|
||||
x="63.199261"
|
||||
y="98.269371"
|
||||
inkscape:export-filename="wall_1.png"
|
||||
|
||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.6 KiB |
Reference in New Issue
Block a user