dop2000's Forum Posts

  • Yeah, there is nothing mysterious about clamp, lerp and unlerp functions, they are well documented and you can google a million examples of their use.

    About the problem you are having - I'm guessing you didn't put knob and slider into a container. If you don't want to use containers for some reason, you will need to pick the correct slider when setting position of each knob.

  • If you are saying that transposing the data is easier to implement, I guess it's an even better (more universal) solution!

  • Nepeo I kind of used to store records in arrays on X axis and different fields in the record on Y axis.

    Besides, some events and expressions don't work the other way, for example, you can't do "Array for each Y element", or use IndexOf to find something on Y axis.

    I actually had to do this today - changed the structure of my array so that the data is now stored on Y axis, because it was really awkward to enter about a hundred of records in one row. I know there are workarounds (I can prepare the table in excel, convert to JSON etc.), but it would be much easier if there was an option to rotate the view in C3.

  • Nepeo Is it possible to add an option to rotate the view in the Array editor? (The view only, not the data).

    It's often much easier when the data is presented in columns, especially when editing a large array, or entering long lines of text.. It's more Excel-like, compact, can fit a lot more data into the same space. Compare:

  • The platform behavior already has "is touching wall" and "is on floor" which to my knowledge are handled in the behavior's script and simply return true or false -- using them in events does not create extra collision checks.

    This is not true, I just tested with the Platform template and here are the results:

    • Default template: ~240 collision checks per second.
    • With "Is by wall" event: ~420 collision checks per second.
    • With "Is overlapping at offset" event: ~360 collision checks per second.

    So testing for overlapping at offset is actually better for performance as it uses less collision checks.

    But I agree, including "is touching ceiling" would be an simple and useful addition to the Platform behavior.

  • Maybe you need to scale the entire layout? Or scale other layers too?

  • AllanR You are right, knobs are lagging if you set their position to slider's position on every tick. But this lag is actually caused by Pin on the slider, because Pin behavior updates object position at the very end of the tick.. If you set the slider position with events too (not with Pin), then there is no lag:

    dropbox.com/s/plp4jqq6d8a858x/slider_knob_nopin.c3p

  • 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?

    You have this formula to set knob position to its value:

    lerp(Slider.ImagePointX(1), Slider.ImagePointX(2), unlerp(Self.Minimum, Self.Maximum, Self.Value))

    So just add this event below all other slider events:

    On every tick
    Knob is NOT dragging
    	Knob set Y to Slider.Y
    	Knob Set X to lerp(Slider.ImagePointX(1), Slider.ImagePointX(2), unlerp(Self.Minimum, Self.Maximum, Self.Value))
    

    With this approach you don't need to pin/unpin the knob all the time. When it's not being dragged, it will stick to its correct position on the slider. So Pin behavior needs to be removed.

    Also, I suggest using containers. (see my original demo)

  • You need to pick the correct Enemy object instance. Normally events like "On collision" pick instances for you, so if you do "Enemy destroy" inside this event, only one enemy instance will be destroyed.

    Enemy On collision with Sprite -> Enemy destroy

  • TextBox is a Form Control object. It may be ok to use in simple word or quiz games, but I wouldn't use it in anything more serious. Form controls have all kinds of problems with scaling, scrolling etc. I advise doing this with a spritefont instead.

    Here is a small demo:

    dropbox.com/s/wj1vpn641t7mjct/SpritefontWithBlinkingCursor.capx

    Of course, it works like a very basic terminal input. You can't move cursor, use lowercase/uppercase, select text etc. It's possible to add these features, but they will require more work.

  • It's in project properties, on the left panel, under Advanced tab.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why "Slider.width-Slider.width"?? You don't have to be a programmer to understand that the result will be 0.

    Please see the file I posted earlier. It works correctly and demonstrates how to set value to knob position, and knob position to value.

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

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

    fixed file, now with multiple sliders support:

    dropbox.com/s/ggdelkhq5yer51i/Clamp%20Test%20-%20v2.c3p

    edit: and an example how to set the slider to any value.

  • "On collision" is a triggered event, it lasts only 1 tick (1/60 of a second). It's impossible to tap at the exact same moment. So you need to use "Is overlapping" condition, which lasts while objects are overlapping. Try this:

    On any touch start
    	Candy compare animation frame=2
    	Candy is overlapping Checkpoint 
    		: Candy destroy