-
2 Attachment(s)
GridSnap Object Idea
I encourage everyone to lay out out good ideas for unique extensions, just in case the devs are looking for inspiration.
One that I thought would be useful would be the GridSnap Object. It would be somewhat similar to EZGrid, but easier to use and more for applications and positioning.
Basically, it would have similar settings to EZGrid, but you would eb able to set any object ot "snap" a object to the grid when dropping it. It would allow us to use a grid during runtime just like like we do during edittime on the frame.
As per my example, using EZGrid becomes rather involved for this purpose, (and really needs an update and some streamling itself) so I would like this object to be able to work in a more straight forward way with less setting and convoluted expressions. Ideally, you would be able to either set objects to the grid object and have any object snap when an action is evoked:
On mouse up, (object dropped) snap Active to grid. Done!
Ideally, it would allow for an option to prevent or allow more than one object per grid by setting a flag automatically after receiving an object.
You could have a setting to not allow two objects, and also a condition for manual, case-by-case situations: Cell is empty, (or Cell = x) IF more than one object mode was on, you could get the count of objects on that grid cell. Also, offsets could allow you to snap several small objects in one grid cell.
The object would hopefully be able to represent the grid visually with various styles and colors. It would also allow for an offset number so you can choose in which part of a cell or grid the object's coordinates snap to. The visual aspect could be turned on and off as required. Perhaps the grid could be saved, so that the objects could be returned to their snapped positions?
My example uses a few objects: Background Gradient Object, EZGrid, and Alpha Channel, (used so that I could load bullets and base things on the sizes).
I see a lot of potential here if the object turns out simple and fast to use. You could use it on either side of the equation: developer or user.
The author could make their frame, drag objects on the grid, save the file, and have a ready-to-go placement of objects that is reusable and easily edited/modified.
The user would be able to design layouts or presentations if the application were an editor or creation tool.
Any other ideas for this object?
EDIT: It should also be flexible enough to allow moving any object on the grid to another position with an action during runtime.
-
Re: GridSnap Object Idea
I didn't look at your example yet (missing some extension), but you can easily achieve snapping with this super simple formula:
new position = (old position / grid size) * grid size + offset
Example:
+ Always
> Object: set X = (X / 16) * 16 + 8
> Object: set Y = (Y / 16) * 16 + 8
Of course you can leave the offset away. Make sure not to use floating point values here, as that will "break" the formula (this is using MMF's implicit calculations in integer when no floating point is in the formula).
Visualizing the grid is nice of course, although you might be fine for most cases with a tiling background (unless your grid's size is dynamic).