Showcase your libraries, tools and other projects that help your fellow love users.
Nixola
Inner party member
Posts: 1949 Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy
Post
by Nixola » Sun May 27, 2012 1:46 pm
Try this:
Code: Select all
for i, v in ipairs(map) do
for ii, vv in ipairs(v) do
v[ii] = ii + (i-1)*16
end
end
Code: Select all
> map.print = function(self)
>> for i, v in ipairs(self) do
>> print(v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10], v[11], v[12], v[13], v[14], v[15], v[16])
>> end
>> end
> map:print()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
SimonLarsen
Party member
Posts: 100 Joined: Thu Mar 31, 2011 4:47 pm
Location: Denmark
Contact:
Post
by SimonLarsen » Sun May 27, 2012 2:14 pm
Nixola wrote: Try this:
...
I think you misunderstand. I'm talking about the id's returned by map.tileLayers.layer.tileData(x,y). They are assigned by ATL not me.
Nixola
Inner party member
Posts: 1949 Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy
Post
by Nixola » Sun May 27, 2012 5:24 pm
Try to find the error in the code then, if ATL coder doesn't answer
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
arthur_pessoa
Prole
Posts: 1 Joined: Sat May 12, 2012 5:46 pm
Location: Brazil
Post
by arthur_pessoa » Sun May 27, 2012 6:24 pm
“Simple things should be simple,
complex things should be possible.„
KingRecycle
Prole
Posts: 44 Joined: Thu May 24, 2012 1:01 am
Post
by KingRecycle » Sun May 27, 2012 6:44 pm
I am having a problem with the player sprite not detecting obstacle walls until half of his body touches the tile. This started when I tried to get the player to move smoothly instead of tile by tile.
Attachments
ProjectLearn.love
(5.99 MiB) Downloaded 157 times
Kadoba
Party member
Posts: 399 Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma
Post
by Kadoba » Sun May 27, 2012 7:24 pm
SimonLarsen wrote: I think you misunderstand. I'm talking about the id's returned by map.tileLayers.layer.tileData(x,y). They are assigned by ATL not me.
This was definitely a bug but it should be fixed now.
KingRecycle
Prole
Posts: 44 Joined: Thu May 24, 2012 1:01 am
Post
by KingRecycle » Sun May 27, 2012 9:05 pm
It seems ATL thinks the sprites body is his right foot instead of his whole body for some reason.
Kadoba
Party member
Posts: 399 Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma
Post
by Kadoba » Sun May 27, 2012 10:13 pm
KingRecycle wrote: It seems ATL thinks the sprites body is his right foot instead of his whole body for some reason.
I'm having a hard time following your code. How exactly are you doing the collision detection?
KingRecycle
Prole
Posts: 44 Joined: Thu May 24, 2012 1:01 am
Post
by KingRecycle » Sun May 27, 2012 10:48 pm
Kadoba wrote: KingRecycle wrote: It seems ATL thinks the sprites body is his right foot instead of his whole body for some reason.
I'm having a hard time following your code. How exactly are you doing the collision detection?
Well it checks if the next tile has the obstacle property. Takes the tile the player is on and adds to it the direction the player is moving for the next tile.
So if the next tile is an obstacle tile it doesn't let the player move that direction.
SimonLarsen
Party member
Posts: 100 Joined: Thu Mar 31, 2011 4:47 pm
Location: Denmark
Contact:
Post
by SimonLarsen » Mon May 28, 2012 9:41 am
Kadoba wrote: This was definitely a bug but it should be fixed now.
Yeah, just saw the commit. It works now. Thanks a bunch man, the library is great.
Users browsing this forum: No registered users and 7 guests