+ 2
Help me making a game(Python)
Hi guys! I'm trying to make a game that has a map using coordinate system but I don't know how to. I have tried once but it didn't worked as I wanted. Thank you
22 odpowiedzi
+ 7
Take a look at one of my labyrinth generating codes here on Sololearn. They use a 2D list to create 'the map' of the labyrinth and keep referring to its cells as either a passage or a wall. When drawing the labyrinth, the for loops check if there is a passage to the south or east (v.1.1) or if the current cell is empty or there's a wall (v. 2.0).
You can start from understanding that concept and its use.
+ 4
Hmm... then I would set the whole map as an array (list) with each cell having a value responsible for the map cell characteristics (a terrain type, passage/obstacle).
You then set the hero's start coordinates as a two-item list and pass them as arguments to the map.
+ 3
post your code so that we can help you
+ 3
It is so long and if someone makes a coordinate system it is enough
+ 3
You have to be at least somewhat more specific :)
A map can be a 2D list, but what is the game about and how do you play it?
+ 3
Are you using some kind of graphics? Will there be mouse and/or keyboard navigation? Is there a hero to control or something?
+ 3
Sure, man. Education first.
+ 3
Looks like you need to define a class to contain all of the game objects' behaviour.
+ 3
Umm no
+ 3
To make a city you know?
+ 3
ok then
+ 3
Sry cant give it to you, I only add friends. Sololearn is enough
+ 2
2D simulator game I think. I thought first the map and character behavior, after graphics and controls. All I need is a coordinate system
+ 2
Not yet, I will add them at last
+ 2
I thought of that but couldn't make using python
+ 2
I'll take a look after I complete my homework, btw ty! (I am 13 so I gotta do my homework)
+ 2
I found the solution I think:
I will create a dictionary for coordinates(also I think I will also use lists) and then I can make a system that sticks graphics and coordinates together. I will give it a try.
+ 2
cor={
#add coordinates bluh bluh
"player1cor":[0, 0], #x, y
"police01cor":[0, 0]
}
#test
test0=cor["player1cor"][0:1]==cor["police01cor"][0:1]
print(test0)
def walk_x(walker):
walker[0]+=1
def walk_y(walker):
walker[1]+=1
walk_x(cor["player1cor"])
print(cor["player1cor"])
walk_y(cor["player1cor"])
print(cor["player1cor"])
0
Like... Pokemon go
0
No... I m just 17 years old... I just started