Guest User

Untitled

a guest
Nov 18th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. Track = class()
  2.  
  3. function Track:init(x, y, dir)
  4.     self.x = x
  5.     self.y = y
  6.     self.dir = dir
  7.     self.active = 1
  8.     self.turn = 0
  9.     self.bounds = Frame(self.x - 5, self.y - 5, 
  10.     self.x + 5, self.y + 5)
  11. end
  12.  
  13. function Track:draw()
  14.     local i
  15.     i = self.active - 1
  16.     if self.active > 1 then self.active = self.active + 1 end
  17.     pushStyle()
  18.     strokeWidth(1)
  19.     stroke(255, 198, 0, 176)
  20.     noFill()
  21.     pushMatrix()
  22.     translate(self.x, self.y)
  23.     rotate(self.dir)
  24.     rotate( i * 20)
  25.     scale(1 + i * 0.1)
  26.     rect(-15, -10, -5, 5)
  27.     rect(-18, 8, -14, 12)
  28.     rect(-12, 8, -8, 12)
  29.     rect(-6, 8, -2, 12)
  30.     rotate(-i * 40)
  31.     rect(5, 0, 15, 15)
  32.     rect(2, 18, 6, 22)
  33.     rect(8, 18, 12, 22)
  34.     rect(14, 18, 18, 22)
  35.     
  36.     popMatrix()
  37.     popStyle()
  38. end
Add Comment
Please, Sign In to add comment