From 61e2a2e8bf75c27cdc9dc2b496e9c06683f05500 Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Mon, 15 Apr 2019 11:49:43 -0400 Subject: [PATCH] visual tweaks --- neural/autorun/splash.lua | 47 ++++++++++++++++++++++++++++----------- neural/fisher.lua | 7 +++--- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/neural/autorun/splash.lua b/neural/autorun/splash.lua index 84465d2..bd395fb 100644 --- a/neural/autorun/splash.lua +++ b/neural/autorun/splash.lua @@ -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, +}) diff --git a/neural/fisher.lua b/neural/fisher.lua index a9ea2e2..5eb4195 100644 --- a/neural/fisher.lua +++ b/neural/fisher.lua @@ -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 \ No newline at end of file