Discord
Login
Community
DARK THEME

function not found in class

init = function() floaty = new boat(50, 20) yacht = new boat(20, 70) bruh_boat = new boat(-50, -20) end

update = function() end

draw = function()

floaty.display() floaty.move(1)

bruh_boat.display() bruh_boat.move(.5)

yacht.display() yatcht.move(3)

end

boat = class constructor = function(x,y) this.x = x this.y = y this.size = random.next()50+25 this.rot = random.next360 end move = function(velocity) this.x += cosd(this.rot) * velocity this.y += cosd(this.rot) * velocity end display = function() screen.setDrawRotation(this.rot) screen.fillRound(this.x,this.y,this.size,this.size/2, "#620") screen.setLineWidth(4) screen.drawRound(this.x, this.y, this.size, this.size/2, "#620") end end

Warning: yatcht.move(3) is not a function, in file "main" at line 19, column 16

init = function() 
  floaty = new boat(50, 20) 
  yacht = new boat(20, 70) 
  bruh_boat = new boat(-50, -20) 
end

update = function() end

draw = function()
   floaty.display() floaty.move(1)
   bruh_boat.display() bruh_boat.move(.5)
   yacht.display() yatcht.move(3)
end

boat = class 
   constructor = function(x,y) 
      this.x = x 
      this.y = y 
      this.size = random.next()50+25   <<< syntax error  >> random.nextInt( 50 ) + 25  
      this.rot = random.next360  << syntax error   you may want this code   >> random.nextInt( 360 ) 
   end  
   move = function(velocity) 
      this.x += cosd(this.rot) * velocity 
      this.y += cosd(this.rot) * velocity 
   end 
   display = function() 
      screen.setDrawRotation(this.rot) 
      screen.fillRound(this.x,this.y,this.size,this.size/2, "#620") 
      screen.setLineWidth(4) screen.drawRound(this.x, this.y, this.size, this.size/2, "#620") 
   end 
end

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community