News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: GBDK set_bkg_tiles  (Read 2205 times)

Guadozoku

  • Sr. Member
  • ****
  • Posts: 257
    • View Profile
GBDK set_bkg_tiles
« on: December 24, 2014, 02:18:57 am »
I'm really having it out with this function. I got a scrolling thing going with collision detection, but I'm VERY limited now. I can't choose where I want to set the player or load any part of the map besides the top left. I can just put the player sprite where I want of course, but I'm trying to be somewhat professional about this, so I'm sticking it in the middle of the screen (at 72,72) and moving the map around it, like a GB game or the ship on Futurama.

The command is: set_bkg_tiles(0, 0, 50, 50, Testmap);
The first 2 are the tile axes to place the map,
the second two are the size of the map
Testmap is the name of the map

The problem is that if I change the first 2, I just get garbage in some parts of the screen. If I change the second two, the whole map is warped. I've seen people point to a certain point in the Testmap array, like Testmap[50], but for some reason that screws up what tile is loaded in what spot.

I'm pretty sure that this is the biggest hurdle for a LONG time in learning GBDK (except for sound, which I'm leaving for last and dreading) Can anyone help?

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: GBDK set_bkg_tiles
« Reply #1 on: December 24, 2014, 04:03:08 am »
Use the scroll registers and edit the tilemap data. Don't mess with the call that you have there, all it does is copying the tilemap. The tilemap already starts at the correct spot.

Guadozoku

  • Sr. Member
  • ****
  • Posts: 257
    • View Profile
Re: GBDK set_bkg_tiles
« Reply #2 on: December 24, 2014, 04:22:33 am »
How do I use the scroll registers? I'm not even sure what those are.

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: GBDK set_bkg_tiles
« Reply #3 on: December 24, 2014, 08:45:00 am »
The scroll registers control the position of the background in the viewport. They are typically used to erm, scroll it.

Guadozoku

  • Sr. Member
  • ****
  • Posts: 257
    • View Profile
Re: GBDK set_bkg_tiles
« Reply #4 on: December 24, 2014, 10:47:17 am »
I'm very new to console programming. How do I access that in the c compiler?