Help me making a game(Python) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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

14th Feb 2017, 1:00 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
22 Answers
+ 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.
14th Feb 2017, 6:48 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 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.
14th Feb 2017, 6:43 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
post your code so that we can help you
14th Feb 2017, 1:02 PM
Abishek Bashyal
Abishek Bashyal - avatar
+ 3
It is so long and if someone makes a coordinate system it is enough
14th Feb 2017, 1:03 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
+ 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?
14th Feb 2017, 6:36 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
Are you using some kind of graphics? Will there be mouse and/or keyboard navigation? Is there a hero to control or something?
14th Feb 2017, 6:38 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
Sure, man. Education first.
14th Feb 2017, 6:55 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
Looks like you need to define a class to contain all of the game objects' behaviour.
14th Feb 2017, 9:07 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
Umm no
27th Feb 2017, 2:14 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
+ 3
To make a city you know?
27th Feb 2017, 2:15 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
+ 3
ok then
27th Feb 2017, 2:17 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
+ 3
Sry cant give it to you, I only add friends. Sololearn is enough
27th Feb 2017, 2:19 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
+ 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
14th Feb 2017, 6:37 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
+ 2
Not yet, I will add them at last
14th Feb 2017, 6:40 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
+ 2
I thought of that but couldn't make using python
14th Feb 2017, 6:44 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
+ 2
I'll take a look after I complete my homework, btw ty! (I am 13 so I gotta do my homework)
14th Feb 2017, 6:49 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
+ 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.
14th Feb 2017, 8:06 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
+ 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"])
14th Feb 2017, 8:33 PM
Ali Emir Kızıl
Ali Emir Kızıl - avatar
0
Like... Pokemon go
27th Feb 2017, 2:14 PM
meghraj londhe
meghraj londhe - avatar
0
No... I m just 17 years old... I just started
27th Feb 2017, 2:16 PM
meghraj londhe
meghraj londhe - avatar