Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 29 2017 13:22
    SirNickolas starred rcorre/dtiled
  • Nov 30 2016 01:20
    leotada starred rcorre/dtiled
  • May 12 2016 16:24
    Yoplitein starred rcorre/dtiled
  • Feb 06 2016 12:14
    rcorre starred rcorre/dtiled
  • Jan 14 2016 02:42
    rcorre commented #9
  • Jan 13 2016 14:11
    grogancolin opened #9
  • Jan 06 2016 15:30
    Damani starred rcorre/dtiled
  • Dec 09 2015 03:10

    rcorre on v0.3.3

    (compare)

  • Dec 09 2015 03:10

    rcorre on master

    Fix error message for getTilese… (compare)

  • Dec 05 2015 11:52
    rcorre commented #7
  • Dec 05 2015 11:49

    rcorre on master

    Add Gitter badge to README. Li… Add dub package shield to readm… (compare)

Jackoz530
@Jackoz530
Hello. It's me again. I'm encountering an error while loading a tilemap. Specifically it could not detect a layer that is present in the tilemap.
First-chance exception: object.Exception Could not find layer named ground at ........\AppData\Roaming\dub\packages\dtiled-0.3.2\src\dtiled\data.d(146)
But the layer ground is defined at the tilemap
{ "height":24,
"layers":[
{
"data":[20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 37, 19, 36, 36, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 6, 7, 7, 7, 8, 20, 20, 20, 20, 20, 20, 37, 1, 1, 1, 1, 35, 20, 20, 20, 20, 20, 20, 36, 20, 20, 20, 20, 20, 20, 20, 37, 22, 23, 23, 23, 24, 2, 20, 20, 20, 20, 21, 1, 49, 50, 50, 51, 1, 35, 20, 20, 20, 37, 37, 1, 36, 36, 36, 20, 20, 18, 2, 2, 22, 23, 23, 23, 24, 18, 20, 20, 20, 20, 21, 1, 65, 66, 66, 67, 1, 1, 19, 20, 21, 65, 17, 18, 18, 18, 18, 35, 20, 2, 2, 18, 22, 23, 23, 23, 24, 2, 20, 20, 20, 20, 37, 1, 65, 66, 66, 67, 1, 1, 19, 20, 21, 65, 2, 33, 18, 2, 17, 18, 19, 2, 2, 18, 22, 23, 23, 23, 24, 2, 20, 20, 20, 20, 5, 1, 81, 82, 82, 50, 50, 51, 19, 20, 21, 65, 2, 2, 18, 2, 17, 18, 19, 20, 18, 18, 38, 39, 39, 39, 40, 3, 20, 20, 20, 20, 20, 5, 1, 1, 1, 66, 66, 67, 19, 20, 21, 65, 5, 2, 18, 17, 18, 17, 18, 19, 20, 5, 33, 2, 17, 17, 17, 19, 20, 20, 20, 20, 20, 20, 20, 5, 1, 66, 66, 67, 19, 20, 21, 65, 33, 18, 3, 17, 18, 17, 18, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 5, 81, 82, 83, 19, 20, 20, 5, 4, 17, 18, 17, 18, 33, 3, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 4, 4, 4, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 37, 2, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 35, 36, 36, 20, 20, 20, 20, 20, 20, 20, 20, 20, 37, 19, 20, 20, 20, 20, 20, 21, 18, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 18, 19, 20, 20, 20, 20, 20, 20, 36, 17, 18, 19, 20, 20, 20, 20, 20, 21, 18, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 18, 19, 20, 20, 20, 20, 20, 21, 17, 17, 18, 19, 20, 20, 20, 20, 20, 21, 18, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 18, 19, 20, 20, 20, 20, 20, 21, 17, 17, 18, 19, 20, 20, 20, 20, 20, 21, 18, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 18, 19, 20, 20, 20, 20, 20, 21, 17, 17, 18, 19, 20, 20, 20, 20, 20, 21, 18, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 18, 19, 20, 20, 20, 20, 20, 20, 17, 17, 18, 19, 20, 20, 20, 20, 20, 20, 5, 38, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 40, 18, 19, 20, 20, 20, 20, 20, 20, 5, 34, 34, 19, 20, 20, 20, 20, 20, 20, 20, 18, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 18, 3, 20, 20, 20, 20, 20, 20, 20, 20, 4, 4, 20, 20, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20],
"height":24,
"name":"ground",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":32,
"x":0,
"y":0
},
Ryan Roden-Corrent
@rcorre
Are you calling getLayer or getTileset? Line 146 corresponds to getTileset, but you want a layer
The error message is a typo on my part >.<
thanks for catching that
Ryan Roden-Corrent
@rcorre
released v0.3.3 with the error message corrected
Jackoz530
@Jackoz530
Oh ok. Thank you.
I'll keep you posted if I encounter more errors.
Jackoz530
@Jackoz530
tilemap.png
tilemap.png
game.png
Hello. So I've been trying to render a 1024X1024 tilemap with a camera to stroll around the game. My Camera class exposes its offset and I used it to determine what tiles to render or not. So when I started the game, the map was rendered offscreen for a few tiles until it kinda stopped. I posted some screenshots
My actual camera code is this:
and my tile building methods is this
I based the camera implementation to your dtiled-example so I thought it kinda worked. I don't know if there's something wrong with it.
Ryan Roden-Corrent
@rcorre
It's hard to say from the given code. You may want to check the offset of your camera at that point and compare that to how big your map is -- it looks like your offset is simply at a point that exposes areas beyond the map bounds
Jackoz530
@Jackoz530
If it's not too much trouble, care to explain what you meant by it? My own understanding of the code is that the code renders tiles depending on the location of the player sprite, and the render subtracts a column of a tile once the player moves right or left and vice-versa.
Ryan Roden-Corrent
@rcorre
for example, if your map is 1024x1024 pixels, your screen is 800 pixels wide,
and your camera x offset is 600, then the rightmost tile will be rendered
starting at 1024-600 = 424. This means that everything to the right of that
last tile will show up blank like you showed in your last screenshot. I'm not
exactly sure if that's what you were asking, but its my best guess based on
the shown screenshots and code.
Jackoz530
@Jackoz530
oh, well that was the intended behavior. My problem was that the last tile on my tilemap(the blue and brown borders) were not being rendered
It's like the only rendered part of the tilemap is smaller than the actual tilemap size
It's like a small 900X 800 or something since the trees in the middle of the tilemap haven't been rendered
Ryan Roden-Corrent
@rcorre
huh. Its hard to tell without seeing the full program and debugging. I would try checking the camera bounds at a certain point and comparing that to the positions of tiles you expect to be rendered
Jackoz530
@Jackoz530
Hello. Sorry for the late reply but I've found what was wrong with it. It seems that the tilemap was rendered, but only the terrain Layer. The Feature Layer wasn't being rendered.
Ryan Roden-Corrent
@rcorre
Good to hear -- glad you got it figured out
Billy the Zergling
@Payotz__twitter
Hello! I was the previous guy who had the Terrain problem. I have a question. Is there a special function to iterate objects over a Layer? I'm having trouble iterating objects using either foreach() and for() with foreach staying on one object and for() not actually working optimally.
Here is my code: http://dpaste.com/3CDE2JR
Oh nevermind. It works now. Weird
Ryan Roden-Corrent
@rcorre
@Payotz__twitter glad you got it figured out!