Alon's Forum Posts

  • lerp is a lot like clamp, you give it a start point, and an end point, and then what percentage of the way between the two it currently is.

    so when the percentage is zero, it will be at the start point, at 100% it will be at the end point, at 50% it will be half way between the two.

    So basically, Clamp: will give 2 points: min - max?

    and Lerp will give 3 points: min, percentage, max?

    I'm not sure if I understand but I was curious.

    that would be a picking issue. each knob has to pick the correct slider before it can be aligned properly.

    I just replicate the same code and the only difference that matters the code is the image I shared above when I disable it, I don't have anything extra to for each or the sliders/knobs beside the same code that's why I can't find the issue.

    This is the only part that affect the weird knobs movement on the Y but I don't know why... or more important I can't find the problem in order to fix it (if I can fix it at all of course).

    It's probably something on my code that I can't relate because as I mentioned on the last post I did search manually and with the Ctrl+F to try find anything related.

  • Thanks AllanR and dop2000 for the great findings and experiments, this is interesting indeed!

    From quick test like I did last time (moving the panel CRAZY FAST) it seems VERY STABLE.

    To be honest a bit confusing as I look at the code with all the new things (especially with that funny word "LERP" that I have no idea what it does or what it does on the code, what's it's purpose or anything about LERP! but it's a funny word... (feel free to explain it to me based on our example if you like).

    .

    2nd thing, I've tried to replicate the latest C3 update file by dop and it's "ALMOST" working, I still couldn't find after trying to find where the problem is after trying to put some browser logs on the LERP sections which I notice happens every tick (keep raising the numbers) but still when clicking the knobs I didn't see any difference.

    I looked on my own code to see where it could be but nothing is related to it from what I looked (beside looking carefully manually) I used the Ctrl+F to search for "Knob" because I'm guessing it is something about it. I also tried to Turn On / Of some lines to see what affect it, and I believe it's related to that LERP thing which I don't understand.

    It seems like it's doing something with the Y position of the above Knob which is strange, but this all code is overwhelming for me anyway, it could be that funny word "LERP" related or the dy instance variable, I don't know for sure

    It could be around this event:

    from my enable/disable testings, if I disable the 1st action on this event (look at the image below), the sliders stay at the same place (not following the panel) BUT! they don't have the "Y" Knobs position issue as shown above.

    What could it be?

    if it's related to the LERP thing I don't understand it so... any suggestions why it may happen on my code? or how should I debug to find the issue?

  • Hi AllanR maybe you can help me out with something I've tried to solve, it supposed to be simple but I can't get it to work right.

    As you can see on this example (from my official WIP project) Whenever I click on an instance I made the menu and all it's related "friends" invisible (couldn't put all in 1 family because different types: Text, Sprite, 9patch) I wish I could make this into one family:

    ANYWAY... I want to make the position of ALL of these to the center of the layout of whatever I'll choose later on.

    So when I set the position for the different types of objects to: LayoutWidth.x /2 LayoutHeight /2 it works... BUT! the only issue I can't solve is the Knobs!

    Since they're also changing position, not only they are all over the place, also they change the actual values because it's based on their position (make sense).

    What I tried to do is to Unpin and Pin back.. but still couldn't make it work right.

    My Question: How do I change the position of the Knobs on the Layout WITHOUT changing their values, and also... make them stay based on their original default PIN position?

    Thanks ahead!

    .

    EDIT:

    I just noticed a really huge problem, I couldn't figure this out, because even if I change the .25 to 0.1 Wait it will never be 100% safe for a fast-user (like me for example) when scrolling things very fast when working.

    I wonder if there is also a different solution to this... Knobs position brings these 2 difficult issues but maybe you have an idea how should I fix these 2 ?

  • Thank you so much for taking the time to make this example I appreciate it a lot AllanR! :)

    I will look a deeper look at the code and the comments (amazing way to learn!)

    I think the way I solved the Panel/Sliders on my other code was by adding a negative "is overlapping" for the family (via mouse click/hold) and no matter what was behind the panel it just ignored it (I didn't use the shield object on one of my experimental versions) I'll have to check it out and see how it works all together.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks again AllanR this is very helpful.

    To be honest I think I got the idea of the Clamp a bit better with these examples and descriptions.

    I'm not sure what Lerp is or how to use it and I don't want my brain to get confused so I won't stuck on it at the moment.

    For now I played with dop's version of using Clamp based on Image Points because I find it VERY visual and easy to tweak the more visual (for me) the better I can follow.

    The issue I find now is when I want to attach a Panel so I can PIN (behavior) the Slider + Knob to it but it seems like it's reset it to the origin of the 9patch Panel.

    The tricky part (for me) is to make the Knob follow the Panel EVEN after I tweaked it's value.

    So I don't really know how do I make the Knob follow the Panel consider I'll have more Knobs and Sliders of course, this is why I'm playing around with this tiny example first.

    DOWNLOAD My Tiny Experimental C3 File and have a look.

    Maybe.. I'm close to the solution and I didn't realize it yet but I'm out of ideas.

    Please have a look at the file to see what I mean, Thanks ahead! :)

  • Thanks for the quick Reply! Yes I think that the image points are more dynamic.

    I still need to get the idea how I connect the variables (value / steps) without the visual limit so I can connect them with any other properties for effects and such.

  • The way you are trying to do it will also work, but you need to include the slider's x position as well as the width.

    the lower clamp value should just be Slider.X

    the upper clamp value will be Slider.X + Slider.Width

    so the full clamp expression will be:

    Knob - set X to clamp(self.X, Slider.X, Slider.X + Slider.Width)

    Thanks for the reply AllanR it seems like you understand what I'm trying to do which is simply trying to emulate the default C3 slider (I even use the same instance variables) but with my own sprites.

    Dop's example is kind of cool with image points as the limiters and I should play more to understand how it works since it's new to me.

    What happens when I use the code you shared is that it's not "sitting" on the correct position but more to the right so I can always play with the numbers manually I guess but maybe it's not very efficient, all I know it works (on the specific example):

    BTW I tried slider.width /2 but because of the slider graphics it need the less 10 pixels anyway so I can add -10 at the end, but... it's the same result. that's where dop's image point is kind of nice! I just need to have a deeper look of how it works with the values.

    I will have to explore Dop's example to try understand how I can CONNECT the current Value (using the actual instance variables) without the slider size and it's limits on the Dragging code.

    In other words, the slider limiters should ONLY stay visual, that's probably where I should somehow also connect the STEPS variable.

    After all my goal is to connect the INSTANCE variables to effects properties or other variables.

    So I'll better keep the experiments using your examples, thank you for sharing and explaining! :)

  • Please see the file I posted earlier.

    Yes I just saw your edit post after I post mine :)

    Thanks! I'll explore this example asap.

  • Object Is Dragging -> Object set X to clamp(self.x, 100, 200)

    Object On Drop -> Object set X to clamp(self.x, 100, 200)

    The good news is that the CLAMP is working, it is limiting the width which is great!

    The problem I have is that the Knob jumps to the screen's X location instead from it's self current X position.

    I want the knob to clamp the values in general and not based on where it sits on the screen because I will probably move the slider around within a dragable panel later on.

  • Hi All,

    I've created a slider from scratch (sprites) using the Drag and Drop behavior.

    I'm trying to limit the Dragable Knob on the X position based on Minimum/Maximum values.

    I have never used Clamp before but I'm guessing that this may be the most efficient way to limit the slider on the X, I'm guessing.

    CLAMP IT:

    So, I get the idea in general: clamp(x, lower, upper)

    But... how do I implement it to the drag and drop object?

    I didn't find any example on the manual. most of the forum results have dead links so I cannot explore and learn how to use it.

    After clueless attempts which made of guesses all I have is what I described, trying to guess how it works is impossible for a non-programmer like me, any help will be appreciated I'll be happy to learn how to use this tool: "CLAMP" if you can explain it to me with examples / screenshots / or anything visual for a newbie. THANKS Ahead! :)

    DOWNLOAD - Base C3 File I messed with while guessing how to CLAMP

    Tagged:

  • It just feels like you are afraid of trying new things. You prefer to ask on the forum "what would happen if I do this or that", instead of simply testing yourself.

    I guarantee to you that I'm not afraid of trying new things, This is how I became a professional animator, by trying and tasting new things and I'm still learning new things every day, but I also make sure to teach my way-of-thinking to the animators on our studio, some of them have only 3-5 years of experience in animation and they're afraid to ask, I always encourage them to ask in order to learn new techniques that will sure be more efficient and not just speed-up their workflow but also give them ANOTHER ways to accomplish their sessions.

    Animation isn't the best comparison, it was just an example. :)

    In programming if I don't KNOW what to test or what is the most efficient way to even test something, or even some basic programming terms, you must ask in order to learn, there are many things I try myself and then I get stuck... if you'll read the very first post here for example, you'll see that I tried until I got stuck, these blocks are not simple to guess how or what to do for a none-programmer.

    I just think that you don't agree with my way of asking in order to learn new things even before trying to get a much better attitude, but it is fine and I respect your opinion. :)

    About the save size - have you tried viewing your ".alon" files? Create one object instance, save to .alon file. Then rename the file to .json and open it - you can upload it to any online JSON viewer website, or simply open with Firefox.

    This can help you to get better understanding of how things work in Construct. Besides, you may find something in the file which will help you to optimize and decrease the save size, for example some objects that don't need to be saved.

    That's something I would NEVER KNOW if you wouldn't tell me about, what you just explained is TOTALLY NEW TO ME, and it's pure gold which seems like a very helpful tool!

    Now I'm super curious about googling a JSON Viewer and examine my .alon files!

    it seems like a very good way to find hidden useless things that I can cleanup THANK YOU SO MUCH! I'm learning so much and I must say that this is inspiring to me.

  • > Is the system saving going to grow REALLY HUGE in size if I'll have MANY instances on the screen with the extra effect values changes per each that needs to be saved

    Why don't you simply test this? And why do you think other people should know this? :)

    I just explained above why I'm asking before I even test and I did say that I will test.

    I think other users are much more experience and may already have a clue about this because it's not specific to my project, if C3 extra values in general may change the size of a file or not really unlike sprites size for example.

    As I explained above, I ask questions before I test for better understanding and learning a better approach and workflow in order to improve, it doesn't mean I won't test things. Learning from others and their experience may not just direct me but also open new, better, efficient ways than my basic-thinking, this is why I'm asking. :)

    Run the project, create 10-50-100-200 instances, see how big the save size is (you can check it in Browser log). Write it down.

    Add a bunch of instance variables, repeat the test, compare values.

    Thanks! this is VERY helpful I'm so happy that you told me about the console and the browser log, now I use it A LOT!

    I tested to see if "Bound to Layout" would work, but there is no way to disable that when you want to hide the panel. So that means you would have to destroy it and recreate it every time.

    I'm not sure if it's efficient, but I really like to put other panels and all the instances in their own dedicated Layouts because it is cleaner and more organized.

    What I don't know is if Create/Destroy is slower, taking more memory or just not that critical at all even for older machines, I cannot test on other machines for now so I'm trying my best to avoid anything that may be a wrong way to do things. it make sense that just changing position to something will be faster but I still like the idea of Create/Destroy anything that is reuse a lot of times on the current layout but again... what do I know. :)

    I suspect that you could add a couple thousand objects before size will become a problem. but that is just a guess.

    That's very helpful in my opinion, yes! even for a rough guess it's much better than having no idea how it works in general, there will be testing! and a lot of them hehe :)

    Thanks once again you guys are truly amazing!

  • Thanks Everyone! for helping in this learning experience, I appreciate your time and patience with me.

    So I just downloaded the version AllanR made so I can look at the code, the comments and see if I can follow it.

    OFF TOPIC:

    I would never find out that the fullscreen have issues because in my PC (desktop build) it's not flickering, so THANK YOU for sharing this with me! I've added "Trigger Once" to the boolean events and now it's fine after I checked with the console log, no more endless loop. :)

    .

    BACK TO TOPIC:

    As I'm reading the comments and also the detailed explanation of the code it helps a lot but I must be honest, I couldn't solve this by myself based on my current experience. some things that you guys are having a quick solution in seconds or HOW to actually code it inside C3 so thanks for sharing your experience with me!

    I'll try to play with the code a bit and see if I can replicate something like that in my bigger project which is going to be challenging for sure, I do have some theoretical questions before I even start because I'm always curious:

    In my bigger project, I use "GUI" layer to put Panels, buttons, sliders, anything that is ABOVE everything else mostly the actual instances.

    One thing I noticed about the set position of the Panel when clicking on instances.

    1 - Is there a simple solution: if the instance is REALLY close to one of the edges?

    is it simple as: "If Panel position is OUT of layout -/+ Panel.width (for x) and -/+ Panel.height (for y) I have never tried these things and it's very interesting because when the panel is not active I guess

    2 - Is the system saving going to grow REALLY HUGE in size if I'll have MANY instances on the screen with the extra effect values changes per each that needs to be saved, or since it's just "numeric values" the size will barely grow and I don't need to worry about it?

    I will try some things while re-creating the basic code idea to my project so please try to understand me for asking questions mostly because out curiosity: if I even "THINK" in the correct way or my solution may be a total stupid and waste of time compare to YOUR way of thinking. this is how I can learn and understand things better as I go via discussion and not just jumping to code without thinking about it first.

    I'm sorry about my bad English and I want to thank you all once again for your patience with me, it is not something I take for granted! all of you are amazing for helping me learn new things, THANK YOU!

  • Hi All,

    I've created these:

    - Dragable Panel with sliders to change HSL / Brightness / Contrast

    - Family of instances called: "Created_Objects"

    I'm trying to do these tasks but I got confused during the process:

    Whenever I click one of the instances, it is "Selected" (I've created an instance variable for the Family).

    1. The Sliders should control ONLY that specific "Selected" instance.

    2. Clicking on ANY instance should "Remember" their current sliders values (if I changed any)

    3. Click outside the Panel should change position (out of the layout) instead of destroy it, so the Panel always come back when I click on any instance.

    I'm not sure how to explain what I'm trying to do exactly so if you don't understand my explanation steps above let me know and I will try to explain it better.

    I've attached the messy C3 project that I'm doing my tests on so you can actually see what I've described above (minus the steps I didn't solve yet) so feel free to have a look:

    Download C3 Project

    It's the first time I'm messing around with effects and sliders and I'm still excited but a bit confused with how to connect them with the instances and control each one as I tried to describe above.

    Thanks ahead for any help, tips, and visual-screenshots or example to help me explore and learn from it!

    Tagged:

  • Yeah, that condition prevents crashing. That's why you should absolutely definitely keep it.

    But you should also try to minimize the number of unnecessary saves, it's up to you how you do it. To tell you the truth, I've lost track of your changes a long time ago.. :) You can add a cooldown period, wait for a pause in mouse wheel scrolling, or require holding Ctrl or some other keyboard button and save undo step when it's released. Or there may be other methods, I don't know.

    Thanks I will keep it, no crashes is the highest priority for now that's for sure.

    Weird extra UNDO saves for the the Z-Order using the wheel only is better than extra delays.

    I wish I could just have a way to add "SaveStep" for every Z-Order change of this family instances.

    My brain is already on other much more interesting missions I can barely track this myself anymore hehe

    but... as I said, no crashes is first, UNDO is the core of the system so I can't just ignore it.

    I'll play around with some delays or just get back to the Release CTRL if I'll have no choice...

    Thanks again for everything! :)