Hi, I am working on a new jump Script that uses a variable and not a getlocalposition() but I am having trouble adding to that variable in the code. I have it where it adds one to my var jumps. But where I am having the most trouble is when I have if space is pressed then if jumps = 3 then nothing until a collision. But if it is LESS than 3 then it will play an impulse. I don’t know why it won’t let me let jumps(jumps Is my variable). I was looking at an article about it and it says let should work for javascript. I put it in my code then it says let is not defined if you can answer any of these questions that would be greatly appreciated. The first jump script I made is found here - This is the script I already have-
var Movement = pc.createScript('movement');
var jumps = 0;
// initialize code called once per entity
Movement.prototype.initialize = function() {
};
// update code called every frame
Movement.prototype.update = function(dt) {
if (this.app.keyboard.wasPressed(pc.KEY_SPACE)) {
if(jumps = >3){
//if (this.entity.getLocalPosition(this.ystart * dt ).y < this.ylimit * dt) what i used last time
this.entity.rigidbody.applyImpulse(0, 100, 0)
}
if(jumps = 3){
//idk what to do here for a "wait for collioson"
}
}
};