brushfe's Forum Posts

  • You do not have permission to view this post

  • It might be because you've put the string variable Target_exit in quotations. This means construct is looking for a layout called "Target_exit", instead of what the variable Target_exit represents.

    Try writing Go to layout -> Target_exit without the quotation marks.

  • Genius, that did it! Thanks to you both for the fast help.

  • Hey, I think you're right! That would explain why overwriting works, but not deleting.

    It didn't even cross my mind. So to clear an array of certain entries, you can't write:

    ----

    Array -> For each X element

    Array -> If value at CurX = 1 ... Delete index CurX from X axis

    ----

    because the element index number is out of sync with the entries?

    I suppose you'd have to use loops and a variable that keeps up with the deleting of entries?

  • I've noticed in my code that deleting array entries doesn't always seem to work.

    Since I'm new-ish to arrays, I didn't want to assume this is a bug. If anyone has a moment to test this, I've attached a file that reproduces the problem.

    It creates an array of random numbers (0-1). Then it scans the array for entries with the number 1, and deletes them. But it only deletes a few (it should delete them all), so it makes another scan, and deletes a few more (again, should delete them all).

    If you open the console you can see the results. Refreshing it a few times shows the inconsistency

    Note: There's an option in here to overwrite the array entry, instead of deleting it. Overwriting the entries works every time, but deleting the entry is inconsistent.

    Thanks for any insight!

    https://drive.google.com/file/d/11wroFtK9fc-pG82ruW2j4dWti96KhdEy/view?usp=sharing

    Tagged:

  • Ah sorry! I missed your topic when I was looking around.

    It does seem unnecessary. I'm not sure the fear of clogged-up function lists is worth taking away flexibility or imposing a coding style.

  • If I understand right, it just means you can't call a return-value function without caring about its return value (Logical, sure, but C2 gave you a lot more flexibility)

    In C2 I'm sure that I could call this function without worrying about its return value:

    But in C3, it seems like I have to do this:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the quick reply!

    But if these functions can only be called as expressions, doesn't that mean they can't be used for anything else (actions like changing animation, adjusting effects, etc)?

  • (I'm still getting used to the C3 functions, so I may be missing something obvious)

    I have a function called "SetNextRoom" which (among other things) is supposed to return a number. I've set its return type to "Number.

    But when I try to reference this function, it doesn't appear on the function list with the others.

    And when I set the return type to "None", it suddenly appears on the list.

    I'm used to this in C2 — am I missing something?

    Tagged:

  • You do not have permission to view this post

  • You do not have permission to view this post

  • You do not have permission to view this post

  • This is fantastic! What a great approach... so much simpler looking backwards. This has really helped me out.

    Never sure how to say a proper thanks, but thanks very much!

  • I've been building a baseball game based off this great ball formula from rojohound, and I'm now building the AI that needs to chase the ball.

    https://www.construct.net/en/forum/construct-2/how-do-i-18/design-2d-baseball-physics-135768

    What I've been trying to figure out is a way to predict where the ball will end up, and have the AI move to that location (rather than needlessly chasing the ball's current location).

    I've tried making a second copy of the ball, and multiplying the values in the formula, but I'm getting lost in the math and can't get it to slow down properly.

    If anyone has any thoughts or insight, it's much appreciated!

  • You do not have permission to view this post