BillyShears's Recent Forum Activity

  • First of all, with such a tiny array, you could probably get away with doing thousands of full scans in a single tick without noticing any sort of slowdown.

    That said, if you still want to optimize it in a way to reduce redundant checks to a minimum, we need to know a bit more about what you are actually trying to do.

    In particular, could you perhaps elaborate on this sentence : "If I find the value, I would remove it from that cell but possibly add the value elsewhere in the array".

    Is the value shifting conditionnal ? (if so, what is this condition ?)

    Where do you move the value ? (same row, column, anywhere in the array)

    Do you "set" another cell, or do you add a cell value to another ?

    Thanks for your feedback, yes you basically explained how it works, I always remove it once found then conditionally add to adjacent cells, i did get it working now (relief!)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I am trying to iterate through an array and currently have nested for loops using the loop index to accomplish this. (Is this even best practice?) This works great for one pass through the array.

    However, I need to find the optimal way to iterate through the array multiple times until I process a certain value found in the cells, and keep searching until the value is no longer found. If I find the value, I would remove it from that cell but possibly add the value elsewhere in the array, thus the need to search/iterate through again.

    Here are my ideas on how to do this ...

    A) If possible, make a loop that uses a counter variable as the loopindex that I increase or decrease accordingly, this way I could check the cells in one row for the value I'm looking for, if value was found counter does not increase and I process the row again. If value is not found, then all clear and I increase the counter by 1 thus moving to the next row. This choice would let me process only one row at a time before having to repeat the search.

    B) Use my existing nested for loop inside a while loop, and just keep running the for loop with regular loop index until the value is no longer found in the array. This seems simpler to set up but would iterate through the whole array before having to start the search over again.

    I know either choice will most likely be a dog on performance but hoping to take less evil. The array is 8 x 10 max and I'll probably wind up repeating the array search anywhere from 0-20 times (if that helps when considering performance cost).

    My actual questions:

    1) Which choice is best (performance and ease to build)? Is there a better way I'm not seeing?

    2) If choice A is even possible and I use counter variable as loop index, which type of loop do I choose specifically and how do I set that loop to use my counter variable?

    3) If choice B the nested loop inside a while loop, how do I actually stop the while loop? I've found stop loop condition while researching but not sure where to add that in relation to the while loop.

    Thank You for any feedback or assistance!

  • BillyShears You need to download the addon manually from that link I gave you, then install it in Addon Manager. Then restart Construct and try to open the project.

    https://www.construct.net/en/make-games/manuals/construct-3/tips-and-guides/installing-third-party-addons

    Took a little break, but I did get my menu working. Thanks for all the help !

  • Hello. Maybe "System -> Create object (by name)" could help?

    thank you, I did end up using this

  • Thank you very much for the example, trying to use it now ...

    How do I get the add-on installed? When I goto get addons from my project, it seems I can only select from a set list of addons, not the one I downloaded from the link. What step am I missing here. Thanks.

  • I would like to store various values in an array and then from different levels in the game find the corresponding element and spawn an object from the retrieved value.

    For example ...

    Player enters the shop on level 1, check array and see that the shop sells a knife, shield, and herbs.

    Player enters the shop on level 2, check array and see that the shop sells a sword, armor, and health potion.

    Is this a proper way to approach this? If so, what value do I store in the array (name or some id) and how do I spawn based on the retrieved value. (When I try to spawn another object, I only see the drop down menu of existing objects, nothing that can be replaced by a formula or variable)

    If there's a different way to do this, I'm also open to hearing that.

    Thanks for any help.

  • That worked, Thank You.

    I was over complicating it. I used system action as you suggested, set value to home.x and home.y and "it" knew which home I needed. Thank You!

  • Hello, thanks for your reply. I have already set that condition up, but I cannot get access to the global variables on action of “Home”, only instance variables.

    If I change the action to use system then I can access the global variables, but now I don’t have the specific “Home” object to get coordinates.

    Am I missing a behavior or separate step?

    Thanks for any help.

  • I have a "Home" object with two instances on the layout.

    I have two global variables for currentX and currentY

    I want to set currentX and currentY when my player object overlaps either one of the "Home" objects.

    How do I get the X, Y of the specific "Home" that is overlapping the player.

    Thanks

  • Thank you

  • I am using the sprite origin as x1 and y1

    I then swipe down from sprite, either down to the right or left, then let go. On touch end when I let go I record x2 and y2.

    I then apply impulse - angle(x1,y1,x2,y2)

    When x2 is less than x1 (swiping down to the left) it works fine and shoots the sprite up to the right.

    If I swipe down to the right and x2 ends up greater than x1, then the sprite fires off down to the right in opposite direction I wanted.

    Please advise if my angle setting is wrong and what formula I should be using to calculate the angle.

    Thanks for any replies.

  • Found game physics tutorial here, nevermind on the gravity

BillyShears's avatar

BillyShears

Member since 30 May, 2019

None one is following BillyShears yet!

Trophy Case

  • 5-Year Club
  • Email Verified

Progress

6/44
How to earn trophies