48 lines
907 B
Lua
48 lines
907 B
Lua
screen = peripheral.wrap("create_source_1")
|
|
|
|
robot = peripheral.wrap("animatronic_1")
|
|
|
|
messages = {
|
|
"Menu coming soon!",
|
|
"Don't miss our opening day 50% off!",
|
|
"The best vegan* fast food available"
|
|
}
|
|
rotations = {360-40, 360-20, 0, 360+20, 360+40}
|
|
|
|
n=1
|
|
function update_rot()
|
|
n = n%5 + 1
|
|
target_rot = 180 + rotations[n]
|
|
if target_rot > 180 then
|
|
target_rot = target_rot - 360
|
|
end
|
|
robot.setBodyRot(0, target_rot, 0)
|
|
robot.setFace("sad")
|
|
robot.push()
|
|
-- sleep(1.5)
|
|
-- for i = 1, 5 do
|
|
|
|
-- end
|
|
end
|
|
|
|
message_time = 5
|
|
message_index = 1
|
|
pose_time = 0
|
|
dt = 0.1
|
|
while true do
|
|
sleep(dt)
|
|
pose_time = pose_time + dt
|
|
if pose_time > 0.4 then
|
|
pose_time = 0
|
|
--
|
|
end
|
|
message_time = message_time + dt
|
|
if message_time > 4 then
|
|
message_time = 0
|
|
screen.clear()
|
|
screen.setCursorPos(1, 1)
|
|
screen.write(messages[message_index])
|
|
message_index = (message_index % #messages) + 1
|
|
end
|
|
update_rot()
|
|
end
|