Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Test2 = class()
- function Test2:name()
- return "Codea Primitives in 3D"
- end
- function Test2:init()
- -- you can accept and set parameters here
- end
- function Test2:draw()
- -- Preserve existing transform and style
- clip(-1000,-1000,2000,2000)
- clip()
- pushMatrix()
- camera(0,0,0,-300,-700,0,0,1,0)
- pushStyle()
- rotate(-1*angx,1,0,0)
- rotate(angy,0,0,1)
- translate(tlz,-300,tlx)
- --translate(
- -- This sets the line thickness
- strokeWidth(5)
- smooth()
- rectMode(CENTER)
- -- Make a floor
- translate(0,-Size/2,0)
- rotate(Angle,0,1,0)
- rotate(90,1,0,0)
- sprite("SpaceCute:Background", 0, 0, 300, 300)
- --wall
- -- Rotate and translate the square
- resetMatrix()
- translate(0,0,0)
- rotate(-1*angx,1,0,0)
- rotate(angy,0,0,1)
- rotate(Angle,0,1,0)
- translate(-200, -300, -100)
- translate(tlz,0,tlx)
- fill(44, 97, 161, 255)
- rect(0, 0, Size, Size)
- -- resetMatrix()
- -- translate(tlz,0,tlx)
- -- translate(0,-300,0)
- -- rotate(-1*angx,1,0,0)
- -- rotate(angy,0,0,1)
- --rotate(Angle,0,1,0)
- fill(191, 26, 26, 255)
- ellipse(0, 0, Size*0.8)
- -- Restore transform and style
- popStyle()
- popMatrix()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement