This is pretty simple but I thought some devs might find it useful as an easy way to add a minimap to your game. It uses tline
to draw a miniature version of the full map area to screen (during your _draw loop):
for i=0,64 do tline(0,32+i,128,32+i,4/8,4/8+i,1) end |
The representative pixel is drawn from the center (4/8,4/8) of each sprite, but you can alter this if you want a different selection.
Here's an example of what this looks like in Celeste:
And here's Air Delivery with this line added:
Obviously it can be a bit messy raw, but it's accurate. For your own project, you could put this against a solid background color in your pause menu, for example. And then you might add an indicator for player position ;)
I hope this can be useful out there!
Amazing! I was thinking about doing something similar but would not have been able to write it so clean. Thank you this is a big help.
This may be a big ask but how would you go about adding a player position indicator like you had mentioned?
@jellosaladz
Simple : the map scale is 1 pixel per tile, and the top left corner is at x=0 and y=32.
assuming player.x and player.y are the player's coordinates in pixel inside the map, showing the player's position in the map as a dot would be :
pset(player.x/8,32+player.y/8,color)
changing the color of the dot would help making it more visible.
For example, if you you want to alternate between two colors every second, that would be
pset(player.x/8,32+player.y/8,time()%2<1 and color1 or color2)
[Please log in to post a comment]