I’m currently in the early prototype version of my game, and I hit a roadblock. I want to make it to where the character gets faster the longer they run, but I also want to put a cap on the speed so they don’t get too fast. Can someone help?
You should probably use a motor, and to make a speed cap, you should extract x/y velocity, filter if it is greater than your speed cap, and if it is, set the speed to the max speed.
Alright, I’ll try it
How exactly do I set the max speed?
Kinda like this:
Code:
{"data":{"behavior":{"v":"2","nodes":[{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":180,"y":-864,"group":"","id":"43a4b2904feebb40"},{"inputCount":1,"outputCount":1,"name":"Extractor","behaviorType":"logic.properties.Extractor","x":360,"y":-864,"group":"","id":"43a4d86ab6856144","targetId":0,"prop":"x velocity","version":2},{"inputCount":1,"outputCount":1,"name":"Extractor","behaviorType":"logic.properties.Extractor","x":360,"y":-768,"group":"","id":"43a50e2461cc0c48","targetId":0,"prop":"y velocity","version":2},{"gateVal":12,"mode":"greater than","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":540,"y":-768,"group":"","id":"43a5a87283265e4b"},{"gateVal":12,"mode":"greater than","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":540,"y":-992,"group":"","id":"43a5a91baed4c646"},{"gateVal":-12,"mode":"less than","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":540,"y":-896,"group":"","id":"43a61cbc2b79574f"},{"gateVal":-12,"mode":"less than","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":540,"y":-672,"group":"","id":"43a627d310b7264a"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":720,"y":-992,"group":"","id":"43a6e8b18c789742","startVal":12,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":720,"y":-768,"group":"","id":"43a6f50c91857c4c","startVal":12,"tag":"","roundMode":1},{"inputCount":3,"outputCount":3,"name":"Velocity","behaviorType":"logic.properties.Physics","x":900,"y":-832,"group":"","id":"43a71428d416b047"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":720,"y":-896,"group":"","id":"43a765cf52331349","startVal":-12,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":720,"y":-672,"group":"","id":"43a79010e743e749","startVal":-12,"tag":"","roundMode":1}],"links":[{"input_id":"43a4d86ab6856144i0","output_id":"43a4b2904feebb40o0"},{"input_id":"43a50e2461cc0c48i0","output_id":"43a4b2904feebb40o0"},{"input_id":"43a5a91baed4c646i1","output_id":"43a4d86ab6856144o0"},{"input_id":"43a61cbc2b79574fi1","output_id":"43a4d86ab6856144o0"},{"input_id":"43a5a87283265e4bi1","output_id":"43a50e2461cc0c48o0"},{"input_id":"43a627d310b7264ai1","output_id":"43a50e2461cc0c48o0"},{"input_id":"43a5a87283265e4bi1","output_id":"43a50e2461cc0c48o0"},{"input_id":"43a6f50c91857c4ci1","output_id":"43a5a87283265e4bo0"},{"input_id":"43a5a91baed4c646i1","output_id":"43a4d86ab6856144o0"},{"input_id":"43a6e8b18c789742i1","output_id":"43a5a91baed4c646o0"},{"input_id":"43a61cbc2b79574fi1","output_id":"43a4d86ab6856144o0"},{"input_id":"43a765cf52331349i1","output_id":"43a61cbc2b79574fo0"},{"input_id":"43a627d310b7264ai1","output_id":"43a50e2461cc0c48o0"},{"input_id":"43a79010e743e749i1","output_id":"43a627d310b7264ao0"},{"input_id":"43a6e8b18c789742i1","output_id":"43a5a91baed4c646o0"},{"input_id":"43a71428d416b047i0","output_id":"43a6e8b18c789742o0"},{"input_id":"43a6f50c91857c4ci1","output_id":"43a5a87283265e4bo0"},{"input_id":"43a71428d416b047i1","output_id":"43a6f50c91857c4co0"},{"input_id":"43a71428d416b047i0","output_id":"43a6e8b18c789742o0"},{"input_id":"43a71428d416b047i0","output_id":"43a765cf52331349o0"},{"input_id":"43a71428d416b047i1","output_id":"43a6f50c91857c4co0"},{"input_id":"43a71428d416b047i1","output_id":"43a79010e743e749o0"},{"input_id":"43a765cf52331349i1","output_id":"43a61cbc2b79574fo0"},{"input_id":"43a71428d416b047i0","output_id":"43a765cf52331349o0"},{"input_id":"43a79010e743e749i1","output_id":"43a627d310b7264ao0"},{"input_id":"43a71428d416b047i1","output_id":"43a79010e743e749o0"}]}}}
Oh, I should probably mention that I am making a 2D platformer, not 2.5D-roam. Sorry
That’s fine, you can get rid of the y velocity cap if you want to.
where does the motor go?
Instead of using velocity for your walk, just use motor
Alright, I’ll try it
I think I have a simple system might not work the best but i can send it here in a min. Basically more you run faster you get and then once you reach a speed you stop getting faster? Or shift to sprint like walking then holding shift you run fast?
Send me the game link
Ty i think there is simple way to do this I will send code in a min
I don’t think it worked out
Btws your code looks so complex like the jump idk why it has to be so complex it does the same thing.
Use a larger number, like 100 for the motor. Then it will work.
The jump was coded to gain height the longer the key is held. It’s necessary
Ok also what should the speed cap be? I almost done with the code