Braus's Forum Posts

  • I found the answer in this thread:

  • If so, could you please tell me how can I do to get this format: x.xxxxxxxxxxxx and convert to: x.xxx?

  • I am using wallclock to get the interval between of the start of a event and the mouse click. So I store it, reset the time and start the wallclock again. I wonder if the format of this interval is in milliseconds or not and if not, how can I format it in milliseconds.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It worked very well. Thank you. 99Instances2Go!

  • set their positions, but these tries don't work

    That is probably because you use 'world' coordinates. While you need 'relative' coordinates.

    So first you find the X/Y pixels the dragged one moved compared to last tick.

    Say dragged one's name = drag

    2 instance variables. dx and dy. Their expressions are drag.dx and drag.dy.

    2 instance variables. prex and prey. Their expressions are drag.prex and drag.prey.

    Every tick

    ______ set (drag) dx to drag.x - drag.prex <---------- calculate difference

    ______ set (drag) dy to drag.y - drag.prey

    ______ set (drag) prex to drag.x <---------- update to use for the next tick

    ______ set (drag) prey to drag.y

    Now, dx and dy hold the distance drag moved compared to the previous tick.

    So ..

    On dragging

    _____ set any object's position to x= object.x + drag.dx ... y= object.y + drag.y

    Thanks 99Instances2Go

    Sorry, but this is a little confusing for me.

    I have a main Sprite (that I think you named as "drag") with the drag 'n drop behavior so I need to create these 4 variables in this sprite and in the event "on dragging" I will associate all the other objects (or a family) that I need that follow the main sprite. Is it right?

  • I am using the drag and drop behavior in a sprite and I would like to move 3 other sprites at the same time when I drag it. I tried to pin them to the main sprite and also the "every tick" condition to set their positions, but these tries don't work. Is it possible?

  • Local variable TheHighest

    Sprite>Pick highest

    _____Set highest to the highest instance value

    Sub ____ System > pick all

    _________ Sprite > Compare instance variable =? TheHighest

    _________System > compare 2 values ... Sprite.PickedCount =? 1

    ___________________actions run if there is only 1 TheHighest

    _________Else

    ___________________actions run if there is more then 1 TheHighest

    I was doing something like that but I forgot to include the "compare 2 values" condition in the same event of the two others. Thank you.

  • I need to check the values of the same variable in the 25 instances and get the instance that have the highest value if it is unique or request that the user changes the equal values. I believe I will need to use the "Sprite>Pick highest" event but I don't know how to build it.

  • I found the error thanks to your example.

    Thank you.

  • I tried your script but I am still don't getting the result I want.

    Just one instance may have 10 as value if not, I need to ask the user choose one of them to set as 10.

    I also need to know if the user did not activate all the instances (clicking them). This is the reason that I am checking if all the instances are activated or not.

  • I changed the script for this:

    Pick all Sprite
    Sprite is active
    Pick all Sprite
    Pick Sprite where Sprite.quant = 10
    Sprite.PickedCount  >= (greater or equal) 1
    Sprite.PickedCount  > 1 => action
    Else => action
    Else => action[/code:3su1hr6i]
    
    The problems are:
    [ul]
    	[li]I cannot confirm if all the sprites are active. I just can check if all the Sprites are not active (e.g. nothing happens If I have one instance activated)[/li]
    	[li]I cannot confirm If none of my instances does not have the value 10, only if has 1 or more.[/li]
    [/ul]
  • Thanks.

    I am doing this:

    Pick all Sprite
    

    Sprite is active (I am checking if the user clicked in each sprite)

    >> Pick Sprite where Sprite.quant = 10

    >>>>Sprite.PickedCount > 1 (to check if exist more than an instance with 10 value in its variable) => action

    >>>>Else => action

    Else => action[/code:3cyi3ss4]

    But it is not working.

  • I have 10 instances with a local variable (quant) and I need to check if two or more variables have a 10 as value (because it is not allowed) and if at least one variable has a 10 as value (it's a necessary condition).

  • I am storing these numbers in variables and subtract one by other like I exemplified above. I just need to format the result.

  • Hi

    I have two two different times in ms and I need to subtract one by other and get a result with 3 decimal digits.

    Example:

    Right => 0.187 - 0.165 = 0.021

    I am getting 0.214 instead 0.021

    Any help?