daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest Oct 22nd, 2018 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- we have four colors of apples: two meshes, two materials, and two textures.
  2. -- one mesh uses the top half of the texture, the other uses the bottom half.
  3. -- one material is for the red texture, the other is for the green one.
  4. -- This is basically a randomiser that picks one mesh and one material out of the options available and creates one of the 4 colors of apple.
  5. function apple(lthing)
  6.     num = math.random(4)
  7.     local name
  8.     local mat
  9.    
  10.     if num > 2 then
  11.         name = "Apple1"
  12.     else
  13.         name = "Apple2"
  14.     end
  15.    
  16.     if num == 1 or num == 3 then
  17.         mat = "RedApple"
  18.     else
  19.         mat = "GreenApple"
  20.     end
  21.    
  22.     t = spawn(name, lthing.SpawnPosition)
  23.     setMaterial(t, mat)
  24.    
  25.     lthing:Dispose()
  26. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top