I'm trying to make a simple Snake game in C++ with the SFML.
The problem I have is that I'd like the map to be generated randomly. I don't really know how could I do it but my idea was to have a Wall class that would be just a succession of squares (the map is divided in 45 * 35 tiles) so each square would be placed in a tile. The Wall class could have any number of squares and it could be placed vertically or horizontally just like the tetris shape
The number of instances of the class should then be randomly generated. The same for the number of squares that every instance would have and for the position of every instance.
The problem is that I can't imagine how could I done this be keeping a playable map. The Walls instances should keep a certain order to make the game fun (not the funniest game ever but you know).
Aucun commentaire:
Enregistrer un commentaire