0 Members and 1 Guest are viewing this topic.
-- base functionslocal clear = zmg.clearlocal drawCircle = zmg.drawCirclelocal drawLine = zmg.drawLinelocal drawPoint = zmg.drawPointlocal drawRectFill = zmg.drawRectFilllocal drawText = zmg.drawTextlocal fastCopy = zmg.fastCopylocal keyMenuFast = zmg.keyMenuFastlocal keyDirectPoll = zmg.keyDirectPolllocal keyDirect = zmg.keyDirectlocal makeColor = zmg.makeColorlocal floor = math.floorlocal sin = math.sinlocal cos = math.coslocal pi = math.pi-- major varslocal key = {f1=79, f2=69, f3=59, f4=49, f5=39, f6=29, alpha=77, exit=47, optn=68, up=28, down=37, left=38, right=27, exe=31, shift=78}local color = {bg=makeColor("white"), fg=makeColor("gray")}local exit=0-- 3d varslocal move = {x=50,y=50} local piv = {x=0, y=0}local angle = {z=0}local roffset = {x=0, y=0}local x = 0local y = 0local xd = 0local yd = 0local scale = 1-- 3d arrayslocal cube = {x,y}cube.x = {-20, 20, -20, 20}cube.y = {-20, -20, 20, 20}-- functionslocal function d2r(angle) return angle*(pi/180)endlocal function drawCrosshair(x, y, size, color) drawLine(x-size, y, x+size, y, color) drawLine(x, y-size, x, y+size, color)end-- 3dwhile exit~=1 do keyDirectPoll() clear() -- SPLAT BEGIN for i=1, 4, 1 do xd = cube.x[i]-piv.x yd = cube.y[i]-piv.y roffset.x = xd*cos(d2r(angle.z)) - yd*sin(d2r(angle.z)) - xd roffset.y = xd*sin(d2r(angle.z)) - yd*cos(d2r(angle.z)) - yd x = (cube.x[i] + roffset.x) / scale + move.x y = (cube.y[i] + roffset.y) / scale + move.y drawCrosshair(x, y, 5/scale, color.fg) end if keyDirect(key.left)>0 then move.x = move.x-2 end if keyDirect(key.right)>0 then move.x = move.x+2 end if keyDirect(key.up)>0 then move.y = move.y-2 end if keyDirect(key.down)>0 then move.y = move.y+2 end if keyDirect(key.f1)>0 then scale = scale*1.02 end if keyDirect(key.f2)>0 then scale = scale/1.02 end if keyDirect(key.f3)>0 then angle.z = angle.z-1 end if keyDirect(key.f4)>0 then angle.z = angle.z+1 end if keyDirect(key.exit)>0 then exit=1 end -- SPLAT END drawText(1, 1, angle.z, color.fg, color.bg) fastCopy()end
"welcome to the world of computers, where everything seems to be based on random number generators"