mekonbekon's Forum Posts

  • I managed to find a fix:

    dropbox.com/scl/fi/vrzykba1prx4d868di03m/flock_02.c3p

    I think the issue was that the birb's picking for nearest neigbour was picking itself, so it was always trying to turn to avoid itself. Either way, I jiggled around the picking conditions to make sure the active birb was excluded and it seems to help.

    Other changes:

    - I swapped to using the range object for avoidance (like I do for the other flocking routines) to pare down the selected birbs, which made things a bit easier.

    - The birbs decelerate if they find a target in front of them, spacing them out

    - I now use a single range object for all birbs and shuttle it around for each check, rather than each birb having its own pinned range object.

    The sim works pretty well for about 100 or so birbs with all flocking routines running, but starts to slow down beyond that (still above 30fps but the lag is noticeable) - I'd be super appreciative of any optimisation suggestions.

  • Sorry, should have mentioned the other (most obvious) way to create the array json - right click on the Files folder, and select New>Array; you can then use the built-in array editor.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I create a json file by saving a txt file as a json then importing it into the files folder in the project bar by right-clicking on the folder icon and selecting import files.

    You might also be able to do it by right-clicking on the folder and selecting New>JSON - I haven't tried that method though.

  • You're welcome :-)

    If you don't want to shuffle the questions, disable the call to the shuffleQuestion function in the On Start event.

    If you don't want to shuffle the answers, in event 5 you can swap both references to AdvancedRandom.Permutation(loopindex("j") to just loopindex("j")

  • You can use either of the examples I've posted - you just need to add more questions to the array file. There may be an easier method (perhaps importing a csv?), but using json array files is a fairly straightforward way to do this.

  • Here's an example that lets you select answers and then submit:

    dropbox.com/scl/fi/zixccsdaj7x0r57vkb1c4/quizTemplate2.c3p

  • Add each image to a different animation in your Symbol sprite object, e.g. "a", "b" and "c".

    Use the action: Symbol set animation to choose("a", "b", "c")

  • Hi all,

    Inspired by your efforts I've been playing around with this over the last few days:

    dropbox.com/scl/fi/8an3so660riy8qmwrfz54/flock.c3p

    The group and align events seem to work pretty well, but I've got a problem with the avoid routine; at any avoidStrength above zero the birbs all head to the left of the screen and hug the wall.

    Try with just the avoidStrength and avoidRange on.

    The issue lies somewhere within events 24-29.

    Rather than try and calculate a group-based avoidance angle, I've gone for a simpler approach by just reacting to the nearest neighbour. My thinking is: for each birb, pick the next nearest birb; if the neighbour is within avoidRange and in front then try to turn turn 0-45 degrees in the opposite direction from the neighbour.

    Given that they all fall into a pattern it suggests there is some constant biasing their movement, but I can't pin it down. Any ideas?

  • Cool demo btw! :-)

  • Maybe switching the rotate towards angle with an angleLerp?

    anglelerp(a, b, x) Linearly interpolate the angle a to b by x. Unlike the standard lerp, this takes in to account the cyclical nature of angles.

    As a quick test I replaced your rotate toward angle with this:

    -> boid: Set angle to anglelerp(Self.Angle,boids.Angle+3,0.01) degrees

    and it looks to me a bit smoother - you can fiddle with the 0.01 value to change the rotation speed. Also I'm not sure the "boids.Angle+3" part of the lerp is the correct conversion for move "3 degrees towards".

  • You can either use a dictionary or array to store values for multiple items. If you want each item to have its own multiplier I'd use an array, otherwise a dictionary is fine.

    Here's an example showing both:

    dropbox.com/scl/fi/n3jhez01fvvzotxsvblwg/multiItemShop.capx

  • I've rounded the value to avoid decimals - you can remove the "round" expression if you'd prefer them.

  • on "Buy" btn clicked, cost = cost*1.5

  • It looks related to this known issue with bullet behaviour bouncing:

    construct.net/en/forum/construct-3/how-do-i-8/fix-problem-collisions-126684

    There's a response here from Ashley in the bug report:

    github.com/Scirra/Construct-bugs/issues/622

  • I tried to make the reflection working from all angles, not just from the left. But I couldn't work out the math and gave up. Maybe someone else could fix it.

    dop2000

    Pig fix 4 U :-)

    dropbox.com/scl/fi/l8hk52kjcihsyb1ly4cnj/DrawingCanvasMirrorPigFix.c3p