Python Maze Game Tutorial Part 2

preview_player
Показать описание
NEED HELP?

❤️❤️ SHOW SOME LOVE AND SUPPORT THE CHANNEL ❤️❤️

Click Join and Become a Channel Member Today!
Channel members can get preferential comment replies, early access to new content, members only live streams, and access to my private Discord.

Amazon Affiliate Links

Other Affiliate Links

LINKS

LEARN MORE PYTHON

LEARN MORE JAVA

#Python #Tutorial #Beginner
Рекомендации по теме
Комментарии
Автор

Excellent lesson thanks. So far, so good!

teacherinthailan
Автор

thanks, really useful as long as you don't use pygame

jerrycui
Автор

my game doesn't continue working after the maze is drawn. It just freezes and the character doesn't move after it freezes

edspeedbreaker
Автор

Hello! I created a two player game, whithout IA, following your instructions to create players. I also made a counter evolving by one everytime I prees the space touch, so that the two players play one after the other (one playing during even tour, and the over during odd one). I made an if/else condition so that the movement of each caracter is possible only if it's his turn. But I don't understand why: when I start playing, I play the first caracter because it's his turn, and if i press space: counter increase by one.... BUT IT S STILL THE FIRST SAME PLAYER PLAYING.. Do you have any solution, is that a loop problem ? It would be a pleasure if you answer to that and, by the way, I really enjoy your contents!

alfreddelar
Автор

Hi Coding Master, May I please ask what did you use to do this coding? Thank you so much

ngmarcus
Автор

My maze disapears after i click full screen

LucMoore
Автор

Afternoon! Is it possible for the program to read the starting coordinates from a txt file instead?

davidmaxwell
Автор

Hello. Please, are you going to share the code in a description?

_Tadeemah
Автор

I got an error that p is not defined...!

ManpreetKaur-krmn
Автор

Hello, I'm trying to copy your code from tutorial 2, tutorial 1 code works fine, but the code for tutorial 2 won't run. I couldn't find a link to the code so I wrote it out as I saw it on the video however the error I get is TabError: inconsistent use of tabs and spaces in indentation - this is looking at this line of code: if character == "P": I've no idea why this code isn't written correctly? Hope you can help :-)

millyscoop
Автор

Can we make our own maze by putting our "X"s and "P" in our choice?

sakmancap
Автор

mine says that the player isnt defined when i start it up
anyone can help?

durfpapi
Автор

hey bro i am doing my code and the player wont come up and the window just close after it generates

heres the code :--

import turtle

wn = turtle.Screen()
wn.bgcolor("black")
wn.title("Wellcome to the maze game!")
wn.setup(700, 700)

class Player(turtle.Turtle):
def _init_(self):
turtle.Turtle.__init__(self)
self.shape("square")
self.color("blue")
self.penup()
self.speed(0)

class Pen(turtle.Turtle):
def __init__(self):
turtle.Turtle.__init__(self)
self.shape("square")
self.color("white")
self.penup()

def go_Up(self):
self.goto(self.xcor(), self.ycor() + 24)

def go_Down(self):
self.goto(self.xcor(), self.ycor() - 24)

def go_Left(self):
self.goto(self.xcor() - 24, self.ycor())

def go_Right(self):
self.goto(self.xcor() + 24, self.ycor())

levels = [""]

level_1 = [

"X
"X
"X XX
"X XX XXX XX",
XX XXX XX",
XX
X",

X",
"XXXX



"X X",
X",
X",
"X X",
"X XXX X",
"X XXX X",
"X XXX X",
"X
"X
"X X",

]

levels.append(level_1)

def setup_maze(level):
for y in range(len(level)):
for x in range(len(level[y])):

character = level[y][x]

screen_x = -288 + (x * 24)
screen_y = 288 - (y * 24)

if character == "X":
pen.goto(screen_x, screen_y)
pen.stamp()

if character == "P":
player.goto(screen_x, screen_y)

pen=Pen()
player = Player()

setup_maze(levels[1])

turtle.listen()
turtle.onkeypress(player.go_Left, "a")
turtle.onkeypress(player.go_Right, "d")
turtle.onkeypress(player.go_Up, "w")
turtle.onkeypress(player.go_Down, "s")

wn.tracer(0)



while True:
wn.update()

wn.mainloop()

exnivior.
visit shbcf.ru