代码非常非常短
-- 2Dto3D
-- Use this function to perform your initial setup
function setup()
print("Hello World!")
FR={x=WIDTH/2,y=HEIGHT/2}
SR={x=WIDTH/2,y=HEIGHT/2}
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
stroke(255, 255, 255, 255)
fill(255, 255, 255, 0)
rectMode(CENTER)
rect(SR.x,SR.y,150,150)
rect(FR.x,FR.y,200,200)
line(FR.x-100+5,FR.y-100+5,SR.x-75+3,SR.y-75+3)
line(FR.x-100+5,FR.y+100-5,SR.x-75+3,SR.y+75-3)
line(FR.x+100-5,FR.y-100+5,SR.x+75-3,SR.y-75+3)
line(FR.x+100-5,FR.y+100-5,SR.x+75-3,SR.y+75-3)
-- This sets the line thickness
strokeWidth(5)
-- Do your drawing here
end
function touched(touch)
FR.x=FR.x+touch.deltaX
FR.y=FR.y+touch.deltaY
SR.x=SR.x+touch.deltaX/1.5
SR.y=SR.y+touch.deltaY/1.5
end
-- 2Dto3D
-- Use this function to perform your initial setup
function setup()
print("Hello World!")
FR={x=WIDTH/2,y=HEIGHT/2}
SR={x=WIDTH/2,y=HEIGHT/2}
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
stroke(255, 255, 255, 255)
fill(255, 255, 255, 0)
rectMode(CENTER)
rect(SR.x,SR.y,150,150)
rect(FR.x,FR.y,200,200)
line(FR.x-100+5,FR.y-100+5,SR.x-75+3,SR.y-75+3)
line(FR.x-100+5,FR.y+100-5,SR.x-75+3,SR.y+75-3)
line(FR.x+100-5,FR.y-100+5,SR.x+75-3,SR.y-75+3)
line(FR.x+100-5,FR.y+100-5,SR.x+75-3,SR.y+75-3)
-- This sets the line thickness
strokeWidth(5)
-- Do your drawing here
end
function touched(touch)
FR.x=FR.x+touch.deltaX
FR.y=FR.y+touch.deltaY
SR.x=SR.x+touch.deltaX/1.5
SR.y=SR.y+touch.deltaY/1.5
end