v83 Blink Counting Game: Spark AR Studio - Link to v85+ Example Project in Description


0   0

This video was created in v83. If you have updated to v85+ of Spark AR Studio, the scripting will be different. The project template download has been updated for v85+ asynchronous API changes. For an example of v85+ script to patch bridging, follow the GitHub link to Value to Text.

Blink Game Pack: Download 3 Instagram Blinking Mini Games: https://newcolor.studio/product/instagram-blinking-game-template/

GitHub v85+ Value to Text: https://github.com/newcolor-studio/Spark-AR-Studio/tree/master/ValueToText

Very cool things a very simple game. It's a 10 second timer and it's keeping track of your blanks. My eyes are very dry today from all this blanking.

And then the game finishes and you have some sort of result. So this is a pretty common kind of game structure where there's a timer. The way that I did the timer was by turning it on when the video recording begins using this camera, so if you plug the, If you take the the camera and drop it onto the patch editor.

You can check if their video recording so that'll start the timer. For these purposes for the tutorial purpose, I'm just using this screen tap kind of debugger to to show how it works. So otherwise you have to go to the app and press record when you test send the send it to the test device.

So as soon as it starts, it says turn on send it to a loop animation who's duration is one second. So every second it'll go boom boom boom and decrease the value here, which we're setting in where we're here to ten right there. So, After ten seconds. Using this delay patch it's got to turn off and then you get the turn off signal.

So the loop animation stops it stops firing the countdown stops. And you're left with your final value of zero. So I use that same signal to stop the blank counter. Because if you notice the blink contour is still firing. It's light enough, but the condition is not true. This is turned off right now because the delay finished the delay fired and turned off.

The switch here. So, that's how I manage the timer. If you notice over here, these values are showing up on the screen. So the way to do that is by creating a script. Had asset scripts and then click on the script. And you'll see from script and two script two script you'll press plus number you'll name it you know could be blink count timer count and then plop it on the editor.

In any value that that gets sent here will be sent or available in the script through the patches script module, which you import at the top of the script right here. So there's not much code in here, you'll see that it's just a few lines declaring these variables and saying okay.

I have a. Text object, here's the name of the text object, here's the name of the two script object. I'm gonna take that value convert it to a string and then set that string as the. As the text for this text object. And you'll even see over here it's as set in a script which is very nice little helpful tools say, hey you did that.

So that's kind of funny, you know interacting with scripts that way I couldn't find anything that converted a value to a string here so that's why I use the script pretty cool because then you know, now you're you're you're dynamic value is changing, you know based on a value from the patch editor.

So let's see if there's anything else interesting here.

It's face finder blank cool. This sort of tracks with the head and that's how I did that.

I also increase the scale so that as you blank it increases in size to sort of build tension.

And anything else keeps this video under five minutes.

I think that's all this is just checking to see if the game's done and then you get the text that shows up so it's visible. And some cool animations. Yeah, all right. So if you have any questions, let me know. I hope this gets you started or updated some problems.

Like I said for the video recording I use that pool in the actual effect, so when they press video record it turns on. Just like that. Set your time or delay there. Yeah.

All right nope, that's helpful.


Blink Game Pack: 3 Blinking Mini Game Instagram Filters: https://newcolor.studio/product/instagram-blinking-game-template/

More about script to patch bridging: https://sparkar.facebook.com/ar-studio/learn/documentation/docs/visual-programming/javascript-to-patch-bridging/

v85+ Value to Text on GitHub: https://github.com/newcolor-studio/Spark-AR-Studio/tree/master/ValueToText
View More