[r252] Cannot spawn and set 2 Text objects at the same event

  • Problem Description

    By doing 2 Text object creations and assignments on the same "For Each" event, the event was causing some Text objects to not showing the correct texts.

    Attach a Capx

    https://drive.google.com/file/d/1fmISUp ... sp=sharing

    Description of Capx

    My puzzle RPG prototype

    Steps to Reproduce Bug

    Preview the project. Try to test after toggling the disability of the second sub-event inside the For Each "Unit" event.

    Observed Result

    Only two texts that were modified while some were unchanged.

    Expected Result

    All texts supposed to have their texts the same texts as their assigned variables.

    Affected Browsers

    • Chrome: (YES)

    Operating System and Service Pack

    Windows 10 Fall Creators Update

    Construct 2 Version ID

    Construct 2 r252

  • This is not a bug.

    You need to wait 1 tick before picking newly created objects.

    Also, you need to put "StatText ID=Unit.UID" inside the "For each Unit" loop.

  • Like this?

    Now only one text that were modified.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No, like this:

    It would actually make more sense to move this code to a separate event or function, and call it when some Unit parameters are changed.

  • You can set the text at its creation. As well as do variable comparisons, just not the variables of the object you just spawned... and set.

    I would just put two text objects in a container however.

    Also, might want to consider of the difference between spawn and create. Angles will get you eventually.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)