Advertisement
Guest User

TEST2

a guest
May 16th, 2012
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.35 KB | None | 0 0
  1.  
  2. Test2 = class()
  3.  
  4. function Test2:name()
  5.     return "Codea Primitives in 3D"
  6. end
  7.  
  8. function Test2:init()
  9.     -- you can accept and set parameters here
  10. end
  11.  
  12. function Test2:draw()    
  13.     -- Preserve existing transform and style
  14.     clip(-1000,-1000,2000,2000)
  15.     clip()
  16.     pushMatrix()
  17.      camera(0,0,0,-300,-700,0,0,1,0)
  18.     pushStyle()
  19.    rotate(-1*angx,1,0,0)
  20.    rotate(angy,0,0,1)
  21.     translate(tlz,-300,tlx)
  22.     --translate(
  23.     
  24.     -- This sets the line thickness
  25.     strokeWidth(5)
  26.  
  27.     smooth()
  28.     rectMode(CENTER)
  29.  
  30.     -- Make a floor
  31.     translate(0,-Size/2,0)
  32.     rotate(Angle,0,1,0)
  33.     rotate(90,1,0,0)
  34.     sprite("SpaceCute:Background", 0, 0, 300, 300)
  35.     --wall
  36.  
  37.     -- Rotate and translate the square
  38.     resetMatrix()
  39.     translate(0,0,0)
  40.    rotate(-1*angx,1,0,0)
  41.    rotate(angy,0,0,1)
  42.     rotate(Angle,0,1,0)
  43.     translate(-200, -300, -100)
  44.  translate(tlz,0,tlx)
  45.     fill(44, 97, 161, 255)
  46.     rect(0, 0, Size, Size)
  47.  
  48.    -- resetMatrix()
  49.   --   translate(tlz,0,tlx)
  50.   --  translate(0,-300,0)
  51. --   rotate(-1*angx,1,0,0)
  52.  --  rotate(angy,0,0,1)
  53.     --rotate(Angle,0,1,0)
  54.     fill(191, 26, 26, 255)
  55.     ellipse(0, 0, Size*0.8)
  56.     
  57.     -- Restore transform and style
  58.     popStyle()
  59.     popMatrix()
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement