mirror of
https://github.com/LDDestroier/CC/
synced 2025-03-04 10:38:10 +00:00
Add color change when hitting border (#9)
This commit is contained in:
parent
82d3e236a1
commit
634dc7d7e1
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user