Guest User

Simple dogurai door

a guest
Jun 14th, 2018
107
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function makedoor(x,y)
  2.     local door = LuaObject(x,y)
  3.  
  4.     door:SetWidth(8)
  5.     door:SetHeight(32)
  6.  
  7.     door.data.solid = false
  8.  
  9.     door.inside = false
  10.  
  11.     function door:OnUpdate(dt)
  12.         local playerPosition = g_player.getRect()
  13.         if g_collision.IsColliding(self:GetBox(),playerPosition) then
  14.             self.inside = true
  15.         else
  16.             if self.inside then
  17.                 self.data.solid = true
  18.             end
  19.         end
  20.     end
  21.     return door
  22. end
RAW Paste Data