Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local nfte = require "nfte"
- local mon = peripheral.find("monitor")
- if mon then
- mon.setTextScale(0.5)
- term.redirect(mon)
- end
- local scr_x, scr_y = term.getSize()
- local logo = {
- xvel = 1, --math.random(0, 3) - 1.5,
- yvel = 1, --math.random(0, 3) - 1.5,
- x = scr_x / 2,
- y = scr_y / 2,
- img = nfte.loadImage("dvdlogo.nft")
- }
- local render = function()
- term.clear()
- nfte.drawImage(logo.img, math.floor(logo.x), math.floor(logo.y))
- end
- local max, min = math.max, math.min
- local tick = function()
- local imgXsize, imgYsize = nfte.getSize(logo.img)
- local xWall = scr_x - imgXsize + 1
- local yWall = scr_y - imgYsize + 1
- logo.x = min(max(logo.x + logo.xvel, 1), xWall)
- logo.y = min(max(logo.y + logo.yvel, 1), yWall)
- if math.floor(logo.x) == 1 or math.floor(logo.x) == xWall then
- logo.xvel = -logo.xvel
- end
- if math.floor(logo.y) == 1 or math.floor(logo.y) == yWall then
- logo.yvel = -logo.yvel
- end
- render()
- end
- while true do
- tick()
- sleep(0.05)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement