Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local screen = window.create(term.current(),1,1,100,100)
- screen.setCursorPos(15,15)
- screen.write("haha")
- local pp2=0
- local pp3=0
- local motionX=0
- local motionY=0
- local event,p1,p2,p3,p4,p5
- while true do
- local posX,posY = screen.getPosition()
- event,p1,p2,p3,p4,p5 = os.pullEvent()
- if event=="mouse_click" and p1==2 then
- pp2=p2
- pp3=p3
- elseif event=="mouse_drag" and p1==2 then
- if pp2<p2 then
- motionX=1
- pp2=p2
- elseif pp2>p2 then
- motionX=-1
- pp2=p2
- else
- motionX=0
- pp2=p2
- end
- if pp3<p3 then
- motionY=1
- pp3=p3
- elseif pp3>p3 then
- motionY=-1
- pp3=p3
- else
- motionY=0
- pp3=p3
- end
- screen.reposition(posX+motionX,posY+motionY)
- elseif event=="mouse_click" and p1==3 then
- screen.reposition(1,1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment