Minimap

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Minimap

Post by Roland_Yonaba »

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. :D
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.
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Minimap

Post by coffee »

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.
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Minimap

Post by Roland_Yonaba »

coffee wrote:
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:

Code: Select all

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
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 2 guests