Petunien wrote:
@Roland_Yonaba
I'll have a look on it. Thank you. Why do you not update your game to 0.8.0, so it's playable?
Much work?
Thank you again.
Well, since I paused it, I didn't come back on the code.
Later, I will.
But yeah, much work, cause actually, I learned a lot since the time I released.
Lots of things need to be re-written.
Petunien wrote:
My question: Is there a better way (more "efficient", smaller, future-proof...) to do that, what I did in the attached *.love?
Well, talking about efficiency and speaking about only this case, use only one "in pairs(tanks)" cycle instead of two (merge the cycles) would be faster imho. The problem is that big tiles share same space as mini-map so big tiles could be draw over older mini-tiles so better keep it apart.
Petunien wrote:
My question: Is there a better way (more "efficient", smaller, future-proof...) to do that, what I did in the attached *.love?
Well, talking about efficiency and speaking about only this case, use only one "in pairs(tanks)" cycle instead of two (merge the cycles) would be faster imho.
Good point.
I might add another point, it'll be interesting to save scale values inside variables. Actually, if you need the change the minimap size, or the window size, you will have to skim through all the map/minimap rendering parts to change some divisors...
Think of something auto-adaptative:
function love.load()
WIDTH,HEIGHT = love.graphics.getWidth(), love.graphics.getHeight()
MINIMAP_WIDTH,MINIMAP_HEIGHT = 160,120
MINIMAP_X_SCALE,MINIMAP_Y_SCALE = WIDTH/MINIMAP_WIDTH,HEIGHT/MINIMAP_HEIGHT
function translateToMinimap(x,y)
return minimap.x+x/MINIMAP_X_SCALE, minimap.y+y/MINIMAP_Y_SCALE
end
--define objects to be drawn
end
function love.update(dt)
...
for each object in allObjects do
update(object)
...
end
...
end
function love.draw()
...
for each object in allObjects do
renderOnMap(object.x,object.y)
renderOnMinimap(object..x,object.y)
--other stuff
end
...
end