Last active
August 31, 2019 16:20
-
-
Save leenattress/ae17b06be46a26c6d45ff33081747d1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
actorData = { | |
tank = {1,2,3,4,5,6,7,8} | |
} | |
--a is angle | |
for i=1,8 do | |
if (actorData.tank[i]) then | |
spra(a,actorData.tank[i],x,y-i) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function spra(angle,n,x,y,w,h,f_x,f_y) | |
if w==nil or h==nil then | |
w,h=8,8 | |
else | |
w=w*8 | |
h=h*8 | |
end | |
local diag,w,h=flr(sqrt(w*w+h*h))/2,w/2,h/2 | |
f_x,f_y=f_x and -1 or 1,f_y and -1 or 1 | |
local cosa,sina,nx,ny=cos(angle),sin(angle),n%16*8,flr(n/16)*8 | |
for i=-diag,diag do | |
for j=-diag,diag do | |
local ox,oy=(cosa*i + sina*j),(cosa*j - sina*i) | |
if ox==mid(-w,ox,w) and oy==mid(-h,oy,h) then | |
local col=sget(ox+w+nx,oy+h+ny) | |
if col!=14 then | |
--if(f_x*i+w>5) then col = darken[col]; end --shading and light hack | |
pset(x+f_x*i+w,y+f_y*j+h,col) | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment