improvement: use directly a table for box attr
This commit is contained in:
parent
b071547630
commit
9993221e0d
4 changed files with 14 additions and 22 deletions
|
@ -145,20 +145,17 @@ end
|
|||
function Actor2D:addHitboxFromFrameData(framedata, animationID, frameID, hitboxID)
|
||||
local sx, sy = self.sprite:getScalling()
|
||||
local type = framedata[1]
|
||||
local ox = framedata[2]
|
||||
local oy = framedata[3]
|
||||
local w = framedata[4]
|
||||
local h = framedata[5]
|
||||
local isSolid = framedata[6] or false
|
||||
local box = framedata[2]
|
||||
local isSolid = framedata[3] or false
|
||||
local anim = animationID or "null"
|
||||
local frame = frameID or 0
|
||||
local id = hitboxID or 0
|
||||
|
||||
if (type == "main") then
|
||||
self.mainHitbox:setFromData({ox, oy, w, h}, sx, sy)
|
||||
self.mainHitbox:setFromData(box, sx, sy)
|
||||
else
|
||||
local hitboxName = anim .. frame .. type .. id
|
||||
self:addHitbox(hitboxName, type, {ox, oy, w, h}, sx, sy, isSolid)
|
||||
self:addHitbox(hitboxName, type, box, sx, sy, isSolid)
|
||||
return hitboxName
|
||||
end
|
||||
end
|
||||
|
|
|
@ -167,22 +167,17 @@ end
|
|||
function Actor3D:addHitboxFromFrameData(framedata, animationID, frameID, hitboxID)
|
||||
local sx, sy = self.sprite:getScalling()
|
||||
local type = framedata[1]
|
||||
local ox = framedata[2]
|
||||
local oy = framedata[3]
|
||||
local oz = framedata[4]
|
||||
local w = framedata[5]
|
||||
local h = framedata[6]
|
||||
local d = framedata[7]
|
||||
local isSolid = framedata[8] or false
|
||||
local box = framedata[2]
|
||||
local isSolid = framedata[3] or false
|
||||
local anim = animationID or "null"
|
||||
local frame = frameID or 0
|
||||
local id = hitboxID or 0
|
||||
|
||||
if (type == "main") then
|
||||
self.mainHitbox:setFromData({ox, oy, oz, w, h, d}, sx, sy)
|
||||
self.mainHitbox:setFromData(box, sx, sy)
|
||||
else
|
||||
local hitboxName = anim .. frame .. type .. id
|
||||
self:addHitbox(hitboxName, type, {ox, oy, oz, w, h, d}, sx, sy, isSolid)
|
||||
self:addHitbox(hitboxName, type, box, sx, sy, isSolid)
|
||||
return hitboxName
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
return {
|
||||
["idle"] = {
|
||||
{
|
||||
{"main", 0, 0, 0, 16, 16, 24, true}
|
||||
{"main", {0, 0, 0, 16, 16, 24}, true}
|
||||
}
|
||||
},
|
||||
["punch"] = {
|
||||
{
|
||||
{"main", 0, 0, 0, 16, 16, 24, true},
|
||||
{"punch", 16, 2, 6, 12, 12, 12, false}
|
||||
{"main", {0, 0, 0, 16, 16, 24}, true},
|
||||
{"punch", {16, 2, 6, 12, 12, 12}, false}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
return {
|
||||
["idle"] = {
|
||||
{
|
||||
{"main", 0, 0, 16, 24, true}
|
||||
{"main", {0, 0, 16, 24}, true}
|
||||
}
|
||||
},
|
||||
["punch"] = {
|
||||
{
|
||||
{"main", 0, 0, 16, 24, true},
|
||||
{"punch", 16, 6, 12, 12, false}
|
||||
{"main", {0, 0, 16, 24}, true},
|
||||
{"punch", {16, 6, 12, 12}, false}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue