Jigoku / boxclip

2D platformer engine using LÖVE and Lua
https://jigoku.github.io/boxclip/
GNU General Public License v3.0
93 stars 8 forks source link

Feature/editor #108

Closed rufio72 closed 3 years ago

rufio72 commented 3 years ago

I have separated some files and the drag and drop starts to work. I don't like that the movement is in the file editorMouse.lua, also I would like to separate the various menus and features in different files.

Also I have seen that very often a for loop is run to find the selected entity. I thought to solve this by copying the entity in a variable of the editor. I tested it in keypressed and it works.

editor.isSelected = false 
editor.entitySelected = {}

It's not finished yet, if you have any suggestions or improvements, write me.

Jigoku commented 3 years ago

Would be preferred to keep all the editor code in the one file

rufio72 commented 3 years ago

ok

rufio72 commented 3 years ago

It seems to work. The objects can be moved with the mouse. Please do some tests and tell me if you find any problems. The file editor/init.lua has been heavily modified, so at the time of merge you will probably encounter problems.

Jigoku commented 3 years ago

I would say to keep editor functions with use of the colon, eg; editor:draw() so that editor related things can be called from within by self.

Also it's my fault that there is no coding guidelines for this project yet, but i would ask try to avoid camelCasing in vars/functions; i did intend to remove all of those eventually (except the love related functions) for readability.

Jigoku commented 3 years ago

I would ask to try and avoid use of editor within the editor code, and instead use self.var or self:function(). So it would also mean keeping the functions written as editor:mouseMoveEntity() instead of editor.mouseMoveEntity().

Other than that, there are no code guidelines currently (which is my fault), but ideally i have planned on replacing any camelCasing naming. So those could be better named as editor:moveent or editor:move_entity etc

(edit; oops double posted, thought my last comment didn't go through)

rufio72 commented 3 years ago

ok I modified the file to the new rules. I think the drag and drop is finished. Let me know if there are any further changes or suggestions. I tested it and it seems to work.

See you next

Jigoku commented 3 years ago

Looks good, great improvement for moving entities about. There's a small bug with the last selected entity getting stuck to the mouse, but i already know what's causing it, i'll fix shortly after merging :+1: