Alon's Forum Posts

  • dop2000 I tried to follow your instructions but I made a total mess now whenever I Run the software (F5) it will open the "Save as.." box, so I know for sure that it's not working because I did it wrong.

    I tried to follow your instructions but probably didn't understand exactly:

    1 - I've added a boolean "isUndoSave" for the "UNDO" sprite, false by default.

    2 - Here is where I didn't understand how to apply what you explained to C3 exactly:

    Sorry, the functions and arrays are not something my brain can get easily yet.. I'm trying to follow but as you can see obviously I don't get it... yet.

  • dop2000 Thank you so much for taking the time making this!

    I just had a quick look at your example and not only it's very well documented with everything it is very clean and organized for me to follow!

    The only problem I may run into, when I'll try to replicate this type of code to my current project

    will be the Functions, since it's not an object anymore but a built-in, it works a bit different as "Object.whatever" if there are any on the code (I didn't look for deep yet).

    I do have some questions before I start inserting this way to my project

    1 - Is it limited to X Redo/Undo per session?

    and if not, is it taking a lot of memory because I will create and tweak and move probably hundreds of objects and I would like to make it work if possible also on older machines with less memory.

    2 - Is it easy or complicated to limit to X UNDO/REDO per session?

    3 - Since I'm using the system Save/Load on for saving: "whatever.myfile" will it save the undo/redo from the current session? because I don't need it to save UNDO's of course like most software.

    I'll probably have more questions later when I'll start to put this code on my project but for now I just asked the above before I started looking on it.

    Once again, thank you so much for the help! :)

  • Sorry about the long post and about my bad English, I'm just sharing my experience so far:

    First of all, thanks for the detailed reply R0J0hound what you did for fun, was SUPER inspiring and made me try all day trying to replicate it (with many fails so I kind of gave up) mainly because of the Function didn't work the way I tried and didn't understand how to replicate this action, creating a Function was easy as a Click on the events but using it as the "Sprite" like you did "Function.call" or trying something else was too much for me to follow.

    I like how you managed the all code, organized it in groups (this is why I LOVE comments and groups so much) you really did a nice job!

    Before that I followed a lot of help from AllanR which not only SAVED THE DAY! but also was very creative and I'm trying to combine the both ways of you guys because at the end they worked great!

    The status right now for me is that my project file which became kind of big and messy, is not using a specific code to make a working UNDO/REDO and the other features from my other post which is the main idea so everything will work together.

    I'm trying to learn and understand but I must admit, my brain is not getting much more than basic logic, the other technical programming code and math are gibberish to me, no matter how much I try to understand... and I do have this problem that I LOVE TO LEARN so I can use things like that and upgrade them or tweak them if needed.

    SAVE SLOTS for UNDO/REDO:

    You guys suggested the option to use slots for alternative way, if it's not too complicated maybe I can try it myself and understand how it works by doing it.

    The thing is that I have different events such as drag, drop, resize, rotate, and more to come..

    So I'm trying to understand the basic idea:

    1 - Before any action, SAVE to a slot, for example: "DragSlot" will save before I drag the object.

    2 - Event: pressing CTRL+Z will load "DragSlot"

    But what if I want to undo ANY LAST action, not just dragging (DragSlot)? this is where I get confused,

    Looking at your examples doesn't really translate to logic for because as I said I'm not a programmer, that's why I'm asking stupid questions, after I tried to understand with no luck

    Do I have to use an ARRAY (I understand how Array works, but only on the paper not on C3 or how to use it after Setting it up) maybe I'm an Array'phobic!

    I believe that it is related to the objects UID using 1D array but it's only a guess my brain trying to follow the logic of it, also I have no clue how to translate such thing to actual C3 code.

    I still don't know if I need 1 slot for the UNDO or more? and if more... how do I use them?

    UNDO for size, undo for drag, undo for drop and so on? will this work?

    I'm so sorry for the stupid questions, I'm just trying to understand the nonsense programming events that I see and trying to translate it to more Human-Like logic sense but I guess it's not that simple after all.

    If you guys can explain it with screenshot or some other visual way it will be easier for me to follow, of course if you want I just rather learn instead of copy/past code.

    Thanks ahead for any help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • UPDATE:

    I just tried to follow step by step from R0J0hound and create each event one by one to my project (disabled my old code) just for sake of curiosity, but I got confused on the very first part with the functions because the new C3 functions are built in and when I try to replicate how it's done in the C2 version code it's not working the same because the function is actually an object so part of the code for example one action is related to it as an object: Function.Call("new id") which I cannot do in C3 since it's not an object.

    Wish I could understand this all thing and code such thing and learn from it, but I guess it is much more complicated for my simple logical thinking brain. too bad for me because I was really impressed of how it works.

    I guess I will have to make my software much more primitive after all.

    The reason I want to actually understand at least some of the code is that I will be able to tweak and change it when needed, but unfortunately I'm not a programmer but just an animator who can think nothing more than logic things in my brain. (If Then Else... = Result!).

    I'll keep trying to find some other ways to make my software... usable so the users won't get annoyed of how primitive it's functioning.

    Please feel free to share any suggestions, tips, tutorials or anything helpful for to help me out are more than welcome! :)

  • OH MY! very impressive example R0J0hound! thank you for taking the time to make this.

    The selection, duplicate and rotation feels very "Windows'ish" which feels really good!

    To be honest I don't know if I can replicate this complex code to my project, because it is VERY different from my current code, but of course I can try because it is very useful!

    I already know that I may get issues because:

    1. Obviously, by looking at the code I don't understand most of it (blame on me).

    2. In my current project I click to create objects in random variations based on frames (you can see on the clean example I posted) the layout starts with no objects, so I have no idea how to make your code to work with creating different objects instead of pressing "a" to create a specific 1 type of object because of the all confusing UID which is new to me as well.

    But you and Allan made me very curious about these different solutions, it's amazing!

  • WOW!!! for a work-in-progress UNDO/REDO system it works very well!

    Not that I know how it works or understanding.. but maybe for the best way for the Angle Rotation solution is simple as to "store" (or however it works) once you DROP the key / unpress since it's a HOLD action.

    So from the start press to once you unpressed, I'm not sure if it can work but.. just thought about it.

    In my project, I have tiny angle rotation like this one, and also a one that snap 45 degrees every click (when you hold SHIFT + X / Z) but on this one I wanted to keep it as clean and simple as possible for making the rest of the code-magic you put so I can find it.

    Feel free to update on this whenever you get the time, I'm still going to replicate the first part before I'll look into the UNDO/REDO just to make sure everything works before I move on.

    Dear AllanR thanks a lot for your time and afford and most of all your kind help and patience!

  • Thanks for the explanation and example files guys!

    I still didn't have a chance to replicate the code to my actual project, but will do that soon it looks so efficient I'm very happy about this way and can't wait to test it.

    I did understood what UID means, but like I said on my last post, I didn't understand exactly how C3 will know which UID to pick? will it pick the one that the mouse cursor is over based on the top event: "Pick Top instance" ? or it's picking it's UID (the actual object number) from a different way?

    It's not critical because everything works, but as you already know me AllanR I love learning rather than just copy/past, this is why I'm asking how it's actually picking the number of the object, based on what?

    I will check the flashing example kidswithcrowns with the functions and family as well, looks interesting and efficient way for me to learn how things are working, thank you for taking the time both of you are amazing!

    Anyway, I'll make sure to try replicate Allan's version to my project asap, before things will get even more complex... I'll probably going to have more ISSUES hopefully you guys won't get tired of my stupid questions to come.

    Sorry about my bad English and big Thanks! :)

  • WOW! You did save the day AllanR! Thank you so much!

    I still need to explore and understand how the all UID works, because it says Created_Object.UID without a specific number so I'm not sure how C3 knows which UID is the picked one... (never used UID before, it's NEW to me). I'm guessing that C3 will look at the Top Instance it picked (from the main event) and it will GIVE it the UID? if so... I'm close to understand it? I'm not sure hehe

    I will now try to replicate this type of code to my actual software (it is already getting HUGE) compare to the current clean example I shared, I hope it will work and I won't do a mess.

    OFF TOPIC:

    Do you think it is possible to apply that UNDO/REDO system we discussed on my other thread to this clean example so I can see how it looks and hopefully will be able to understand it?

    Thanks for everything! I'll start make these changes (can't wait to see it work!)

  • I made a simple example that works PERFECT (without families or functions) just to show the issue and what I'm trying to solve inside the file using comments.

    Hopefully somebody can help me solve this before my code will become HUGE with ZILLION of events that does the same thing for each (that's the key "FOR EACH" I know... but can't solve it yet).

    Maybe using 'Families' and 'For Each' maybe 'functions' I have no clue, but there must be a SIMPLE way that won't confuse my simple brain.

    Maybe AllanR can you save the day? ;)

    C3 File Attached - Please have a Look, Thanks ahead!

  • Thanks for the reply kidswithcrowns

    To be honest I have no idea how to do what you suggested, your explanation make sense to me because it should know on which instance of the family the cursor is over.

    But to be honest I have no idea how to do that, I never used pick UID or the new functions, can you please share an example or screenshot of how I should solve this?

    Also, I don't know how to let that function know which UID to pick because I keep creating new instances on a click of a button (they are not appearing without me creating them). so it's confusing for me to follow logically, beside the code part.

    Thanks ahead!

    This is the mess I did, obviously there are lots of guesses and I'm not even close, just sharing:

  • I'm trying to convert all my individual Instances events to one general Family for more efficiency and less events.

    For example I have an event that whenever the Mouse Cursor is over instance it will Flash (using the Flash Behavior).

    When I tried to convert it to a Family to affect other objects instances I found out that... there is no Flash Behavior for Families.

    So I made a simple Function to make the Flash-Effect, but again.. with or without "For Each" I can't get this to work right.

    Can somebody explain? or if it's confusing (for noobs like myself) add an example file or screenshot?

    Thanks ahead!

    Work in Progress so far:

  • Thanks for the quick reply Elliott

    I guess it doesn't work because the Layer doesn't take multiple parameters, as you mentioned (I had no idea, it's good to know!).

    I tried to add comma between but I get Syntax Error so I guess I'll just go with the extra lines.

    It will get messy when I'll have more layers but.. oh well, at least it works. :)

  • Hi All,

    My goal is to exclude some layers when taking a snapshot, when file saved, bring them back (visibility).

    When I include the layers one by one, the code works PERFECT! as I expected.

    But wen I tried to make it more efficient in 1 line, as I used the "&" it's not working.

    I'm aware that all these Sub-Events are not needed, I just like to see the separation.

    I must be missing something really stupid... can someone please help?

    Tagged:

  • Thanks for the explanation and help, I will wait to see what you'll come up with! :)

    OFF TOPIC: (hope I will be able to apply the UNDO/REDO system to this)

    I used a different Drag n Drop solution for selecting Objects with much simplistic way for now, so my code will probably won't fit to what you're doing since you'll do it based on your previous code.

    My Drag n Drop solution based on a "Pan_Tool" object that have 3 modes:

    1st Mode is turning OFF (invisible) the tool

    2nd Mode is MOVING ALL instances on the layout

    3rd Mode is MOVING ONLY selected instances (based on SetColor) so all the colored can be moved.

    For now I press 'SPACEBAR' to change (cycle) between the modes if I need to move more than 1 instance.

    This simple "Pan_Tool" is always centered on the layout, After I Drag it to anywhere and DROP it, it will get back to the center. I know it's not the most efficient way but it was the only creative way I could came up with for a very simple code that my brain can actually understand.

    Back to Topic:

    I hope that I'll be able to follow it and apply it to my code even that it is very different.

    Thanks ahead for your kind help AllanR!

  • Thank you so much dop2000 it works like MAGIC! :)