Usermedia, loading snapshots into multiple sprites

0 favourites
  • 4 posts
From the Asset Store
Progress\Loading Bar. Now Load you game like a Professional.
  • Based on the Webcam example in C2 I have a UserMedia object set up and when I press spacebar it snaps a picture from the webcam feed and loads into my sprite with Load image from URL(UserMedia.SnapshotURL). I want to add 3 more sprites where each time I press spacebar it loads the image from the webcam into the different sprites, say I have SnapshotSprite1,2,3 and 4, I press space then it takes a snapshot and puts it in 1, then I press space again it puts the current snapshot in 2, and so forth. I have tried adding additional sprite objects, but I cant figure out how to target the different sprites with the current snapshot, it just loads the same snapshot in each sprite when I press spacebar. Any help would be appreciated, thanks.

  • I'm having the same issue, so would really appreciate knowing the answer to this?

    I've looked at the data URL and they are different with each snap, but each sprite instance just picks up the last snapshot (when using load image URL action on the sprite).

  • are you sure you are picking a different sprite when you use the load action?

    system: pick nth instance, (choose objecttype) and set instance number (could be var snapshotcount)

    so if the snapshot objects already exist

    onclick,

    pick

    loadurl

    add 1 to snapshotcount

    other than that, its probably possible to use one instance, and first set frame and then load url

    ps: you probably need to wait for loadurl is ready, but its thesame

    onclick take snapshot

    onready pick sprite, load url, add 1 to snapshotcount

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think the issue is that each sprite instance refers to an image (animation frame 0) that is replaced by the snapshot.

    The only way I have managed to fix this is to preset the number of frames (snapshots) in to the default animation for the sprite and load each snapshot in to successive animation frames (as the snapshot is taken). This is OK, but I get the same problem once my animation frame index goes beyond the size (frames) of the default animation.

    Is there a way of creating sprites with a new image (frame 0) to avoid this?

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