How do I use "Wait for actions to complete" in a loop without breaking it?

0 favourites
  • 3 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies. For use in game and custom works.
  • Hi! I loaded the 3D Sliding Puzzle example and tried to add one sprite with a big image that is pasted on small drawing canvas objects that are then saved and loaded onto the Collider objects. I added it to the "For each PuzzlePiece" loop. But without a wait the images are not pasted/saved on the drawing canvas and if I add one or more wait actions its completely broken. Pieces move very strange and not to the empty space and no image is shown on the face of the 3d pieces.

    I tried to add the collider UID to the drawing canvas objects to use the "on saved" trigger to load the image, but this didnt work either. It seems pasting the image does not work without a pause after it.

    Any idea how to fix this? Why is the game broken when I use any wait action in the loop? (code below)

    + System: For each PuzzlePiece

    -> System: Create object Collider on layer PuzzlePiece.LayerName at (PuzzlePiece.X, PuzzlePiece.Y), create hierarchy: False

    -> Collider: Set Z elevation to PuzzlePiece.ZElevation + PuzzlePiece.ZHeight

    -> System: Create object DrawingCanvas on layer "Canvas" at (PuzzlePiece.X, PuzzlePiece.Y), create hierarchy: False

    -> DrawingCanvas: Set ColliderID to Collider.UID

    -> DrawingCanvas: Set Index to PuzzlePiece.Index

    -> DrawingCanvas: Set size to (Collider.Width, Collider.Height)

    -> [DISABLED] DrawingCanvas: Move to top of layer

    // Each collider also acts like the surface texture of it parent puzzle piece.

    -> DrawingCanvas: Paste object OriginalImage with effects

    -> System: Wait for previous actions to complete

    -> DrawingCanvas: Save image (PNG, quality 75, offset 0, 0 size 0 x 0)

    -> System: Wait for previous actions to complete

    -> Collider: Load image from DrawingCanvas.SavedImageURL (Keep current size, cross-origin anonymous)

    -> System: Wait for previous actions to complete

    -> [DISABLED] Collider: Set animation frame to PuzzlePiece.Index

    -> PuzzlePiece: Set Front face to use image of Collider

    -> Collider: Set visibility Invisible

    -> DrawingCanvas: Set visibility Invisible

    -> PuzzlePiece: Add child Collider (X: True, Y: True, width: False, height: False, angle: True, Z elevation: True, destroy with parent: True)

    // Store the initial position of each puzzle piece, so the game knows where they must be placed.

    -> PuzzlePiece: Set InitialX to round(Self.X)

    -> PuzzlePiece: Set InitialY to round(Self.Y)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Any suggestions how to solve this? It's not possible to use drawing canvas save and sprite load from url in a loop?

  • It's impossible to read that code you posted. Can you share your project file or a screenshot of events?

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