Arrow keys YEEEESSSSS finally got one working without glitching horribly every time! Features: Movement Ground/Wall/Ceiling detection Jumping Wall Jumping Incomplete slope detection(can go down slopes but not up) Next up on my list: either add slope detection or make a full-out tutorial for this. What do you guys think? Probably the tutorial... I will turn this into a game maybe...
Myself... I just slapped this together in 15 minutes(+another 10 or so of bug fixing and compacting) Fairly compact: only 50-something blocks in main script(includes operators/var calling/boolean stuff) How it works: Because the values of the if key pressed blocks are numbers, we can use operators. Because of this, we can compress the change x velocity script when left/right keys pressed into a change Xv by (right key pressed-left key pressed) Then comes the friction multiplier of .9 Then instead of changing x by Xv now, we check that there is no wall there by changing the y value by 1 and checking if touching the ground. If not, then it changes the x value by Xv, otherwise it sets Xv to -1*Xv and changes x by that new value. Now we come to the gravity part. Yv gets changed by -.7 for gravity, then we change the y by Yv. Then, after that, we check if the character is touching the ground, and if so, we check if YV is greater than 0. If so, we set Yv to -1*Yv, and change the y position by -1 until it isn't touching the ground. Otherwise, we set Yv to -1*Yv, change y by the new value, and change the y value by -1 until the character is touching the ground. Then, we set Yv to 0 to not have the character go down in the ground again. The jump script basically says if touching ground at this point change Yv by the jump velocity. Now we come to the clever part- if we put this in a forever block it wouldn't give enough speed for it to function without stopping every time the player hits the ground after a jump. If we put a ignore refresh block with this in the forever loop, we would lag out. Thus, we come to the happy medium of a forever broadcast block, which gives enough times running through it per second for it to be smooth but not lag.