1
0
mirror of https://github.com/LDDestroier/CC/ synced 2024-06-16 18:29:58 +00:00

Add color change when hitting border

This commit is contained in:
JackMacWindows 2020-02-08 18:17:24 -05:00 committed by GitHub
parent 82d3e236a1
commit 6414c360c8

View File

@ -120,6 +120,8 @@ local render = function(colorReplace)
end end
end end
local color = math.random(1, 15)
local tick = function() local tick = function()
scr_x, scr_y = term.getSize() scr_x, scr_y = term.getSize()
xWall = scr_x - imgXsize + 1 - xMargin xWall = scr_x - imgXsize + 1 - xMargin
@ -129,11 +131,13 @@ local tick = function()
if floor(logo.x) == (1 + xMargin) or floor(logo.x) == xWall then if floor(logo.x) == (1 + xMargin) or floor(logo.x) == xWall then
logo.xvel = -logo.xvel logo.xvel = -logo.xvel
color = math.random(1, 15)
end end
if floor(logo.y) == (1 + yMargin) or floor(logo.y) == yWall then if floor(logo.y) == (1 + yMargin) or floor(logo.y) == yWall then
logo.yvel = -logo.yvel logo.yvel = -logo.yvel
color = math.random(1, 15)
end end
render() render(string.sub("0123456789abcdef", color, color))
end end
term.setBackgroundColor(colors.black) term.setBackgroundColor(colors.black)