Dear Creators. First of all, I’m a beginner and I do really enjoy all the tutorials. But in the effort to start on the scripting, I always struggle. I’m currently following Maru Studios tutorial on 2D Game .
Based on the tutorial, I’ve made one change that is to link the score count into my face tracker (world space) instead of leaving it in the camera space.
However when I implement the script, though on VS it didn’t show any error, in the console however it shows this:
What does this mean? and how can I overcome this? I’ve tried following many scripting tutorials on YT but failed miserably. I appreciate any help that I can follow as I love how scripting works.
This is my current Scene:
This is the Counter value that I needed to be shown in the game. As you can see, the Value successfully shown in the patch when everytime my character jumps over a collider. But I couldn’t translate this into the script:
This is the script that I used:
const Scene = require('Scene');
export const Diagnostics = require('Diagnostics');
const Patches = require("Patches");
Promise.all([
Scene.root.findFirst('number'),
]).then(onReady);
function onReady(assets) {
var counterNumber = assets[0];
var scoreNumber = Patches.outputs.getScalar("score");
scoreNumber.then(e=>{
e.monitor().subscribe(value=>{
counterNumber.text=value.newValue.toString();
});
});
}