Yann's Forum Posts

  • Nobody is responding probably because nobody wanted to dive into your heavy code. It's not super easy.

    Now than I read it a bit, I know that you're not doing it the right way if you want to repeat stuff over and over with more text content.

    When you see yourself copying stuff many times to achieve the same kind of display, you should try to find what is common and how to only change what is not.

    The things that are common are :

    • a text with a question in it
    • two possible clickable answers Or a clickable "Next"

    In short we can say that the Next is like an answer because in both case you will display the next text

    So basically you need 3 text object.

    You can either make them 3 instance with an instance variable 'type' to tell them apart (type = "question", type="answer1", type = "anwser2")

    Or

    Use 3 different object and group them in a family 'dialog'

    This way you can make the 3 object appear at the same time and avoid most of the repeated "set visible" lines

    Then the only thing you have to care about is how to grab the proper string and put it in the proper text object

    That's where it's complicated. If you have a dialog tree like :

    Question0
      -> answer 0  
        -> Question 1
          -> answer 2                    
            -> Question 3
              -> answer 6
                -> [END OF CONVERSATION]
              -> answer 7
                -> [END OF CONVERSATION]
          -> answer 3
              -> [END OF CONVERSATION]
      -> answer 1
        -> Question 2
          -> answer 4
              -> [END OF CONVERSATION]
          -> answer 5
              -> [END OF CONVERSATION]

    You will need to structure your data in a way that associate each question with its possible answer and each possible answer to the possible next question or end of converstation.

    One way to do it is to have two variable, one for question and one for answers

    Global text questions = ""
    Global text qnswers = ""
    +System: on start of layout
      -> System: set questions to "Question0|0|1
    Question2|2|3
    Question3|4|5
    Question4|6|7"
      -> System: set answers to "answer0|1
    answer1|2
    answer2|3
    answer3|end
    answer4|end
    answer5|end
    answer6|end
    answer7|end"

    And then use another global variable to know which question and then which answer to display (I will use the "all text object are instances with variable type to tell them apart" aforementionned option)

    You'll also need a 'nextQ' instance variable (type text) for the text object answer. We will store the next question information in it

    Global number Qi = 0          //index of the current question
    Global text curA=""           //list of current possible answer
    System:Qi > 0
      Text: type = "question"
        Local text Q = ""         //line which hold the question and its possible answer's index
        -> System: set Q to tokenat(questions,Qi,newline)
        -> Text: set text to tokenat(Q,0,"|")
        -> System: set curA to replace(Q,Text.text&"|","")
      System: for "" from 0 to tokenCount(curA,"|")-1
      Text: type = "answer"&loopindex+1
        Local number Ai = 0        //current answer index
        Local text A = ""          //line which hold the answer and its associated next question
        -> System: set Ai to int(tokenat(curA,loopindex,"|")
        -> System: set A to tokenat(answers,Ai,newline)
        -> Text: set text to tokenat(A,0,"|")
        -> Text: set nextQ = tokenat(A,1,"|")
    Mouse: On click on Text
    Text: nextQ not equal to ""
      -> set Qi to int(Text.nextQ)
      Text:nextQ equal "end"
        -> set Qi to -1

    Should work.

  • angle(0,0,Ball.Physics.VelocityX,Ball.Physics.VelocityY)

    gives you the angle of the movement

    dunno if there's an expression for that now

  • Weishaupt > Get the last version of the canvas plugin

  • I tried that once works well... breaks a bit with parallaxing

    splitScreen.capx

  • cacotigon

    Yep you're super right and I felt into that kind of issue. I solved it by using zerofill numbers.

    I think I used r0j0's way too once. Don't remember, I tend to reinvent the wheel sometimes :D

    with zerofill you don't fall into the substring issue

    "001,002,003,010,110,102,etc"

    if you replace(str,"001","") you won't have any issue

    and you can still int("003") into 3 with no problem.

    But yeah... use r0j0's way... it's the cleanest (:

  • Because of event order

    The last one on the list is : if Player isn't over Cave_bottom, then sent t_Overlay to invisible

    So event if you are over Cave_top the last event will be true then t_Overlay will be invisible

  • no need for trinary operator you can just to

    On P Pressed -> set timescale to 1-timescale

    'cause

    1- 1 = 0

    1- 0 = 1

  • randomSpawn.capx

    You should really read the manual and some tut... seriously

  • System: Every tick
      -> t_Overlay: set Invisible
    Player: Is overlaping Cave_top
      -> t_Overlay: set Visible
    Player: Is overlaping Cave_bottom
      -> t_Overlay: set Visible
  • for the dragon head put 2 animation frame in the block sprite.

    frame 0 for the basic body part

    frame 1 for the dragon head

    +System: every tick
      -> block: set animation frame to 0
    +block: counter = block.count
      -> set animatino frame to 1

    For the grid alignement just make sure you spawn the head on the grid each time.

  • Did you try the canvas plugin?

  • Just set the height of your Layout to 2100 (2000+height of your hud)

    And put a solid at the bottom and it should be ok.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In my snake rip off http://www.scirra.com/arcade/action/380/snake

    The snake doesn't move at all.

    Blocks are spawn where the head wants to go, and the tail block is deleted.

    Each block has a counter that decreases every "move". It starts at block.Count and when it reachs 0, it's the tail and it's destroyed.

    That's all.

  • you have to nest your event first under the same level as the local variable.

    click and drag the entire event underneath the parent event and slightly to the right.