Object = {class = "Object"} function Object:new2d(name,texture,x,y,z,scalex,scaley) o = { -- basic model data name = name or "", model = g3d.newModel("assets/objects/vertical_plane.obj",texture, {x,y,z} or {0,0,0}, {0,0,0}, {scalex,scaley,0} or {16,16,0}), -- 2D rotate_mode = "cam_xz", -- animation is_animated = false } o.model:makeNormals() setmetatable(o, self) self.__index = self return o end function Object:new2DAnimated(name,texture,x,y,z,scalex,scaley,apath,frames,speed) o = { -- basic model data name = name or "", model = g3d.newModel("assets/objects/vertical_plane.obj",texture, {x,y,z} or {0,0,0}, {0,0,0}, {scalex,scaley,0} or {16,16,0}), -- 2D rotate_mode = "cam_xz", -- animation is_animated = true, anim_path = nil, anim_frames = 1, anim_frame = 1, anim_subframe = 1, anim_speed = 1, anim_imgs = {} } o.model:makeNormals() setmetatable(o, self) self.__index = self return o end function load_animation(o,path,frames,speed) o.anim_path = path or nil o.anim_frames = frames or 4 o.anim_speed = speed or frames if o.anim_path ~= nil then for i = 1, o.anim_frames, 1 do table.insert(o.anim_imgs,love.graphics.newImage(o.anim_path..tostring(i)..".png")) end end end