visual tweaks

This commit is contained in:
kepler155c@gmail.com
2019-04-15 11:49:43 -04:00
parent b116e56676
commit 61e2a2e8bf
2 changed files with 37 additions and 17 deletions

View File

@@ -30,20 +30,41 @@ local hex = {
['e'] = 0xCC4C4C4F,
-- ['f'] = 0x191919FF, -- transparent
}
local canvas = device['plethora:glasses'] and device['plethora:glasses'].canvas()
if canvas then
canvas.clear() -- assuming we are the first to use the canvas
local w, h = canvas.getSize()
canvas.group = canvas.addGroup({ w - 30, h - 30 })
local function drawLine(k, line)
for i = 1, #line do
local pix = hex[line:sub(i, i)]
if pix then
canvas.group.addRectangle(i*1.5, k*2.25, 1.5, 2.25, pix)
local function update()
local canvas = device['plethora:glasses'] and device['plethora:glasses'].canvas()
if canvas then
local Tween = require('ui.tween')
canvas.clear()
local w, h = canvas.getSize()
local pos = { x = w / 2, y = h / 2 - 30 }
local group = canvas.addGroup(pos)
local function drawLine(k, line)
for i = 1, #line do
local pix = hex[line:sub(i, i)]
if pix then
group.addRectangle(i*1.5, k*2.25, 1.5, 2.25, pix)
end
end
end
end
for k,line in ipairs(opus) do
drawLine(k, line)
for k,line in ipairs(opus) do
drawLine(k, line)
end
os.sleep(.5)
local tween = Tween.new(40, pos, { x = w - 60, y = h - 30 }, 'outBounce')
repeat
local finished = tween:update(1)
os.sleep(0)
group.setPosition(pos.x, pos.y)
until finished
end
end
kernel.run({
title = 'opus',
env = _ENV,
hidden = true,
fn = update,
})

View File

@@ -33,7 +33,7 @@ local function fish()
local held = owner.heldItem and owner.heldItem.getMetadata()
if held and held.rawName == 'item.fishingRod' then
if icon then
icon.setItem('minecraft:fish', 1)
icon.setItem('minecraft:fish', math.random(0, 3))
end
kinetic.use(.2)
print('casting')
@@ -43,11 +43,10 @@ local function fish()
else
if icon then
icon.setItem('minecraft:fishing_rod')
icon.setScale(1)
end
print('waiting for fishing rod to be selected')
end
scale = 1
icon.setScale(1)
os.sleep(1)
else
if meta.y < depth then
@@ -67,4 +66,4 @@ pcall(fish)
if icon then
icon.remove()
end
end