dop2000's Forum Posts

  • bbjGames

    "For Each" loop is working and it does process each of the Brain instances.

    The problem is with the sub-events. I believe you need to reset the variables to their initial values (x=4, y=0, z=-1) in event #36.

    Alternatively, you can move variables declaration inside the "For each" loop, then they will be reset automatically.

    You might also want to reset them in between "Repeat 30 times" and "Repeat 16 times" loops.

    The "mutate" variable always equals 5, so all events with condition "mutate<=2" will never work.

    There may be other mistakes in those loops, I really don't understand what are you doing there.

  • I'm not sure what's going on in your code, but the For each loop is working and it does change each of the 5 Brain arrays.

    You can check it yourself - run the game in Debug mode, select one of the arrays and see the values changing every 5 seconds.

    You can also add Browser->Log to this loop to output debug messages.

    For example: Browser Log Brain.UID, you'll see that all 5 Brain UIDs are processed.

  • GabrielIq

    You need to save the skin in a global variable (or a dictionary). On start of another layout, set animation frame to skin variable.

  • Yes.

    And also, I suggest you replace "Pause timer" with "Remove timer" in event #8 too.

    Then you will be able to check if the timer is running by comparing Timer1.ElapsedTime("UpgradeTimer")

    If ElapsedTime=0, the timer is not running, if it's >0, then it's running.

    You could remove the OnUpgrade variable and all those events where you save/load it to local storage.

  • I know one scenario where Pin behavior can cause lagging:

    Create 3 sprites A, B, C.

    Add Bullet or Drag and Drop behavior to A.

    Pin B to A.

    On every tick set C sprite position to (B.x, B.y)

    You'll see that A and B move together, but C is lagging behind. I'm guessing that's because Pin behavior updates coordinates of pinned objects at the end of the frame, after all other behaviors and events.

    So maybe you have something similar in your game. The solution would be not to use (x, y) coordinates of pinned objects in any events or calculations.

    [quote:15t8snbl]Just as a query what is the standard procedure for pinning an object, create then pin, right?? it doesn't need an every tick function or anything, I am assuming??

    Correct. Create and pin, no need to "re-pin" on every tick.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sure, but you'll need to figure out the ratio of movement speed to animation speed.

    Say, if normal movement speed is 50px/sec and normal animation speed is 10 frames/sec, then you can do this:

    Sprite Set Animation Speed to (MovementSpeed/5)

    When movement speed increases to 100px/sec, animation speed will also increase to 20 frames/sec.

    Or if you want a much bigger increase in animation speed, you can modify the formula to something like this:

    Sprite Set Animation Speed to (10+(MovementSpeed-50)/2)

  • Could you share a capx demonstrating the problem?

  • On start of layout all sprites used on this layout with all their animation frames are loaded into the memory.

    So having a separate object for each layout is better for performance.

  • Does the number of coins decreases?

    Please share your capx, it's hard to guess what could be causing the problem without it.

  • Interinactive, I replied you in PM

  • You should change viewport size to 500x500 in project properties, not the layout size.

    Or you can enable Unbounded scrolling for the layout, but then you can get empty white space if your character moves too close to edges.

  • jhempstead1234

    see the second comment in this post.

    Use "System->Compare two values"

    first value: Find(text1, text2)

    comparison: Not equal to

    second value: -1

  • In event #5 before "Get or Start timer" action add "Remove timer" action.

    Also, Timer1.ElapsedTime expression requires timer name as parameter.

    For example:

    Timer1.ElapsedTime("UpgradeTimer2")