what was the number u had plugged in?
i used the variable speed for 10
Try redefining speed in the code that has the error. Just add this one seperate line:
var speed=10;
ok i already have that stated once would it effect the rest of the code if define it again?
if u have it defined in the objects script once, then it wouldnāt work to redefine it. But if u defined speed in another object, do it again in the one with the error
ok so i redefined it in that object but now the ball still falls through the barrier but slower.
change the var of speed in that object, the higher the slower the ball goes through the object. If your using gravity, make sure the gravity is set to 0.
Also, this should be able to make the ball on top of the platform without needing to calculate speed. Here it is:
PLAYER.y=this.y-((this.height/2)+(PLAYER.height/2)-(NUMBER));
Change the word, PLAYER, with the name of your player, which is BALL, and the word, NUMBER, with how deep you want the player to be in the platform (use positive numbers, I recommend 1 or 3). Make sure this happens when it touches the player and the jump key is not pressed. Then, no matter the size of your object, it should be perfect.
EDIT:
Hereās an example, it might help (I figured I type a lot of long responses that look confusing)
My Project10-1-2020_6-43-56PM.wick (2.9 KB)