Make Text Move Along a Slope? (1.12.2)

Started by Yoshim3to, Jan 03, 2021, 07:55 PM

Previous topic - Next topic

Yoshim3to

Just started ComputerCraft about a week or two ago, and I'm very new to coding in general.

I'm working on a project to create a DVD screensaver on a ComputerCraft monitor. Eventually I want to write a function that calculates slope when bouncing off of walls/corners, but for now I need to figure out how to make text move along a line in the first place. I assume it'll have something to do with getting the coordinates of each point on the line and writing the text using those coordinates as CursorPos, but I'm not sure how to grab that data from the line. Here's my code so far, just for drawing the line:


local monitorA = peripheral.wrap("right")
local heightA, widthA = monitorA.getSize()
print(heightA.."x"..widthA)
monitorA.setBackgroundColor(colors.black)
monitorA.clear()
monitorA.setTextScale(0.5)
term.redirect(monitorA)
paintutils.drawLine(0, 0, heightA, widthA, colors.red)

Any help is appreciated. Thanks :)

Lupus590

I would put your text into a window and use window.reposition() to move the window and thus it's contained text.

As for going along a line, I would look at the souce code of paint utils and how it's draw line function works.

https://tweaked.cc/module/window.html#ty:Window:reposition