NicotineLL's Forum Posts

  • Thanks for the input! The solution did seem hacky, but I couldn't think of anything else that would work outside of writing a script. I guess I'll just use a host family to do the picking.

    Unfortunately, I can't really use objects2 to loop since the snippet is a part of a larger function, but as a standalone it does look better.

    I did, however, like your approach to the comma solution so I'm yoinking that! Very neat indeed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I need to create a loop for object in family "objects" that have children "objects"

    In code something like this:

    for each objects
    repeat objects.ChildCount
    objects pick child objects instance loopindex
    do stuff
    

    As a workaround I've created a second family, which purpose is only to host the objects from the first family so I can reference them, but I'm looking for slicker solution that doesn't require a feeder.

  • Confirmed not currently possible by Ashley some time ago - construct.net/en/forum/construct-3/how-do-i-8/change-sampling-mode-runtime-144232

    It's technically difficult to support because only WebGL 2+ supports changing the sampling mode, and it's not yet widely supported enough to trust that it will work everywhere.

    I even took a look at the Addon SDK and there only GetSampling() method ( construct.net/en/make-games/manuals/addon-sdk/runtime-reference/runtime ) and no way to set a new one and if it's not there it probably doesn't exist.

  • You could, but I'm not sure you'd want to. See, there are as many aspect ratios and screen resolutions as there are devices out there and if you're not making a project that ONLY fits your device then you need to think about supporting the rest. That's why there are different types of scalings.

    I would like to forward your attention to this tutorial which should have it explained in more detail - https://www.construct.net/en/tutorials/supporting-multiple-screen-17

  • Using a function is fine, however, in this case that would be the same as ploping my code directly on the condition check and not something I want. On a smaller project it might pass, but when it spans multiple event sheets where I want different code logic to stay grouped together I prefer to do a "trigger".

    I am familiar with the "wait 0" approach and it does in fact work, being confirmed by Ashley multiple times, yet it still seems so hacky to me, I don't know why we can't have "wait end of tick" or "wait next tick" kind of actions to make it official.

  • You do not have permission to view this post

  • This is not the most accurate approach by any means, but something you might try first:

    1. Get all your car sprites and put them in a family, call it "cars" for example.

    2. Then add instance variable to that family called "car_number" and in your layout select all 4 cars and give them unique car numbers (from 1 to 4)

    3. Create a new sprite object, call it "finish_line" (if you don't have one already) and place it at the finish... line

    4. Create a new text object, call it "leader" and place it where you want to have it shown on the layout

    4. In the events sheet do the following:

    Origin points matter in this case, so you might want to create new ones if you want further accuracy.

  • You do not have permission to view this post

  • I tried searching for quite a bit, but either my terminology is wrong or there just isn't much information about this topic.

    I want to create an event condition that acts similar to the built in triggers - if a condition is met during this tick -> do this. For example, I found the built in "Browser -> On Resized" trigger unreliable for my purposes (also I need the exact canvas dimensions anyways), so I wrote something similar to this:

    What I would like, however, is to not have to manually set the boolean to false at the end there, but instead automatically do that the the end of a tick, making sure that events that check that boolean would have time to run. How would I go about that? If there are any other solutions I'm open for suggestions.

    Thanks!

    Tagged:

  • I have the following issue - Platform is sticking to the bottom of vertically moving Solid objects with the Sine behavior, this happens if the object is moving at certain speeds (usually quite fast)

    My guess of what's happening is that, depending on player object's gravity and the speed of the moving platform, the player might not be able to accelerate fast enough to get away from the sine object on the next frame. That causes the engine to think that the platform has just collided with a Solid object on top and sets Vector Y to 0. This continues until the Sine object gets slower, stops or start moving in a different direction allowing the player to pick up vertical speed and get away.

    Does anybody has an idea of how to counter this issue?

    Tagged:

  • I have tried that before and it would work in the example above, however there are a couple of issues I personally found with this method:

    - It only checks one object and even if you add multiple objects into a family, not all object types can share the same family (like sprites, tiles and 9-patch, etc). So if two different objects overlap while being clicked, then both clicks will fire.

    - Also this logic will be ignored on "button down" and "on release" triggers, unless specific conditions for those are added as well. Haven't fully explored this route though.

    I do believe however that I managed to rubber duck debug my problem by writing my initial post. This is what I came up with 30 minutes later. I haven't fully tested it, but it does work in theory. Here's a screenshot:

    There are two dependencies in order for this code to run correctly:

    1. After a mouse click trigger event we must set allow_clicks to false.

    2. At the very end, after all mouse trigger events we must reset allow_clicks to true.

    - As a fail-safe I also make sure that allow_clicks is true at the start too.

    If someone finds an issue with this solution and thinks it might break at some point I would love to hear it!

    One potential problem is that I'm relying on this code running synchronously, but as of right now I can't find a situation where it wont.

  • So I'm stuck on this issue and I can't find a solution for the life of me.

    I'm trying to prevent double clicking on an object, but it seems that everything I try is either not reliable or straight out hacky.

    Here's a very bare-bones code of what would cause a double trigger:

    - We have an object with instance variable "clicked".

    - On the first click we set the variable to true.

    - On the second click if "clicked" is "true" we destroy the object.

    What would happen however is when we click once, the code will be read in sequence, therefore setting "clicked" to "true" and destroying the object instantly.

    A simple way of fixing this very example would be to move the second click event at the top so it gets checked first and that way it will prevent the double click, however this is easier said then done on a larger scale project with multiple files, functions, etc. so I label this method as "unreliable"

    Second solution would be to create a tick timer and compare against that (skipping the current trigger check), this is how this version would look in code:

    This method will work for most cases and on a larger scale, however to me at least it seems "hacky" and like a disaster waiting to happen. Not to mention if we start using "on click" and "on release" trigger then the click timer would simply not work, since we can hold the button down for longer than the timer.

    I've played with the idea switching layers and visibility, but I'm determined that there is a better solution.

    Does anyone have any clue how to tackle this problem differently?

    Edit: In a way, I want "On click", "Mouse button is down" and "On release" to be treated as one entity and only one event can occur during this period.

    Tagged:

  • Or just pass the UID?

    Since I'm creating items from a JSON file using a function, then getting and passing the UID of the newly created items to another function "didn't feel right", I wanted to go another route.

    I'll play around with the "On created" trigger and see where it leads me. Another alternative I'm exploring is changing the "color" function into a check on every tick with conditions and bypassing the need to call a function altogether.

    Thank you all for the help!

    Edit: Okay, for future reference if someone has the same issue, here's a solution with a check, bypassing the use of picking UID or using triggers ("On created" did not work for me for some reason).

  • I want to call a function on a newly created object, but it does not work unless I pass the object back to it (its UID).

    Is it even possible to do it the way I want?

    Tagged:

  • This is the first thing that came to my mind - https://www.dropbox.com/s/sfa3skfjj8qe9 ... .capx?dl=0 Run it and move the mouse around the canvas. Could be improved for whatever your specific case is.