1
0
mirror of https://github.com/LDDestroier/CC/ synced 2024-12-12 11:10:28 +00:00

Add color change when hitting border (#9)

This commit is contained in:
JackMacWindows 2020-02-08 18:22:35 -05:00 committed by GitHub
parent 82d3e236a1
commit 634dc7d7e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,6 +120,8 @@ local render = function(colorReplace)
end
end
local color = math.random(1, 15)
local tick = function()
scr_x, scr_y = term.getSize()
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
logo.xvel = -logo.xvel
color = math.random(1, 15)
end
if floor(logo.y) == (1 + yMargin) or floor(logo.y) == yWall then
logo.yvel = -logo.yvel
color = math.random(1, 15)
end
render()
render(string.sub("0123456789abcdef", color, color))
end
term.setBackgroundColor(colors.black)