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

Author Topic: Rotating Quads within Tile Map [Solved]  (Read 2443 times)

0 Members and 1 Guest are viewing this topic.

Andidy

  • Newbie
  • *
  • Posts: 2
    • View Profile
Rotating Quads within Tile Map [Solved]
« on: November 14, 2018, 06:55:47 pm »
EDIT: [SOLVED] I'm a dumby and forgot how switch statements work lmao

Hello, I am trying to modify the example tilemap presented in the 2.5.1 tutorials. I have added another array called "pose" which stores an int 0-3, I then made a function to set the orientation of the texcoords of the quads as the are being produced in the Load function. However when the vertex array is drawn to my program, all of the tiles have the same pose (3) even though each tile should have its own pose.

I think it might be I am passing the pointer to my quad in wrong but I am not sure.

« Last Edit: November 14, 2018, 10:35:31 pm by Andidy »

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: Rotating Quads within Tile Map
« Reply #1 on: November 14, 2018, 09:21:55 pm »
Sounds like you're not passing the correct element from your pose array (or the correct index of the element, however you wanna call it). Would be more helpful if you post all the relevant parts of the code.

Andidy

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Rotating Quads within Tile Map
« Reply #2 on: November 14, 2018, 09:42:37 pm »
Sounds like you're not passing the correct element from your pose array (or the correct index of the element, however you wanna call it). Would be more helpful if you post all the relevant parts of the code.

I don't use forums like this often and it seems my image attachments aren't displaying :/

Here is a link to my output, you'll notice that all the tiles of the same part of the tileset have the same rotation. https://imgur.com/JhBUlVe

But heres some snippets
(click to show/hide)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Rotating Quads within Tile Map [Solved]
« Reply #3 on: November 15, 2018, 07:55:00 am »
For those who only read new posts: problem is solved (see EDIT in first post).
Laurent Gomila - SFML developer

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Rotating Quads within Tile Map [Solved]
« Reply #4 on: November 15, 2018, 03:41:56 pm »
For anyone not seeing it: there were no breaks in the switch cases which meant that for case 0 the code for 0, 1, 2 and 3 ran, for case 1 code for 1, 2 and 3 ran, etc.
Back to C++ gamedev with SFML in May 2023