Alon's Forum Posts

  • Thanks for the quick reply dop2000 :)

    I think I got lost trying to understand where to put your code or replace my last part of the code with it (which I tried) also I didn't understand which outline effect to use because the 2 must cancel each other when one is working like in the example when mouse cursor is over. (beside the drag issue I try to solve).

    I did some tests before I replied but they turn into guesses... which is what I made me post this thread originally.

  • Hi All,

    I have 2 Outline Effects: "Outline" (for mouse cursor OVER) and "Outline2" for Dragging.

    As you can see on the example C3 file:

    When the mouse cursor is over ANY instance of the "Created_Objects" Family it enables "Outline" effect ONLY on the TOP picked one. no more than 1 instance is affected.

    BUT! when dragging an instance while it's overlapping other instances, they will ALSO enable the effect... and this is what I would like to solve.

    I would like the same result as mouse cursor is over any instance, BUT whlie dragging, means:

    I want ONLY 1 instance to have outline at a time.

    To SEE the issue on action, just DRAG an instance OVER any other instance... as you can see, it will also act as "mouse cursor is over" which I failed to solve.

    DOWNLOAD Example C3 File

    Please have a look at the attached C3 project and try to help me out, also if you can add explanation of how you solved it, it will be very helpful for me in my learning journey while looking at your solution.

    Thanks ahead!

  • Thank you so much dop2000 everything works EXACTLY as I imagined in my rusty brain!

    I'll play with this new feature to see if I didn't miss something or made a mistake while replicating the code, because in a first rough test it works great.

    oh, one more thing: YOU ROCKS! :)

  • AsJSON sounds like a VERY useful option, thanks for the info, I'll read about it and hopefully will understand how it works in different cases.

    I tried to make the created obj TOP-Z but I failed in different tests, whatever I do makes the source instance goes TOP as well, can you please help me out here?

  • dop2000 I just noticed when holding the SHIFT it will make the source (cloned from) instance jumping to the TOP Z-Order is it possible to do the same without changing it's current Z-Depth?

    It will be useful to make the CLONED created jump to the TOP Z-Depth.

  • Thanks dop2000 it works like a charm!!

    Would you mind analyze it just so I can learn a bit about this all "JSON" thing... and the local string local variables you created temp and obj?

    I think that the JSON code is related to restore the data.. but I'm not sure and just guessing.

    You don't have to explain, I'm just curious because I have no clue what they does in this example and it'sa nice opportunity to learn it if you don't mind explain a noob.

  • Easy:

    You create a clone and continue to drag the original sprite.

    Thanks for the quick reply dop2000 :)

    I just tried this code but as I mention it's a Family "Created_Objects" and when I hold SHIFT and drag, it creates any of the Objects (different sprites) on the Family, I need it to only clone the instance.

    Any simple fix for that?

  • Hi All,

    My project use Mouse (not touch), I have a button that creates Sprite object (1 instance per click) from Family: "Created_Objects", basically I can create many instances on the layout and tweak their size, rotation, Z-Depth, change animation frame, etc..

    Each Sprite Object have X amount of frames on their default animation on speed 0 (different variations).

    How do I do this:

    When holding "SHIFT" over a specific instance and Drag it aside, it will Clone/Duplicate the instance with it's CURRENT animation frame, Rotation, Size, Z-Depth or anything that tweaked to the one I cloned FROM.

    The result should be like this:

    I create as MANY INSTANCES as I want, I tweak each one to look totally different: changing frames, Rotation, Z-Depth, Size etc.. If I will hold "SHIFT" and drag ANY OF THE INSTANCES that I already created (not just the first or last created!) it will CLONE it with it's current properties (beside the position of course which I'm dragging aside).

    HELP?

    Any visual help, screenshot or project file will be very appreciate so I can explore and try it on my project. Thanks ahead! :)

  • First of all Thank you so much for your encouraging words and mighty patience with me...

    Still, I don't think that my brain can handle C3 very well, and I'm scratching my head:

    "IT IS SOOOO SIMPLE when I think about it logically, this is ON, that one is OFF while this happen, and this is NOT happening etc.." same story, C3 Code = MESS! I'm losing my mind how can I stuck on the most basic things in C3 this is why I said I'm not smart enough, not stupid.. but not THAT smart, I just face reality not just saying it for nothing.

    Anyway...

    I just made the code much longer now with the new ON/OFF Switch I hope that it's ok that I used instance variable for the Family instead of Global Variable, does it matter? (I'm not sure) the reason is for organized sake, nothing more. if it's an issue I will make it a Global Variable of course.

    But that's not the problem, now what I got is that it's working... kind of again.

    The dragged instance will be the only one to enable the OUTLINE effect, but... it won't if the cursor is over (without dragging) which I tried to make another event for the "Cursor is Over" but I got bad results so I just deleted it.

    Also, I believe that I didn't need the "Outline_ON" Boolean for the current code, I just made the code longer for nothing, it's the same thing... with more lines. (this is what I meant I make a mess hehe).

    I know that the problem is not in my logic thinking, it's on trying to take my logic thinking and translate it to C3 code... this is where I feel useless and my code looks like a guessing mess.

    So my feeling is that I need extra event for the "mouse cursor is over" but as I said.. it only made even more mess so I skipped it to show you the current mess.

    Sorry to failed you once again Master kidswithcrowns unfortunately the longer the code gets the more confused I get even with comments (this is why I like to separate things to Folders, beside the fact that I can use them to enable/disable which is one of the features I really like in Construct.

    DOWNLOAD - Another Failed Test

  • Hi kidswithcrowns I guess I'm not that smart to figure this out,

    As I explained my problem is that my logic on paper is SUPER EASY for me to understand but as soon as I try to translate it to C3 code... it's a total mess.

    Here is what I tried to do following your instructions, which is not working because I probably didn't get it right... again:

    DOWNLOAD - Another Failed Try C3 file

    Thanks ahead for any help! :)

  • Thank you for the helpful explanation, I do understand your description but when it comes to C3 I get confused real fast but I'll try to get the idea as I'll keep practice, for now I feel like I do some random organized with some actions which feels really bad because I do want to understand so I can be more creative.

    For example, I used your screenshot, which I didn't even THINK about making an empty event for the "Disable Outline" action, such a simple solution which my brain can't solve inside C3.

    Now that it works, when I drag the selected instance it enables the OUTLINE effect as I wanted but...

    as I keep dragging it OVER other instances, they are also enable the OUTLINE, and I want ONLY the dragged instance to be affected by the effect (one at a time, that's why for each made sense to me because how it sounds... for each instance.. but I see, it's not how it works)

    How can I make this to affect only one instance, even while dragging and not just by over with the mouse cursor (2 different goals for the OUTLINE effect).

    Feel free to show me a screenshot like you did or use the example file I uploaded on the first post.

    Thank you so much kidswithcrowns for taking the time to explain and show a visual example which helps a lot to my simple-logic-brain :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • rgba does take values in a 0-100 range, where 100 corresponds to 100%. However it is not limited to this range - you can pass 255, but that corresponds to 255% red, as in 2.5x more red than you'd normally get.

    255% OH! it make sense but still... I get 99% of the time RED colors even when I use int random as you suggested and 0-100 so something must be wrong in my code and I have no clue how to fix it.

    Ashley Thanks for the reply it explains the 255 vs 100 limit! :)

  • Hi All,

    I still don't know how to setup a working UID or use it when CREATING a new instance (I don't get it yet).

    So, I tried another way using For Each instance in a Family.

    The effect I want works as I need but it won't enable ONLY the Top Instance but also the any instances Top & Bottom, basically any instance that the mouse cursor is over.

    How can I fix this without using the confusing UID way of code?

    I attached a file if anyone can have a look, Thanks ahead! :)

    DOWNLOAD - Construct 3 Example File

  • Not unless you use different layers.

    Yeah, I guess there is no other light solution to this, but thanks for helping I appreciate it! :)

  • I just applied it to the all family so it will work on any instance of any object.

    I don't really know how to do what you've suggested but if it takes more CPU or Memory... it won't be very good for many MANY objects on the screen I guess.

    Is there another way to "DRAW" an outline around any instance using the same pixel ratio / size?