Difference between revisions of "Module:Hitboxes"
From ALttP Speedrunning Wiki
(Created page with "local p = {} local position_x = { 2, 3, 0, -3, -6, 0, 2, -8, 0, -4, -8, 0, -8, -16, 2, 2, 2, 2, 2, -8, 2, 2, -16, -8, -12, 4, -4, -12, 5, -32, -2, 4 } local size_x = {...") |
|||
Line 43: | Line 43: | ||
local hitbox_cell = row:tag('td') | local hitbox_cell = row:tag('td') | ||
+ | hitbox_cell :css({ width = position_x[i] + size_x[i] + 20 .. 'px', | ||
+ | height = position_y[i] + size_y[i] + 20 .. 'px' | ||
+ | }) | ||
make_hitbox(hitbox_cell, i) | make_hitbox(hitbox_cell, i) | ||
Revision as of 10:26, 31 May 2019
Documentation for this module may be created at Module:Hitboxes/doc
local p = {} local position_x = { 2, 3, 0, -3, -6, 0, 2, -8, 0, -4, -8, 0, -8, -16, 2, 2, 2, 2, 2, -8, 2, 2, -16, -8, -12, 4, -4, -12, 5, -32, -2, 4 } local size_x = { 12, 1, 16, 20, 20, 8, 4, 32, 48, 24, 32, 32, 32, 48, 12, 12, 60, 124, 12, 32, 4, 12, 48, 32, 40, 8, 24, 24, 5, 80, 4, 8 } local position_y = { 0, 3, 4, -4, -8, 2, 0, -16, 12, -4, -8, 0, -10, -16, 2, 2, 2, 2, -3, -12, 2, 10, 0, -12, 16, 4, -4, -12, 3, -16, -8, 10 } local size_y = { 14, 1, 16, 21, 24, 4, 8, 40, 20, 24, 40, 29, 36, 48, 60, 124, 12, 12, 17, 28, 4, 2, 28, 20, 10, 4, 24, 16, 5, 48, 8, 12 } function p.main(frame) local ret = mw.html.create('table') ret :tag('tr') :tag('th'):wikitext('ID'):done() :tag('th'):wikitext('Hitbox'):done() :done() for i, v in ipairs(size_x) do local row = ret:tag('tr') row :tag('td'):wikitext(i):done() local hitbox_cell = row:tag('td') hitbox_cell :css({ width = position_x[i] + size_x[i] + 20 .. 'px', height = position_y[i] + size_y[i] + 20 .. 'px' }) make_hitbox(hitbox_cell, i) row:done() end return ret end function make_hitbox(tag, i) local box = tag:tag('div') box :css({ position = 'relative', zoom = '200%' }) box :tag('div') -- OAM outline :css({ position = 'absolute', left = '1px', top = '1px', width = '14px', height = '14px', outline = '1px solid #FF0000', ['z-index'] = 1 }) :done() :tag('div') -- Cucco image :css({ position = 'absolute', left = 0, top = 0, ['z-index'] = 2 }) :wikitext('[[File:Cucco.png|link=]]') :done() :tag('div') -- hitbox :css({ position = 'absolute', background = 'rgba(00, 00, 256, 0.5)', left = position_x[i] .. 'px', top = position_y[i] .. 'px', width = size_x[i] .. 'px', height = size_y[i] .. 'px', ['z-index'] = 3 }) :done() :done() end return p