99Instances2Go's Forum Posts

  • Okay. Your inventory should just show the situation. The situation is baked in the Array. So, the inventory shows the array. Thats all.

    To couple something to an array, you need common ground. The most easy way is to give the cells in the inventory a number (instance variable) and that same number on the X-as (y=0) in the array.

    Now you can loop trough the (for each element) Array (with array.curX) and pick the cell with number = curX, to find the cell that goes with the array.

    But you can also loop trough the cells (for each) and pick the corresponding element on the X-as = cell number, to find that element in the array that goes with the cell.

    Maybe it makes no sense to you now, but i got a capx to back it up.

    On the Y-axis you store whatever you like. Just make a comment in your events what each Y is supposed to be.

    In this capx y1= animationframe and y2=amount of found items.

    https://www.dropbox.com/s/gdj8qoo8532jr ... .capx?dl=0

    I also wanted to show you how easy it is to use INSTANCES of the same object, that are differend by animationframe (or just by animation) to represent the items that can be found.

    As you see, it is really compact in events, yet this capx does a lot of things.

    Dont understand something, just ask.

  • Did you even open my example ?

  • Exactly the same way as with familys. Not pressing you to drop familys, just a bit afraid that making differend levels can get a bit complicated. But i can be wrong, because dunno where you gooing with this.

    Rule is, use instances when possible, coding gets easyer and slimmer. I think you got confused with the famely this problem (allready). Would you have used instances (and you pick them exactly the same way) i feel that you would have solved this by your own, not beeing confused by the family. Thats is the reason why i expressed my concerns.

  • Or trow you capx, i (or some one else will modify it), or try to understand.

    When the animation frame = frame 8, you want it to spawn an arrow. But.

    Your animation will not change a frame each tick. Because the speed of the animation is lower than the speed of ticks / second. A tick is the time it takes for al events to run once. On a fast computer that happens 120 times in 1 second. But if your animation is set to 20 frame changes (animation speed) in 1 second, each frame will be on screen for 6 ticks. (120 / 20)

    Meaning, frame 8 will be on screen for 6 ticks. Or, that condition frame = 8 will be true for 6 ticks. Or, that event will be true 6 times in a row. So it spawns 6 arrows.

    Solve it this way. Right click on that event containing that condition frame = 8, choose "add another condtion' from the list that pops up. Double click 'system'. Look for 'Trigger once while true'.

    Now you have an event with two conditions. The 'Trigger once while true' will fire the arrow only the first time frame = 8. All other 5 times it will not fire, hence only one time when it is true.

  • blackhornet , so you can't pick UID by one group and alter by another. Felt like it shouldn't make any difference, since an UID is always same no matter what family the object is in. Oh well... back to the drawing board.

    So if you filter out (is on screen, is moving) ONE object in group 1, and you feed the UID of that one object to the function, then all you got to do in the function is pick by comparisation > object = group 1 or 2 (does not matter) expression = group.UID ... value is the parameter .. operator ><. And do your stuff in the actions. Because all but that one with that UID will be in the picklist in the function. A function ALWAYS starts picking from scratch.

    But, i suppose 'is on screen & is moving" does not pick ONE object, but a bunch of objects. So in the picklist there are more objects. Looping trough those and it feed them one by one to the function will not solve it. Because the first index in the loop will select other objects then the next index in the loop, and in the end you see only what happend compared to the last object in that bunch of objects.

    The solution here is not use a function. But think the other way arround. Pick straight.

    Condition > invert the 'on screen'

    Condition > invert the 'is moving'

    Now you have everything picked that you wanted to pick. Do your stuff in actions.

  • Not sure why you want all diff. objects for those texts, instead of instances. That can give you troubles later on.

    But, here goes.

    https://drive.google.com/open?id=0B1SSu ... ElfaFA3azA

  • Dude, they told you. Use 'trigger once while true'. Why ?

    Your animation is not playing at 1 frame/tick. On my computer that would be 120 frames/second. I guess it is playing at 10 frames a second.

    So when you say... If animationframe = 8. That animation = 8 for several ticks in a row. And each tick this frame = 8, an arrow gets spawned, exactly as you ask it to do.

    Use 'trigger once while true' in that event, as they told you.

    And that animated gif is superannoying.

  • In your last post, that should set each sprite that is less then 50px away from each other opaque.

    That works if the sprites in the layout are far away from eachother, creating the illusion that those that are close to the one that is locked to the mouse are picked.

    That works if that was what you intented to do.

  • In the first attempt, you locked the first created sprite to the mouse. Then you looped trough all sprites, and feeded all those to the function.

    The function is a NEW TOP-EVENT, so it forgets (by design, and luckely so) any previous picked lists. So the function picks out of all sprites those that that have a differend UID then those you feeded to the function. And yes, including the one you locked to the mouse. But also all others. Then loops trough them, and compares the distance. As a result they kinda flip-flop. In one loop one gets set 50 % opaque, in the next loop that same one gets back to 100 %. You needed to compare to only that one that you locked to the mouse.

    In the second attempt. The for each runs on each member of the family, because there is no previous picked list. There is also no previous picked list for Sprite. So it picks out of all sprites those that dont have the same UID. Wich is just all of them. So basecaly it runs trought all family members and for each famely member it runs trough all sprites. If you have 100 sprites, that would be a loop that counts 100 * 100 times. Again creating some flip-flop thing.

    Here is a working example. I used drag and drop to be able to explore more situations.

    https://drive.google.com/open?id=0B1SSu ... HUydDNQcmM

    As you see i feed to the function only the postion of ONE sprite. In the function i pick all but that one sprite. Then i compare the distance of those only one time against the position of that one sprite.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thinking it trough. Even better would be ...

    End index should be max(0,Touch.TouchCount - 1)

    To not allow the loop to count from zero to - 1. This is only to have it even more performant. Not dooing this will not create an error.

    Also, you have to decide if a 3th touch is allowed.

    If not, you need to add a system > compare 2 values > Touch.TouchCount <= 2.

    Touch.TouchCount is the expression that returns the amount of touches on the screen.

  • System > For (loop)

    Repeat the event a number of times, using an index variable over a range of values. The index can be retrieved with the LoopIndex system expression and passing the name of the loop.

  • Depending on how many steps this circular bar needs to show (if not to many), it can be done without plugins. Just use an animation. 100 frames is no problem. And that is every 3,6 degrees.

  • If not, just ask, there are csv specialists in here (not me yet).

  • The easy way to handle multitouch. Just accept that there is a accessible list of touches.

    A list you handle the same way as every list.

    https://www.dropbox.com/s/875fodjn39q03 ... .capx?dl=0

  • Did you place it in the project map, using Windows?

    Or did you rightclick 'files' (on the right) in Construct and choosed to 'import' ?