dop2000's Forum Posts

  • My other question here is do I need to create a text object for every separate line? And how do I make it so you can scroll through entries that go off the page?

    Here is a simplified explanation:

    1. Iterate the records in the array. Since they are stored on Y axis, you will need to use a system loop:

    System for "y" from 0 to Array.Height-1
    Array compare value at (2,loopindex)="delivered"
    

    2. For each chat message create a new Text object. Set its text to Array.at(1,loopindex)

    3. Resize the text object to its content - use Text.TextHeight expression

    4. Place each new text below the previous text.

    5. Attach all texts to a scrollable panel.

    6. Use a mask or blend modes to hide the top and bottom portions of the chat when scrolling.

    This will be difficult to make from scratch without any Construct knowledge. Here are some example projects which may be useful:

    howtoconstructdemos.com/scrolling-a-list-of-players-scores-images-etc-example-a-capx

    howtoconstructdemos.com/auto-resizing-speech-bubble-for-dialog-systems-capx

  • You need a second JSON object, say tempJSON.

    How you combine two jsons depends on their content.

    For example, your main json contains books and the second json contains colors. Then you can do this:

    -> tempJSON: Parse JSON string AJAX.LastData
    -> booksJSON: Set "colors" to new object
    -> booksJSON: Set "colors" to JSON tempJSON.GetAsCompactString("colors")
    

    The last action is "Set JSON".

    If both jsons are arrays, then you might need to iterate tempJSON and copy array elements one by one.

  • You have two player instances on the layout, this can cause all sorts of bugs.

    I suggest using the debugger (Shift+F4), it's absolutely essential in a complex game like this.

  • Btw did you make a tutorial where you explain the process of the code for the new template like you did for the original demo?

    I didn't make that video. It was recorded by Bart Alluyn.

    If you have any questions or issues with my template, you can email me directly.

  • You need to request the file with AJAX and load it into the array first. See events 2-3 in this example:

    https://editor.construct.net/#open=languages-from-json
    

    I suggest studying some lessons and tutorials. There are also plenty of built-in examples in Constuct editor.

  • I would probably use an array or JSON:

    {
     "chat_Jamie": [
     { "sender": "User", "message": "Hey, did you finish the show last night?", "status": "delivered" },
     { "sender": "Jamie", "message": "Yeah, I stayed up way too late for it. Totally worth it, though.", "status": "delivered" },
     { "sender": "User", "message": "Right? That twist at the end?! I didn’t see it coming.", "status": "delivered" },
     { "sender": "Jamie", "message": "Same! I had to pause just to process it. Like, WHAT?", "status": "delivered" },
     { "sender": "User", "message": "I was yelling at my screen. My neighbors probably think I’m nuts.", "status": "delivered" },
     { "sender": "Jamie", "message": "Honestly, they’re probably used to it by now.", "status": "delivered" },
     { "sender": "User", "message": "Wow, okay, rude.", "status": "delivered" },
     { "sender": "Jamie", "message": "😂 You set yourself up for that one.", "status": "" },
     { "sender": "User", "message": "Fair. So... binge the next season this weekend?", "status": "" },
     { "sender": "Jamie", "message": "Obviously. Snacks are on you, though.", "status": "" }
     ]
    }
    

    (Example generated by chatGPT)

    Multiple chats could be stored as sheets within one array, or as multiple array/JSON files.

    When the player enters a chat, immediately display all messages with "delivered" status. Then allow the player to send their next unsent message, wait a few seconds, display the response, mark both new messages as delivered in the array.

  • You can make the parts of snake body invisible. And move visible sprites to their position with lerp.

  • The "stretch" effect with Pin behavior is not intentional, it's basically a bug. Check out my comments in this post:

    construct.net/en/forum/construct-3/general-discussion-7/pinning-issues-147318

  • Use an instance variable ID on the sprite. Say, if there are 10 instances, set the values in this variable from 1 to 10.

    And add a global variable CurrentNumber=1

    When a sprite is clicked, check if its ID=CurrentNumber. Add 1 to CurrentNumber if true.

  • The way you do this in C2 is not much different from C3. Use LineOfSight, Pathfinding and Timer behaviors. On Timer event change the entity state. Use LineOfSight to check if the player is in sight. If not - pick a random item in range and find path to it.

    An example of logic:

    Initially the entity is in "idle" state.
    
    On "idle" timer: 
     -> Check if the player is in LOS. If true, find path to it, set state to "chase"
     -> Else : Pick a random item, find path to it, set state to "patrol"
    
    On Path found : move along path
    
    On Failed to find Path : set state to "idle" and start "idle" timer
    
    On Pathfinder arrive and state="patrol" : set state to "idle" and start "idle" timer
    
    If state="chase"
    Every 1 second : 
     -> Check if the player is in the attack range. If true, then stop and attack
     -> Else: check if the player is in chasing range. If true, find new path to the player
     -> Else: set state to "idle" and start "idle" timer
    
    If state="patrol"
    Every 1 second :
     -> Check if the item still exists. If not - set state to "idle" and start "idle" timer
    
    
  • Pigpud Wow, very impressive and the art is so nice!

    Why itch.io though? I think with the right publisher this can be a successful game!

  • Try renaming the audio files with these special characters (ä, ö, ü, ß). Say, h_o_ren instead of hören.

    Set word to replace(word, "ö", "_o_")
    Set word to replace(word, "ä", "_a_")
    ...
    AJAX request word & ".wav"
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Say, if 5 enemies were killed at once, the condition "enemy hitpoints<=0" will pick 5 enemy instances. But Enemy.rewardGold expression inside this event will only apply to the first instance among those 5.

    So yes, in this event you need to add "For each enemy". This will process all 5 enemies, one instance at a time, adding their rewardGold to the global variable.

    By the way, this event #40 will run on every tick, which is not good for game logic and performance. I suggest making a function EnemyDeath and calling it when damage is dealt to enemies.

  • My guess is that the same Z key press triggers all 3 events, so it starts and immediately finishes the dialogue.

    Try inserting "Wait 0 seconds" action before "Call dialogue".

  • The image inside the sprite/tilemap (in the animation editor) should not exceed 4096 pixels. You can stretch or copy the object on the layout, it won't matter. What's important is the texture size. On older mobile phones your game won't work if it's over 4096 px.