How do I make a Controller ?

  • Hi All,

    I would like to try something on my project, but since it's huge already as I try to do it on a fresh-new file first I realize that I have no idea how to actually approach or do it at all.

    I have a Drag and Drop instances (different sprites) on the layout, I can Resize, Rotate, and reset to original size/rotation, using different keyboard shortcuts since there are different way to tweak them for example to resize with bigger scale steps you can hold the shift button, same for the resize.

    This is what I try to do:

    When I click with mouse on individual instant, I want to have a "Controller" appears that will alow me to do the actions I describe above, but I'm confused and not sure how to make the controller works in general and especially for each specific instance only when clicked

    Here is a nice visual example of what I'm trying to achieve (Jamboard):

    Is there any simple example file I can explore to see some efficient solutions to such thing?

    Thanks ahead for any help!

    Tagged:

  • You could explore the use of containers, which may make it easier to accomplish that.

    https://www.construct.net/en/make-games/manuals/construct-3/project-primitives/objects/containers

    Basically you need a sprite that can be manipulated (scaled, rotated, etc.), then sprites that represent the "controllers" as you call them. Then put those sprites together in a container so you can easily pick them in the event sheet.

    I can't provide you too much more since your question is very broad. Let me know if there's more detailed questions you have.

  • Having implemented this for Construct's Layout View, I can tell you this is surprisingly complicated, involves tons of work, and is full of many awkward and non-obvious tweaks to provide a decent user experience. Basically you should be aware this is more-or-less expert level stuff and it's going to be hard going. There is far, far more to it than first meets the eye (if you want it to be good, anyway). Just as an example, in Construct's Layout View the code to handle the resize handles alone (that's just handling the four corners of the selection box for the purposes of resizing) is over 1500 lines of JavaScript code.

  • Thanks for the advice Fib I'm still learning C3 as I go, containers are useful indeed I just need to start using them more often (like I'm using Families all the time for the same kind of objects on my code).

    I didn't think it's super complicated until Ashley explained how scary it is, especially for a really basic user (not even close to be advanced programmer hehe). I did saw some code examples in C2 even that it wasn't so many lines it wasn't easy for me to understand most of the code just like Ashley explained.

    Ashley I'm aware how busy you and the Scirra team are extremely busy, but is there a tiny chance to add such feature/tool in the future? maybe even inside the Drag-N-Drop behavior so we can control rotate/resize? or maybe nothing related to the Drag and Drop and just in a different form that will be easier to make "controllers" as extra to the Drag and Drop? I believe it could be useful for Touch (Smartphones) as well... but for now I focus on PC so I can't say.

    I'm aware it's less common for Construct users but in my case, my current project is not a game but a tool-set for creating content, so far it looks and works really nice with the features I want (HUGE thanks to the community help) so I'm aware that my suggestions / requests / and questions as a non-advanced programmer are either stupid or sound nonsesne, but maybe such behavior could be used for others as well.

    After all, the idea of Behaviors is AMAZING! and it save so much time for people like myself who can't understand how to code everything, I'm IN LOVE with C3 mostly because of how helpful they are! :)

    Anyway, I'll keep doing some tests... I may just replicate a C2 code which I don't really like because if I can't understand a code it will make things complicated for me later on... or I'll just stick to the current way everything works which is NOT the best for the typical user: "Hotkeys"... lots of them!

  • Alon here is a start... it is pretty close to what you are after, but obviously the rotate and resize are very glitchy and quite often don't know which way you are trying to go and freak out.

    I had to start it in C2 in order to use families, then had to move it to C3 to use Create by name... but now it is getting close to the limit of what I can do in the free version.

    I haven't put in any comments yet, so it will be pretty difficult to figure out what is going on... if I have more time later I may work on it some more (I need some of these concepts for a project I am working on).

    https://www.rieperts.com/games/forum/menu.c3p

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • WOW! this is VERY impressive AllanR !

    I see how complicated it is and the glitches you've mention but the concept is really good!

    Not that I can understand most of the code, but this is very inspiring, thank you for sharing :)

  • I just update the file at the link above...

    rotate works properly now, resize doesn't glitch out any more and works fine - until you rotate the object upside down. then resize is opposite to what it should be... so I will have to think about how to resize regardless of angle.

    plus a few other minor improvements.

  • Nice!! I'm so jelly on how you even manage to code such magic AllanR :)

    If you don't mind sharing the next update working version please do it's very helpful!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)