applern's Forum Posts

  • I don't see any pictures in your message...

    Like I said, try adding "Wrong=0" conditions to your events "Correct=8", "Correct=9" and "Correct=10".

    If this doesn't work, change the code to run only when you press the "submit answer" button, not on every tick.

    I idd it right now

  • as a quick fix, you can try adding "Wrong=0" conditions to your events "Correct=8", "Correct=9" and "Correct=10". But then the order of events becomes important. I really suggest getting rid of the "state machine" code and do this with triggered events and functions.

    What does 'state machine' mean. Can you write the code you suggested in the

    Code format?
    

    Thanks. Also here are the code screenshots.

    Correct

    Wrong

  • In my app when you do a correct answer an apple blooms on the tree and when it's wrong an apple falls. If you have it correct it adds 1 to ("correct" variable) and the code has created an instance of apple at a random place.

    so here are a few eg

    + System: Correct = 8
    -> Seed6: Set visibility Visible
    -> Apple: Set visibility Visible
    ----+ System: Trigger once
    -----> System: Create object Apple on layer 0 at (random(82,701), random(31,274))
    
    + System: Correct = 9
    -> Seed6: Set visibility Visible
    -> Apple: Set visibility Visible
    ----+ System: Trigger once
    -----> System: Create object Apple on layer 0 at (random(82,701), random(31,274))
    
    + System: Correct = 10
    -> Seed6: Set visibility Visible
    -> Apple: Set visibility Visible
    ----+ System: Trigger once
    -----> System: Create object Apple on layer 0 at (random(82,701), random(31,274))
    

    Now if you press the wrong answer it'll make an apple fall(using Bullet behavior) and adds 1 to "wrong" (variable)

    eg:

    + System: Wrong ≥ 1
    --------+ Apple: Is visible
    --------+ Seed6: Is visible
    ------------+ System: Trigger once
    ----------------+ System: Pick a random Apple instance
    -----------------> Apple: Set Bullet Enabled
    -----------------> Apple: Move to top of layer
    -----------------> Apple: Set Bullet angle of motion to 90 degrees
    
    ------------+ Apple: Y > 600
    -------------> Apple: Destroy
    -------------> System: Subtract 1 from Correct
    -------------> System: Set Wrong to 0
    

    The problem is let's say you're correct variable is currently 9 and you have 2 apples. You do the wrong answer so the correct variable should be = to 8 and one apple falls down. So you're left with 1 apple. Then let's say your next question is wrong. So the variable will become 8, and an apple falls down and you should have no apples left. But the problem is there will be an apple left why? because my code says if you have 8 as your correct variable it'll add one. Even if it's wrong. Is there a way to stop creating an apple?

  • 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

  • You do not have permission to view this post

  • Key events are missing such as when and how do you add 1 to wrong? Can't really figure anything out from this code.

    I addd 1 to wrong, when the wrong answers are pressed. Once it does the required action I set 'Wrong back to 0

  • Definitely an easy fix, easier to work out if you share the file

    I'm sorry but, I'm not allowed to. This is the most i can give you :( I really wish i could tho 😔😔

  • Unlike the heading, this is a bit more complicated.

    When 'Seed' is visible and Wrong = 1 show 'WrongCompletely' ( sprite)

    + System: Wrong ≥ 1
    ----+ System: Trigger once
    --------+ Seed: Is visible
    ---------> Seed: Set visibility Invisible
    ---------> WrongCompletely: Set visibility Visible
    ---------> System: Set Wrong to 0
    ---------> System: Subtract 1 from Correct
    

    so when apple is shown I don't want the wrong ( sprite) to show

    + System: Correct ≥ 7
    + System: Wrong ≥ 1
    -> WrongCompletely: Set visibility Invisible
    ----+ System: Pick a random Apple instance
    -----> Apple: Move to top of layer
    -----> Apple: Set Bullet angle of motion to 90 degrees
    -----> Apple: Set Bullet Enabled
    
    + Apple: Y > 600
    -> Apple: Destroy
    -> System: Set Wrong to 0
    -> System: Subtract 1 from Correct
    
    

    But when correct = 7 and wrong = 1 the 'Wrongcompletely' sprite shows and the apple doesn't fall. Here is a pic of the debugging

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • here is a quick sample:

    https://rieperts.com/games/forum/AppleTree.c3p

    In your code it states

    -> System: Create object Apple on layer 0 at (50 + random(400), 50 + random(250))
    

    What does that mean?

  • You can save all the questions in a string variable here is an example of a variable with 3 questions "1+1; 2+2; 3+3" after that when you start your game you can set what question to show like: set text -> tokenat(variable,0,";") this will show the question 1, etc.

    Also you can kinda fix your code, let's say you check if Wrong >= 1 Wrongco set invisible, you do it too many times, but you only need to add it in one event. invisible

    Also you have the if Wrong => 1 and if seed is visible / if Wrong => 1 and if seed2 is visible / seed3 , seed4.

    You can add as event the if wrong => 1 and the other as subevents.

    I don't understand. Can you do it in code format?

  • Hello, first of all, check the 1st picture at event 4 maybe you insert the event as sub-event.

    Second, if you did not care about the variable "Wrong" after a turn to 1 or higher you can remove "trigger once" and move the "Subtract 1 from correct" at top of the "turn Wrong to 0".

    And third, why so many layouts? Do you have different pictures in each layout? Or is it just a different question?

    Thank you. It is a different question.

  • Okay. So in my game when you get a correct answer it adds to the correct variable. and another event will do

    CONDITION

    Correct = 1

    ACTION:

    Show seed (sprite)

    And the same with 2 correct answers in a row

    CONDITION

    Corrrect= 2

    ACTION:

    Show Sapling (sprite)

    And if it is Wrong then

    Condition:

    Add 1 to Wrong

    ACTION:

    Show Wrong (sprite)

    Sub Event

    Trigger once

    Action:

    Subtract 1 from correct.

    Got me so far? Here is where it gets confusing.

    If I get correct and then 1 wrong, It'll show the Wrong (sprite) but also show the Seed because even though it got 1 wrong the variable becomes 1. After all, it subtracted but the value is still more than 1. And my event shows that when Correct = 1 shows seed. So yeah. I know its confusing and I'll show my coding so I hope it helps. If you can, It'll help a ton. Thanks!

    I didn't get to fit all the coding in 1 pic so it's the continuation

  • You do not have permission to view this post