Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Best solution to draw map  (Read 2134 times)

0 Members and 1 Guest are viewing this topic.

GamDev

  • Newbie
  • *
  • Posts: 29
    • View Profile
Best solution to draw map
« on: January 27, 2019, 09:49:20 pm »
Hi, please tell me what is the best way to render large game map
to get such a result? Attach 1


i have 48 blob sprites (8-bit masking)
like this: Attach 2



My problem is: Attach 3
i render my map in VertexArray, but VertexArray can not mix two sprites together, like this:


How can I draw a game map so that the sprite overlay on top of another sprite?
« Last Edit: January 28, 2019, 08:51:23 am by GamDev »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Best solution to draw map
« Reply #1 on: January 28, 2019, 07:57:09 am »
Quote
like this:
?
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Best solution to draw map
« Reply #2 on: January 28, 2019, 08:50:59 am »
A vertex array allows you to draw any shapes at any position you want. That also means, that you can draw two quads on top of each other. It makes things harder to reason about, but is certainly possible.

Alternatively, it might be easier to just create the overlay tiles in an image editor and use that as new tile type.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

GamDev

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: Best solution to draw map
« Reply #3 on: January 28, 2019, 08:55:25 am »
Quote
create the overlay tiles
game map is randomly generated.
i use 48 blob sprites

GamDev

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: Best solution to draw map
« Reply #4 on: January 28, 2019, 09:05:31 am »
Quote
That also means, that you can draw two quads on top of each other.
How to draw two quads in one position ?
« Last Edit: January 28, 2019, 04:31:09 pm by GamDev »

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Best solution to draw map
« Reply #5 on: January 28, 2019, 07:10:27 pm »
Give 2 quads the same position/coordinates.

 

anything