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

Author Topic: Finding out what Tile your on from the VerterArray TileMap Example  (Read 1843 times)

0 Members and 1 Guest are viewing this topic.

JTeck

  • Newbie
  • *
  • Posts: 35
    • View Profile
How would you go about showing what tile your on with a VertexArray Tilemap that is based mostly on the example?

Really simple answer, but I'm just lost at where to start with it.

Cheers

http://www.sfml-dev.org/tutorials/2.0/graphics-vertex-array.php

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Finding out what Tile your on from the VerterArray TileMap Example
« Reply #1 on: June 14, 2014, 02:43:36 pm »
Quote
showing what tile your on
What does that mean? Do you want to get the tile coordinates? Or something else?
Laurent Gomila - SFML developer

JTeck

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Finding out what Tile your on from the VerterArray TileMap Example
« Reply #2 on: June 14, 2014, 02:50:16 pm »
Quote
showing what tile your on
What does that mean? Do you want to get the tile coordinates? Or something else?

Coordinates would be good, but the tile number your on; 1, 12, 4 etc. Where the level is loaded, that number array, finding out which number your sitting on.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Finding out what Tile your on from the VerterArray TileMap Example
« Reply #3 on: June 14, 2014, 02:57:11 pm »
but the tile number your on
What does "you're on" mean? Who is "you"? The mouse cursor? A game object? Please express yourself clearly.

If you have the coordinates, you can divide them by the tile size to learn the tile index. If the vertex array doesn't start at (0,0), you have to offset accordingly.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

JTeck

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Finding out what Tile your on from the VerterArray TileMap Example
« Reply #4 on: June 14, 2014, 02:58:38 pm »
but the tile number your on
What does "you're on" mean? Who is "you"? The mouse cursor? A game object? Please express yourself clearly.

If you have the coordinates, you can divide them by the tile size to learn the tile index. If the vertex array doesn't start at (0,0), you have to offset accordingly.

Sorry, the "you" is the gameobject, I haven't gotten the coordinates as of yet.

 

anything