This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
ssandiss's profile picture

Adding Animations to a program

Started by ssandiss, 11 May 2013 - 03:05 PM
ssandiss #1
Posted 11 May 2013 - 05:05 PM
Hey, i am working on my project Slots Alpha V0.1 and i thought i'd add a animation lever, but i don't know how to add animations

Is it the same as how you add pricutes fron npaintpro?
Becuase i tried that, and it didn't work.

Please help me
Engineer #2
Posted 11 May 2013 - 05:25 PM
You literally draw the screen over and over with a little change in it. And you are doing this with a very, very small delay in between
ssandiss #3
Posted 11 May 2013 - 05:25 PM
I know, but if i use npaintpro and then save it as a .nfa file, how do i draw it inside the program?
ssandiss #4
Posted 12 May 2013 - 03:12 AM
I still need help :(/>
svdragster #5
Posted 12 May 2013 - 07:40 AM


pictureName = paintutils.loadImage(pathOfLePicture)
paintutils.drawImage(pictureName, x, y)

So if you want an animation, do this:


gordonF = paintutils.loadImage("/pictures/gordonF")
screenX, screenY = term.getSize()


x, y = 1, 1
while x <= screenX do
  term.setBackgroundColour( colors.black )
  term.clear()
  paintutils.drawImage(gordonF, x, y)
  x = x + 1
  sleep(0.2)
end

This loads the picture gordonF, and gets the size of the screen.
It will clear the screen and draw the picture at x, y which is 1 and 1.
It will add 1 to x every 0.2 seconds, and also draws it now at x, y = 2, 1

This means the picture will move out of the screen at the right.
ssandiss #6
Posted 12 May 2013 - 07:51 AM
I want to add a animation picture from npaintpro.
Like i did a .nfa file and want to use it in a program.
Engineer #7
Posted 12 May 2013 - 09:08 AM
I want to add a animation picture from npaintpro.
Like i did a .nfa file and want to use it in a program.
I think its better to ask this in the thread of npaintpro. Because its a custom program, and personally I dont know how to use it.
GravityScore #8
Posted 12 May 2013 - 09:28 AM
I want to add a animation picture from npaintpro.
Like i did a .nfa file and want to use it in a program.

Use Lightshot to record the .nfa. It'll generate a file that will show the animation when run (using shell.run or just running it from the shell).