mekonbekon's Forum Posts

  • So Let say some questions of 4 answer choices, and some have 5 and some have 6. Should they be in seperate arrays?

    You can still use just one array. You would set the array width to the maximum number of answers. For those questions with less than the maximum number of answers leave the answer cells in the array blank. You can then do a check to see if the answer is blank (text = "") and if so set the corresponding spr_tickCross invisible.

    I've updated the demo to include this feature:

    dropbox.com/s/qc9dourwsf4f7g6/quizTemplate2.c3p

  • 1. Is 'totalquestions' a function? (event 1)

    No, it's a global variable that takes it value from the height of the a_questions array (i.e. the number of questions)

    2.What is BBoxRight (event 1)

    BBoxRight is the X coordinate of the right-hand edge of the spr_tickCross box.

    3.What is "i" (event 3)

    "i" is just a tag for the loopindex - in this instance it's not really needed, but when you use nested loops you give them different tags to be able to reference specific loop indices.

    4.What does permutation mean for advanced random?

    A permutation is an arrangement of values; the AdvancedRandom plugin can generate a random permutation of values without repetition - in this instance we randomise the order of questions and stick the values into a_questionOrder.

    5.What does 'Self.selected=0?rgbEx(0, 0, 0):rgbEx(0, 0, 255)' mean? (event 16)

    This expression uses the conditional operator to set the colour of the text. The conditional operator works as follows: Is this statement true ? If so do this : otherwise do this

    I'm sorry for all the questions :( But thnaks for all your help :)

    No problem :-)

  • Sorry, my bad - you also need to change the references to a_questionOrder:

    In event 4 change:

    -> txt_question: Set text to a_questions.At(0,a_questionOrder.At(currentQuestion),0)

    to

    -> txt_question: Set text to a_questions.At(0,currentQuestion,0)

    In event 5 change:

    -> txt_answer: Set text to a_questions.At(AdvancedRandom.Permutation(LoopIndex("j")),a_questionOrder.At(currentQuestion),0)

    to

    -> txt_answer: Set text to a_questions.At(AdvancedRandom.Permutation(LoopIndex("j")),currentQuestion,0)

    // Set the "correct" instance value on the answer.

    and

    -> txt_answer: Set correct to a_questions.At(AdvancedRandom.Permutation(LoopIndex("j")),a_questionOrder.At(currentQuestion),1)

    to

    -> txt_answer: Set correct to a_questions.At(AdvancedRandom.Permutation(LoopIndex("j")),currentQuestion,1)

    I've updated the demo to reflect these changes - the original actions are still there but disabled, in case you want to switch back. I also fixed a couple of other bugs, so it's worth grabbing again:

    dropbox.com/s/qc9dourwsf4f7g6/quizTemplate2.c3p

  • construct3.ideas.aha.io/ideas/C3-I-165

    Just sayin

    newt Added a vote - it's fun trying to figure it out in events though :)

  • jobel Thanks for the feedback :)

    one thing that is weird, when there's a potential head-on-collision the boid doesn't react, it just collides and moves through. Did you do this purposefully?

    Don't worry, nobody gets hurt, they're flying over and under one another ;P

    Seriously though, there's nothing in the conditions that factors in the angle of the neighbouring boid, only the angle to it, so it shouldn't really make a difference to its behaviour. If you turn up the strength to 1 it looks like they do react a little to boids coming directly at them, just not enough to guarantee missing each other.

    It could be that in the 10th of a second that they do the check there's another boid that's closer so they react to that one instead. Another reason could be that the maximum turn rate is too slow for avoiding head-on collisions so although they're reacting, by the time they start turning they've already collided.

    Ideally I'd work out a group angle with weighting for proximity but it hurts my head trying to figure it out - maybe for the next version.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I managed to find a fix:

    dropbox.com/s/3t7ngda18tx6i29/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.

  • 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/s/qc9dourwsf4f7g6/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/s/kz9k3aqa9a723q4/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".