Re: Way to create an RPG game like Entombed

Python works fine for game development, Civilization IV, EVE Online, and plenty of other games use it. Really its more about what people are comfortable working with.

Maps are generally handled with grids, although it depends sometimes. A map usually consists of a surface players walk across so it requires a width and height, or x and y, to plot the players position in the map. You can easily achieve this with a 2 dimensional array, for example:

maptest = [[0,0,0,0,0]
           [0,1,0,0,0]
           [0,0,0,0,0]
           [0,0,2,0,0]
           [0,0,0,3,0]]

This above is a 5 by 5 map consisting of 1 array holding 5 other arrays, which in turn hold 5 numbers each. 0 represents empty space, the number 1 represents the player, the number 2 an enemy, and the number 3 an item, etc. When accessing the map you would just need to input the x and y coordinates, such as map[1][1], and use the resulting number for what you want it to represent. So for example to move the player left you would check the players current position against where they want to go:

#if the space to the players left is empty, move there
if maptest[player.x-1][player.y] == 0:
    player.x -= 1
#if the space to the players left is occupied
elif maptest[player.x-1][player.y] == 2:
    print("Somethings already there!")
elif maptest[player.x-1][player.y] == 3:
    print("There's an item here!")


_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : jonikster via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : nuno69 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : jonikster via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : jonikster via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : targor via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : jonikster via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : jonikster via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : targor via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : targor via Audiogames-reflector

Reply via email to