1vine = class:new() 2 3function vine:init(x, y, t) 4 self.cox = x 5 self.coy = y 6 self.t = t 7 8 if self.t == "start" then 9 self.limit = 9+1/16 10 else 11 self.limit = -1 12 end 13 14 self.timer = 0 15 16 self.width = 10/16 17 self.height = 0 18 19 self.x = x-0.5-self.width/2 20 self.y = y-1 21 22 self.static = true 23 self.active = true 24 25 self.category = 18 26 27 self.mask = {true} 28 29 testtimer = love.timer.getTime() 30 31 --IMAGE STUFF 32 self.drawable = false 33end 34 35function vine:update(dt) 36 if self.y > self.limit then 37 self.y = self.y - vinespeed*dt 38 self.height = self.coy-self.y-1.7 39 if self.y <= self.limit then 40 self.y = self.limit 41 self.height = self.coy-self.limit-1.7 42 end 43 self.height = math.max(self.height, 0) 44 end 45end 46 47function vine:draw() 48 love.graphics.setScissor(0, 0, width*16*scale, (self.coy-1.5)*16*scale) 49 50 love.graphics.drawq(vineimg, vinequad[spriteset][1], math.floor((self.x-xscroll-1/16-((1-self.width)/2))*16*scale), (self.y-0.5-2/16)*16*scale, 0, scale, scale) 51 for i = 1, math.ceil(self.height-14/16+.7) do 52 love.graphics.drawq(vineimg, vinequad[spriteset][2], math.floor((self.x-xscroll-1/16-((1-self.width)/2))*16*scale), (self.y-0.5-2/16+i)*16*scale, 0, scale, scale) 53 end 54 55 56 love.graphics.setScissor() 57end