class 'p04_l03_z04_move' (Script)

function p04_l03_z04_move:__init()super()
 self.object={}
 self.tweener={}
 self.shiftX=700
self.speed=200

 self.load=false

 self.position={}
end

function p04_l03_z04_move:on_attach()
  local scene=self:scene()

 self.object[1]={}
 self.tweener[1]={}
 for l=1,8 do
   self.object[1][l]=scene:object('line0'..l)
   self.tweener[1][l]=tweener()
 end

  self.object[2]={}
  self.tweener[2]={}
  for s=1,9 do
  self.object[2][s]=scene:object('i'..s)
  self.tweener[2][s]=tweener()
 end

  self.object[3]={}
  self.object[3][1]=scene:object('background02')
  self.object[3][2]=scene:object('fx_win')
  self.object[3][3]=scene:object('lines_border')
  self.tweener[3]={}
  for t=1,#self.object[3] do
      --fx_win
   self.tweener[3][t]=tweener()
  end


 if self.load then
   for a=1,#self.object do
   for b=1,#self.object[a] do
    self.object[a][b]:set_position(Position(self.position[a][b]:x()-self.shiftX,self.position[a][b]:y()),true)
   end
  end
 else
  for a=1,#self.object do
   self.position[a]={}
   for b=1,#self.object[a] do
    self.position[a][b]=self.object[a][b]:position()
   end
  end
  self:moveS()
 end
 self.load=false
end

function p04_l03_z04_move:on_update(dt)
 for i=1,#self.tweener do
  for j=1,#self.tweener[i] do
     self.tweener[i][j]:update(dt)
  end
 end
end

function p04_l03_z04_move:moveS()
 for i=1,#self.tweener do
  for j=1,#self.tweener[i] do
     self.tweener[i][j]:getsParmsMove(self.object[i][j],self.speed,self.object[i][j]:position(),Position(self.object[i][j]:position():x()- self.shiftX,self.object[i][j]:position():y()))
  end
 end
end

function p04_l03_z04_move:save(os)
  os:save(0) -- version
  os:save(true)
  os:save(#self.object)
  for a=1,#self.object do
   os:save(#self.object[a])
   for b=1,#self.object[a] do
    os:save(self.position[a][b])
   end
  end
end

function p04_l03_z04_move:load(is)
  local ver = is:load()
  self.load = is:load()
  local size = is:load()
  for a=1,size do
   local size2=is:load()
   self.position[a]={}
   for b=1,size2 do
    self.position[a][b]=is:load()
   end
  end
end