Sort of... It's much uglier than that and I should refactor
Thu Mar 18, 2021 12:08pm

This is the second time of me writing this after clearing... I guess that's definitely a sign it needs to be rewritten. :)

* Player position holds x/y coordinates on the tile map.
* Screen is drawn based on player xy as the starting point and drawn until it reaches the defined screen width and height.
* If player position is < 10, place player in it's real location on the map. Otherwise, draw them at 10,10.
* Collision is based on this transformed screen position.
* Actual player position value on the drawn screen is on location 1,1 if the xy is > 10. The player being in the middle is the transformed value.

Like I said, it's pretty ugly and I should think of a cleaner way to do it.

It was crashing earlier with:
attempt to reference unallocated memory (signal SIGSEGV)

So I re-wrote it into this sloppy mess that's working. (for now... until I touch something :) )

    • Sweet! - Retna, Wed Mar 17 2021 9:43pm
      Do you scroll the viewport and the player position at the same time when they press the direction? I might try doing that too...
      • Sort of... It's much uglier than that and I should refactor- Erik_, Thu Mar 18 2021 12:08pm
        • I removed the "if player's position in the x/y is less than so and so" and just made the player's screen position constant. I was having a weird issue where as you approached 1,1 on the map, you would move 2 tiles instead of one. The new way fixes this. To get the player's map position, I just ne... more
  • Click here to receive daily updates
    "Forces act when not restrained" - Puckdropper