Author Topic: Trying to clean up some code  (Read 7469 times)

0 Members and 1 Guest are viewing this topic.

FellippeHeitor

  • Guest
Re: Trying to clean up some code
« Reply #15 on: June 16, 2018, 06:29:56 pm »
This bit needs your attention:

Code: QB64: [Select]
  1. RESTORE mapdata ‘reads 1,2 or 3 to determine what type of tile to place
  2. FOR k = 1 to 84
  3. READ mapdata

You are reading 84 values into the same variable mapdata. You also need an array here:

Code: QB64: [Select]
  1. DIM mapdata(1 to 84) AS INTEGER
  2. RESTORE mapdata ‘reads 1,2 or 3 to determine what type of tile to place
  3. FOR k = 1 to 84
  4. READ mapdata(k)

Then you can:

Code: QB64: [Select]
  1. FOR t = 1 to 84
  2.     _PUTIMAGE(tiles(t).x, tiles(t).y), tiletype(mapdata(t)) ‘ mapdata() = 1, 2 or 3 as read from the mapdata

Offline Feljar

  • Newbie
  • Posts: 7
    • View Profile
Re: Trying to clean up some code
« Reply #16 on: June 16, 2018, 06:51:16 pm »
Thank you, I had a feeling that was it. I edited my post and added that before I knew you replied. I will work on it after the kids go to bed. Thank you again for your patience & advice