Advertisement
Guest User

Test

a guest
May 24th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. local halfW = display.contentWidth * 0.5
  2. local halfH = display.contentHeight * 0.5
  3.  
  4. local vertices = { 0,-110, 27,-35, 105,-35, 43,16, 65,90, 0,45, -65,90, -43,15, -105,-35, -27,-35, }
  5.  
  6. local o = display.newPolygon( halfW, halfH, vertices )
  7. o.fill = { type="image", filename="mountains.png" }
  8. o.strokeWidth = 10
  9. o:setStrokeColor( 1, 0, 0 )
  10.    
  11. o.rotation = math.random(360)
  12. local dr = math.random( 1, 4 )
  13.     o.dr = dr
  14.     if ( math.random() < 0.5 ) then
  15.         o.dr = -dr
  16.     end
  17.  
  18. table.insert( o, o )
  19.     --table.insert( stars, myStar )
  20.     function o:enterFrame( event )
  21.  
  22.     for i,v in ipairs( self ) do
  23.         v.rotation = v.rotation+ v.dr
  24.     end
  25. end
  26. Runtime:addEventListener( "enterFrame", o )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement