Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function editor:selection()
- -- hilights the entity when mouseover
- editor.selname = "null"
- for i, type in pairs(world.entities) do
- print (type.group)
- for _,e in ipairs(type) do
- --deselect all before continuing
- --(fixes texture change issue with platforms)
- e.selected = false
- end
- --reverse loop
- for _,e in ripairs(type) do
- if world:inview(e) then
- editor.selname = e.group .. "("..i..")"
- if e.movex == 1 then
- --collision area for moving entity
- if collision:check(self.mouse.x,self.mouse.y,1,1,e.xorigin, e.y, e.movedist+e.w, e.h) then
- love.graphics.rectangle("line", e.xorigin, e.y, e.movedist+e.w, e.h)
- e.selected = true
- return true
- end
- elseif e.movey == 1 then
- --collision area for moving entity
- if collision:check(self.mouse.x,self.mouse.y,1,1,e.xorigin, e.yorigin, e.w, e.h+e.movedist) then
- love.graphics.rectangle("line", e.xorigin, e.yorigin,e.w, e.h+e.movedist)
- e.selected = true
- return true
- end
- elseif e.swing == 1 then
- --collision area for swinging entity
- if collision:check(self.mouse.x,self.mouse.y,1,1,
- e.xorigin-platform_link_origin:getWidth()/2, e.yorigin-platform_link_origin:getHeight()/2,
- platform_link_origin:getWidth(),platform_link_origin:getHeight()) then
- love.graphics.rectangle("line",
- e.xorigin-platform_link_origin:getWidth()/2, e.yorigin-platform_link_origin:getHeight()/2,
- platform_link_origin:getWidth(),platform_link_origin:getHeight()
- )
- e.selected = true
- return true
- end
- elseif collision:check(self.mouse.x,self.mouse.y,1,1,e.x,e.y,e.w,e.h) then
- --collision area for static entities
- love.graphics.rectangle("line", e.x,e.y,e.w,e.h)
- e.selected = true
- self.texturesel = e.texture or 1
- return true
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement