mekonbekon's Recent Forum Activity

  • You can do it as follows:

    I added an instance variable called "direction" to store the angle from the sprite to the mouse, then

    used a chain of conditional operators (Is statement A true ? If so do X : else is statement B true ? If so do Y : else to Z) to set the animation based on that value.

    One thing to note, 0 degrees points right, not up.

    EDIT: Can't get the image of the events to display, here's the capx:

    dropbox.com/s/2nnpw8v2w9c1guw/topdownDirection.capx

  • Here you go:

    dropbox.com/s/8rxd49g89k9zyxo/quizApplern.c3p

    The score wasn't being tallied because the "selected" boolean was being used to check for a correct answer but it wasn't being set anywhere. However, you don't need to use that boolean any more because you can just check if the answer boxes are ticked.

    I've tidied up a few other things and added comments to explain the changes.

    A couple of suggestions for keeping healthy code:

    1) Keep an eye out for events that are unnecessarily running every tick - they can end up slowing things down. There were a few that needed to be nested under a triggered event.

    2) Avoid repeating triggers with different conditions e.g. On button pressed, do action A; On button pressed, do action B. Instead just have one "On button pressed" trigger, then action A and action B as sub events.

  • applern You haven't included a link to your app - post it up and I'll take a look.

  • If you're planning on picking between weighted multiple items you might want to check out probability tables using the Advanced Random plugin:

    construct.net/en/make-games/manuals/construct-3/plugin-reference/advanced-random

    It makes it a lot easier to change the weightings on the go, especially if you have a large number of items to choose between.

  • You could either create a separate 1D array (e.g. a_questionTimes) or use the indices at a_questions.At(0,currentQuestion,1)

  • "score" is already a global variable, you shouldn't need to add or change anything to how the scoring works, just include whatever method you want to go to the next layout - for example, in the template I provided after event 21 you can just add:

    + System: Else

    + txt_nextQuestion: Text is "QUIZ COMPLETE!" (Ignore case)

    -> System: Go to next layout

    And then in the next layout set the text on a text object to "Your Score is: "&score

  • I've updated the template - grab it again from the link above.

    In the checkQuestions function there is a local variable "n" - this tracks the number of incorrect answers. After running checkQuestions, if "n" is 0 (no incorrect answers) then the score is increased by one.

  • Do you want to want to score a point for each answer per question that is correct i.e. both a selected correct answer and an unselected incorrect answer score a point, or just one point per question if the answers are 100% correctly selected?

    Would the score for the current question only be shown after "submit" had been pressed?

    Do you intend to keep a running total score?

  • You might find this demo useful:

    dropbox.com/s/ff0tic8sw1cu0od/bitwiseTilemap_01.c3p

    It doesn't use an array, just works directly on the tilemap, but it should be relatively straightforward to swap the tilemap co-ords to array indices.

  • So in this project which would be the current loop that we are seeing the loop index for?

    loopindex always refers to the currently running loop. For example, in this "for" loop:

    For "i" from 0 to 3, append text loopindex to TextObject.

    the text displayed by TextObject would be "0123"; each time the loop runs it takes the current loopindex value (which steps up by 1 with each loop from 0 to 3) and adds it to the text string.

    The index tag allows you to differentiate between loopindices in nested loops e.g.

    For "i" from 1 to 2 --For "j" from 1 to 3, append loopindex("i") * loopindex("j") to TextObject

    ...would display "123246" - during this nested loop each step of "i" runs a complete loop from 1 to 3 of "j".

    Also what does + Answers: no = LoopIndex("DrawAnswers") mean?

    I know we drew the answers from the array, but now what is that code used for. What are the instance variables correct and no used for?

    txt_answers.no is an instance variable that distinguishes between the different instances of txt_answers - if you check the txt_answers objects in the layout you will see the value of "no" increases by one for each object as you go down the layout.

    txt_answers.correct is an instance variable that equals 1 if the answer it is displaying has been marked in the questions array as a correct answer (check the "Depth = 1" sheet in the array editor for a_questions: correct answers are marked with a 1, incorrect with a 0).

    Event 6 runs a loop through each of the answers in a_questions for the current question; if the current answer slot in the array isn't blank it picks the txt_answer object with a "no" value that corresponds to the current answer (loopindex "i"), then sets the text of that txt_answer object to the answer (using the shuffled permutation table, if the action specifies it).

    In Event 7 (function checkQuestion) each txt_answer is checked to see if it has been selected by the user (txt_answer.selected is true) and if it is a correct answer (txt_answer.correct is 1); if both are true or both are false spr_tickCross displays a tick, otherwise a cross is shown.

  • The Loopindex is the current iteration of the referenced loop.

    From the manual:

    LoopIndex

    Get the index (number of repeats so far) in any currently running loop.

    LoopIndex(name)

    Get the index (number of repeats so far) of the loop with the given name. Useful for getting indices in nested loops.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What does

    > + a_questions: Value at (LoopIndex("j"), currentQuestion, 0) ≠ ""
    

    mean? (Event 6 condition 2)

    This checks tif the answer in the a_questions array at the current loopindex is not an empty cell (text does not equal "").

mekonbekon's avatar

mekonbekon

Early Adopter

Member since 9 May, 2014

Twitter
mekonbekon has 13 followers

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x2
    Popular Game One of your games has over 1,000 players
  • Famous Game One of your games has over 10,000 players
  • Coach One of your tutorials has over 1,000 readers
  • RTFM Read the fabulous manual
  • Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

18/44
How to earn trophies