thunderrabbit / conswi

A swipe game for Godot 3
GNU General Public License v3.0
4 stars 4 forks source link

Allow tile types to be easily specified per world/level #43

Closed thunderrabbit closed 4 years ago

thunderrabbit commented 4 years ago

Instead of the tiles array which spells out the order of tiles

tiles = [G.TYPE_PANDA,G.TYPE_BEAR,G.TYPE_DOG,G.TYPE_PANDA]

Do something like

tile_percentages = {G.TYPE_PANDA = 70,
                    G.TYPE_DOG = 30,
                    G.TYPE_CAT = 10,
                   }

The percents do not even have to add up to 100. Just add them all up, roll a random number between 1 and 110 and see which tile it should be.

Oh, except because G.TYPE_PANDA is 0, this format will not work. Will have to make a converter from text to id unless one exists already.