Pygame Level Design

Hey. I'm trying to create my first game using the Pygame library for Python, and I was wondering what works best for level design in general. I'd love to hear what you guys think are good object-oriented design patterns for level management. Also, I'm pretty new to Python - thanks!

+3
source share
3 answers

With this type of game, your cards are in terms of tiles (I assume that by level you mean an individual level, without controlling all your levels). Each tile has

  • linked image (how it looks on the display)
  • type (i.e. wall, ground, trap, etc.).

Pygame, Map, :

  • the pygame.Surface ( blitting )
  • (.. ), Tile ( , , , , )

- , ( - , Tile ( )), , , . , , , - , ( , - , - bleh). -, .

, :

  • Tile
  • Map
  • Block
  • /

. , , Map, .

+8

Pygame, "- ". , Pygame , .

  • , ?
  • ?
  • ?
  • .

- , .

+6

, - ( - ).

In principle, each Map is an array, with each element in the array being a square in the grid. For example, a 3 by 3 grid would look like this:

(Psuedocode)

var Map = [[1,2,3] [1,2,3] [1,2,3]];

Instead of numbers, you can put lines for a function to parse and draw or take actions, depending on what value the cell has.

+1
source

Source: https://habr.com/ru/post/1725121/


All Articles