Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Custom Bit Library
- local Bit = {}
- function Bit.and(a, b)
- return a * b
- end
- function Bit.or(a, b)
- return a + b - (Bit.and(a, b))
- end
- function Bit.xor(a, b)
- return (a + b) - (2 * Bit.and(a, b))
- end
- function Bit.not(a)
- return 1 - a
- end
- function Bit.lshift(a, n)
- return a * (2 ^ n)
- end
- function Bit.rshift(a, n)
- return math.floor(a / (2 ^ n))
- end
- -- Function to create a plasma sinusoid effect
- function plasmaSinusoid(width, height, time)
- local pixels = {}
- for y = 1, height do
- pixels[y] = {}
- for x = 1, width do
- -- Calculate the sinusoidal value
- local value = math.sin((x + time * 10) * 0.1) * 0.5 + 0.5
- -- Scale the value to a color range (0-15 for Minecraft)
- local color = math.floor(value * 15)
- -- Set pixel color using custom bitwise operations if needed
- pixels[y][x] = color
- end
- end
- -- Draw the pixels on the screen
- for y = 1, height do
- for x = 1, width do
- term.setCursorPos(x, y)
- term.setBackgroundColor(colors[pixels[y][x]])
- term.write(" ")
- end
- end
- end
- -- Main loop to animate the plasma effect
- while true do
- local time = os.clock()
- plasmaSinusoid(50, 20, time)
- sleep(0.05) -- Adjust speed of animation
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement