Here's few small functions that let you read and load maps you've made in Tiled directly into your screens to make those simple mini-games you wanted to make.
simply download and add these files to your game:
04 image fit.rpy
05 tilemap loader.rpy
tilemap test.rpy
download Tiled to make your map:
https://www.mapeditor.org/
make your map and export it as .csv file
put your map file and tileset in the game directory
follow the example screen in the `tilemap test.rpy` to find out how to add your tilemap to the screen
the important lines are:
``
default tsize = 32
default tileset = "maps/01.png"
default tilemap = "maps/01.csv"
``
where you specify your tile size, the path to your tileset image and the path to youe tilemap
------
the load_map function gives you a nested list like this:
``
default map:[
[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],
[-1,-1,-1,-1,-1,-1,-1,-1,29,3,29,29,11,12,13,-1],
[-1,-1,-1,-1,-1,-1,-1,-1,37,28,37,39,12,8,23,-1],
[-1,-1,-1,-1,-1,-1,-1,-1,23,28,1,41,36,4,33,-1],
[-1,-1,-1,-1,-1,-1,-1,-1,33,28,29,28,40,28,45,-1],
[-1,-1,-1,-1,-1,-1,-1,-1,29,38,39,37,9,39,45,-1],
[-1,-1,-1,-1,-1,-1,-1,-1,38,1,41,36,36,43,2,-1],
[-1,-1,-1,-1,-1,-1,-1,-1,27,27,27,32,32,33,-1,-1],
[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],
]
``
that comes in handy when you want to find out where is your player on the map and what blocks are around it by simply comparing your players x-y value with the map.
I think there are better ways to add tiles to renpy but I'm too lazy to fiddle with classes, Creator-Defined Displayables and I'm most comfortable working with screens and simple python functions.
to download, visit my patreon: / load-tilemaps-in-23371475