(this is a continuation of my last thread jsyk)
How to make it so after two variables match, their values are randomized within a range of 1-10,
and also they add +X to prestige points? pls answer
Checking if two variables match:
if (a === b) {
}
If they are decimals, you can do a.eq(b)
instead
Getting a random value from 1-10:
Math.ceil(Math.random() * 10)
Adding x prestige points:
addPoints("p", X)
thats epic but where do i place that? in an update diff in the bar section idk lol
(sorry if it sounded a bit rude i do not mean to offend by any means)
Probably in the layer’s update method? That’ll run once per tick
also sorry to bother once again but the bar stays full without moving, is there any way to fix this?
bars: {
bigBar: {
direction: RIGHT,
width: 600,
height: 50,
progress() {
return player.p.currently.div(player.p.goal).clamp(0, 1);
}
},
},
If I’m doing something wrong and it’s very obvious please let me know
player.p.currently is probably greater than player.p.goal. I hadn’t realized that bit of what you were asking for in my original response, hence the follow-up with updated code. I’d suggest using that instead.
BTW, you can select a post as an accepted solution, and it’ll appear directly underneath the original post, making it easier for people with the same problem as you to find the answer.