Now the coin moves around (27.1.2022)
Now the tiles does not stop him when he jumps. Changed some sounds.
Last video update 23.1.2022 – added double jump
Added coins 11.1.2022
This game is a work in progress and started from a ‘template’ made by dafluffypotato. I made some changes a couple of years ago and now I will try to make a complete videogame out of it.
First change I made, was in the map. I made it in a way that the player can go up or down and not just left and right, so that it seems that he is in a labyrinth more than in a traight path.
Then I thought to a way to make a path that will be surely free of block until the end of the maze. As you can see here there is only the path to the exit.
def create_map() -> list: ''' Map 30 rows x 300 columns generated randomly ''' # It's called by game_map and is used to blit the map in tilerects() data = [] # will contain the rows with 0 and 1 generate randomly def generate_map_filled(): data.append([1 for x in range(300)]) for row in range(30): # 30 rows of 0 and 1 data.append([choice([0,1]) for x in range(300)]) # data.append([choice([1]) for x in range(300)]) data[row][0] = 1 data.append([1 for x in range(300)]) def generate_path(): percorso = [] # used to place the brothen on the path col = 10 # row row = 10 mem = 0 while col < 299: # until end of 300 col # data[x][d] = 0 digr = choice([0,1,2]) if digr == 0 and mem !=2: # goes up if row > 1: row -=1 if digr == 1: # goes right col += 1 if digr == 2 and mem != 0: # goes down if row < 29: row += 1 mem = digr data[row][col] = 0 percorso.append([row, col]) return percorso def player_space(): data[10][10] = 0 data[10][11] = 0 def brother_place(percorso): # data[y] = list(data[y]) x, y = choice(percorso) data[x][y] = 3 # data[y] = "".join(data[y]) print(f"my brother is at height:{y} width{x}") # map algorhithm generate_map_filled() percorso = generate_path() player_space() brother_place(percorso[100:]) return data
Then I added other empty spots, so that the path is “unvisible”.
Changed the “platforms” imagese
To generate randomly the map with this tiles there is this code
data.append([choice([0,0,0,0,0,0,0,0,0,0,0,6,2]) for x in range(300)])
There are more chancecs to get a 0 (empty space) and an equal change to get a coin or a platform.
See ya for the next development and some code.
https://github.com/formazione/platformworlds.git
Subscribe to the newsletter for updates
Tkinter templates
My youtube channel
Twitter: @pythonprogrammi - python_pygame