Increasing the ball speed for my pong game

Ok, so I’ve got my basic pong game working (Flowlab Game Creator - Pong), but I want to spice it up a bit (because it is very boring in its current state). So I’m mostly basing mine on Grazer’s pong example (Flowlab Game Creator - Pong), and I want to incorporate his feature where the ball increases its speed as the game goes on, but the way he did it causes this HUGE bug that makes the ball switch directions and go up and to the left every time it increases its speed, which basically ruins the game for whoever is player one. I can’t figure out another way to accomplish this though, so I was hoping maybe you guys could help?

BTW, in my game, there are actually two balls, but the bottom-most ball is simply a backup of the one that works well that immediately deletes itself upon the start of the game, just in case I mess something up terribly and want to start over

2 Likes

I solved the problem with some expression behaviors, that way they won’t output when you increase the speed. Hopefully, this works, tell me if you find any bugs!

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":0,"outputCount":0,"name":"Bounce/Speed Physics","behaviorType":"logic.NodeGroup","x":-900,"y":-352,"group":"7661c7cfae4fbd40","id":"8c3cbb3f1aa4f04b","isMenuItem":false},{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":-540,"y":-256,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb455956ce43"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":-832,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb46aadebd4e","startVal":6,"tag":"","roundMode":1},{"inputCount":1,"outputCount":1,"name":"Extractor","behaviorType":"logic.properties.Extractor","x":0,"y":-448,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb46517ef24f","targetId":0,"prop":"x velocity"},{"inputCount":1,"outputCount":1,"name":"Extractor","behaviorType":"logic.properties.Extractor","x":0,"y":-352,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb467ed43a43","targetId":0,"prop":"y velocity"},{"gateVal":0,"mode":"greater than","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter","x":180,"y":-352,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb462486974a"},{"gateVal":0,"mode":"greater than","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter","x":180,"y":-448,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb46881f734c"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":-736,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb47ae399a4d","startVal":-6,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":-544,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb475c3b7e45","startVal":-6,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":-640,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb478a86c344","startVal":6,"tag":"","roundMode":1},{"inputCount":1,"outputCount":0,"name":"Bundle Output","behaviorType":"logic.NodeGroupOutput","x":810,"y":-256,"group":"8c3cbb4a78cd9041","id":"8c3cbb479a727c41","portId":"8c3cbb4a78cd9041o0","tag":"output","dataType":2},{"inputCount":3,"outputCount":1,"name":"Random","behaviorType":"logic.logic.Random","x":-270,"y":-288,"group":"8c3cbb4a78cd9041","id":"8c3cbb47d7ac9846","min":0,"max":1},{"gateVal":0,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter","x":-90,"y":-320,"group":"8c3cbb4a78cd9041","id":"8c3cbb4836d8164e"},{"gateVal":0,"mode":"greater than","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter","x":-90,"y":-128,"group":"8c3cbb4a78cd9041","id":"8c3cbb48bf8d3d4a"},{"inputCount":3,"outputCount":1,"name":"Random","behaviorType":"logic.logic.Random","x":-270,"y":-160,"group":"8c3cbb4a78cd9041","id":"8c3cbb48c31f8942","min":0,"max":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":90,"y":-64,"group":"8c3cbb4a78cd9041","id":"8c3cbb4815315c40","startVal":-1,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":90,"y":-160,"group":"8c3cbb4a78cd9041","id":"8c3cbb48ea450447","startVal":1,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":90,"y":-256,"group":"8c3cbb4a78cd9041","id":"8c3cbb483e707d41","startVal":-1,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":90,"y":-352,"group":"8c3cbb4a78cd9041","id":"8c3cbb48d8b87b4d","startVal":1,"tag":"","roundMode":1},{"inputCount":3,"outputCount":3,"name":"Velocity","behaviorType":"logic.properties.Physics","x":270,"y":-64,"group":"8c3cbb4a78cd9041","id":"8c3cbb48ab3ecb4e"},{"inputCount":3,"outputCount":3,"name":"Velocity","behaviorType":"logic.properties.Physics","x":270,"y":-160,"group":"8c3cbb4a78cd9041","id":"8c3cbb4812b22544"},{"inputCount":3,"outputCount":3,"name":"Velocity","behaviorType":"logic.properties.Physics","x":270,"y":-288,"group":"8c3cbb4a78cd9041","id":"8c3cbb485d186e4a"},{"inputCount":3,"outputCount":3,"name":"Velocity","behaviorType":"logic.properties.Physics","x":270,"y":-384,"group":"8c3cbb4a78cd9041","id":"8c3cbb484a78f54f"},{"inputCount":2,"outputCount":1,"name":"Logic Gate","behaviorType":"logic.logic.Gate","x":450,"y":-96,"group":"8c3cbb4a78cd9041","id":"8c3cbb49b4450d48","gateType":"OR"},{"inputCount":2,"outputCount":1,"name":"Logic Gate","behaviorType":"logic.logic.Gate","x":450,"y":-352,"group":"8c3cbb4a78cd9041","id":"8c3cbb4916d70c4e","gateType":"OR"},{"inputCount":2,"outputCount":1,"name":"Logic Gate","behaviorType":"logic.logic.Gate","x":630,"y":-224,"group":"8c3cbb4a78cd9041","id":"8c3cbb49afef3040","gateType":"AND"},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":-450,"y":-192,"group":"8c3cbb4a78cd9041","id":"8c3cbb497b713a46","portId":"8c3cbb4a78cd9041i0","tag":"input","dataType":2},{"inputCount":1,"outputCount":1,"name":"Randomizer","behaviorType":"logic.NodeGroup","x":-540,"y":-352,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb4a78cd9041","isMenuItem":false},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":-180,"y":-448,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb4ecc35ef4b","_startVal":0,"dataType":2},{"inputCount":3,"outputCount":3,"name":"Velocity","behaviorType":"logic.properties.Physics","x":720,"y":-672,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb4e3d62f84e"},{"inputCount":0,"outputCount":1,"name":"Once","behaviorType":"logic.triggers.Once","x":-540,"y":-160,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb4e78a23844","resetOnLevelStart":false},{"inputCount":1,"outputCount":1,"name":"Extractor","behaviorType":"logic.properties.Extractor","x":-360,"y":-352,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb4e21a22a4e","targetId":0,"prop":"x velocity"},{"inputCount":1,"outputCount":1,"name":"Extractor","behaviorType":"logic.properties.Extractor","x":-360,"y":-256,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb4eb6ff5e44","targetId":0,"prop":"y velocity"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-180,"y":-352,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb4fa88e344d","startVal":0,"roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-180,"y":-256,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb4ff08dbb49","startVal":0,"roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-180,"y":-544,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb4f78549045","startVal":-1,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-180,"y":-640,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb4f9ced944b","startVal":1,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-180,"y":-736,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb4fdd5b5e40","startVal":-1,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-180,"y":-832,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb4fa1a50844","startVal":1,"tag":"","roundMode":1},{"inputCount":0,"outputCount":1,"name":"Once","behaviorType":"logic.triggers.Once","x":-900,"y":-352,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb4fe48f9543","resetOnLevelStart":false},{"delay":20,"count":1,"version":2,"inputCount":3,"outputCount":1,"name":"Timer","behaviorType":"logic.triggers.Timer","x":-720,"y":-352,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb4ff19d124f"},{"inputCount":3,"outputCount":1,"name":"Global","behaviorType":"logic.logic.Global","x":-720,"y":-448,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb50daf2194c","tag":"Set Pos:Number","version":2,"dataType":2},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-540,"y":-448,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb50166dcf43","startVal":0,"roundMode":1},{"inputCount":3,"outputCount":3,"name":"Velocity","behaviorType":"logic.properties.Physics","x":-360,"y":-448,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb507bb66b4c"},{"delay":100,"count":0,"version":2,"inputCount":3,"outputCount":1,"name":"Timer","behaviorType":"logic.triggers.Timer","x":-360,"y":-736,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb50dacf1644"},{"inputCount":0,"outputCount":1,"name":"Once","behaviorType":"logic.triggers.Once","x":-540,"y":-736,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb509e0da543","resetOnLevelStart":false},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-540,"y":-640,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb508d410648","startVal":6,"tag":"","roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":-540,"y":-544,"group":"8c3cbb3f1aa4f04b","id":"8c3cbb504679cc4a","startVal":-6,"tag":"","roundMode":1},{"expression":"a+b","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":2,"version":2,"tag":"","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":360,"y":-544,"group":"8c3cbb3f1aa4f04b","id":"8c3cebf69fffa740"},{"expression":"a+b","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":2,"version":2,"tag":"","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":360,"y":-832,"group":"8c3cbb3f1aa4f04b","id":"8c3cec9aba1a6b4c"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":0,"y":-544,"group":"8c3cbb3f1aa4f04b","id":"8c3df65722b17f40","startVal":0,"roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":0,"y":-640,"group":"8c3cbb3f1aa4f04b","id":"8c3df74f3ba8e34f","startVal":0,"roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":0,"y":-736,"group":"8c3cbb3f1aa4f04b","id":"8c3df815f657ee4f","startVal":0,"roundMode":1},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":0,"y":-832,"group":"8c3cbb3f1aa4f04b","id":"8c3df8b90c20a84b","startVal":0,"roundMode":1},{"expression":"a+b","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":2,"version":2,"tag":"","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":360,"y":-736,"group":"8c3cbb3f1aa4f04b","id":"8c3e541dbe551340"},{"expression":"a+b","default0":0,"default1":0,"default2":0,"default3":0,"default4":0,"default5":0,"params":2,"version":2,"tag":"","inputCount":3,"outputCount":1,"name":"Expression","behaviorType":"logic.logic.Expression","x":360,"y":-640,"group":"8c3cbb3f1aa4f04b","id":"8c3e857e7f8b514f"},{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":-180,"y":-928,"group":"8c3cbb3f1aa4f04b","id":"8c401e4849def046"}],"links":[{"input_id":"8c3cbb4ecc35ef4bi2","output_id":"8c3cbb455956ce43o0"},{"input_id":"8c3cbb4e21a22a4ei0","output_id":"8c3cbb455956ce43o0"},{"input_id":"8c3cbb4eb6ff5e44i0","output_id":"8c3cbb455956ce43o0"},{"input_id":"8c3cec9aba1a6b4ci0","output_id":"8c3cbb46aadebd4eo0"},{"input_id":"8c3cbb46881f734ci0","output_id":"8c3cbb46517ef24fo0"},{"input_id":"8c3cbb462486974ai0","output_id":"8c3cbb467ed43a43o0"},{"input_id":"8c3e857e7f8b514fi2","output_id":"8c3cbb462486974ao0"},{"input_id":"8c3cebf69fffa740i2","output_id":"8c3cbb462486974ao1"},{"input_id":"8c3cec9aba1a6b4ci2","output_id":"8c3cbb46881f734co0"},{"input_id":"8c3e541dbe551340i2","output_id":"8c3cbb46881f734co1"},{"input_id":"8c3e541dbe551340i0","output_id":"8c3cbb47ae399a4do0"},{"input_id":"8c3cebf69fffa740i0","output_id":"8c3cbb475c3b7e45o0"},{"input_id":"8c3e857e7f8b514fi0","output_id":"8c3cbb478a86c344o0"},{"input_id":"8c3cbb4836d8164ei0","output_id":"8c3cbb47d7ac9846o0"},{"input_id":"8c3cbb48d8b87b4di1","output_id":"8c3cbb4836d8164eo0"},{"input_id":"8c3cbb483e707d41i1","output_id":"8c3cbb4836d8164eo1"},{"input_id":"8c3cbb48ea450447i1","output_id":"8c3cbb48bf8d3d4ao0"},{"input_id":"8c3cbb4815315c40i1","output_id":"8c3cbb48bf8d3d4ao1"},{"input_id":"8c3cbb48bf8d3d4ai0","output_id":"8c3cbb48c31f8942o0"},{"input_id":"8c3cbb48ab3ecb4ei1","output_id":"8c3cbb4815315c40o0"},{"input_id":"8c3cbb4812b22544i1","output_id":"8c3cbb48ea450447o0"},{"input_id":"8c3cbb485d186e4ai0","output_id":"8c3cbb483e707d41o0"},{"input_id":"8c3cbb484a78f54fi0","output_id":"8c3cbb48d8b87b4do0"},{"input_id":"8c3cbb49b4450d48i1","output_id":"8c3cbb48ab3ecb4eo1"},{"input_id":"8c3cbb49b4450d48i0","output_id":"8c3cbb4812b22544o1"},{"input_id":"8c3cbb4916d70c4ei1","output_id":"8c3cbb485d186e4ao0"},{"input_id":"8c3cbb4916d70c4ei0","output_id":"8c3cbb484a78f54fo0"},{"input_id":"8c3cbb49afef3040i1","output_id":"8c3cbb49b4450d48o0"},{"input_id":"8c3cbb49afef3040i0","output_id":"8c3cbb4916d70c4eo0"},{"input_id":"8c3cbb479a727c41i0","output_id":"8c3cbb49afef3040o0"},{"input_id":"8c3cbb47d7ac9846i0","output_id":"8c3cbb497b713a46o0"},{"input_id":"8c3cbb48c31f8942i0","output_id":"8c3cbb497b713a46o0"},{"input_id":"8c3cbb4ecc35ef4bi1","output_id":"8c3cbb4a78cd9041o0"},{"input_id":"8c3cbb46517ef24fi0","output_id":"8c3cbb4ecc35ef4bo0"},{"input_id":"8c3cbb467ed43a43i0","output_id":"8c3cbb4ecc35ef4bo0"},{"input_id":"8c3cbb4ecc35ef4bi2","output_id":"8c3cbb4e78a23844o0"},{"input_id":"8c3cbb4fa88e344di0","output_id":"8c3cbb4e21a22a4eo0"},{"input_id":"8c3cbb4ff08dbb49i0","output_id":"8c3cbb4eb6ff5e44o0"},{"input_id":"8c3df65722b17f40i2","output_id":"8c3cbb4f78549045o0"},{"input_id":"8c3df74f3ba8e34fi2","output_id":"8c3cbb4f9ced944bo0"},{"input_id":"8c3df815f657ee4fi2","output_id":"8c3cbb4fdd5b5e40o0"},{"input_id":"8c3df8b90c20a84bi2","output_id":"8c3cbb4fa1a50844o0"},{"input_id":"8c3cbb4ff19d124fi0","output_id":"8c3cbb4fe48f9543o0"},{"input_id":"8c3cbb4a78cd9041i0","output_id":"8c3cbb4ff19d124fo0"},{"input_id":"8c3cbb508d410648i1","output_id":"8c3cbb50daf2194co0"},{"input_id":"8c3cbb504679cc4ai1","output_id":"8c3cbb50daf2194co0"},{"input_id":"8c3cbb4ecc35ef4bi0","output_id":"8c3cbb50daf2194co0"},{"input_id":"8c3cbb50166dcf43i1","output_id":"8c3cbb50daf2194co0"},{"input_id":"8c3cbb4ff19d124fi0","output_id":"8c3cbb50daf2194co0"},{"input_id":"8c3cbb507bb66b4ci0","output_id":"8c3cbb50166dcf43o0"},{"input_id":"8c3cbb507bb66b4ci1","output_id":"8c3cbb50166dcf43o0"},{"input_id":"8c3cbb4fa1a50844i1","output_id":"8c3cbb50dacf1644o0"},{"input_id":"8c3cbb50dacf1644i0","output_id":"8c3cbb50dacf1644o0"},{"input_id":"8c3cbb4fdd5b5e40i1","output_id":"8c3cbb50dacf1644o0"},{"input_id":"8c3cbb4f9ced944bi1","output_id":"8c3cbb50dacf1644o0"},{"input_id":"8c3cbb4f78549045i1","output_id":"8c3cbb50dacf1644o0"},{"input_id":"8c3cbb50dacf1644i0","output_id":"8c3cbb509e0da543o0"},{"input_id":"8c3cbb46aadebd4ei0","output_id":"8c3cbb508d410648o0"},{"input_id":"8c3cbb478a86c344i0","output_id":"8c3cbb508d410648o0"},{"input_id":"8c3cbb47ae399a4di0","output_id":"8c3cbb504679cc4ao0"},{"input_id":"8c3cbb475c3b7e45i0","output_id":"8c3cbb504679cc4ao0"},{"input_id":"8c3cbb4e3d62f84ei1","output_id":"8c3cebf69fffa740o0"},{"input_id":"8c3cbb4e3d62f84ei0","output_id":"8c3cec9aba1a6b4co0"},{"input_id":"8c3cebf69fffa740i1","output_id":"8c3df65722b17f40o0"},{"input_id":"8c3e857e7f8b514fi1","output_id":"8c3df74f3ba8e34fo0"},{"input_id":"8c3e541dbe551340i1","output_id":"8c3df815f657ee4fo0"},{"input_id":"8c3cec9aba1a6b4ci1","output_id":"8c3df8b90c20a84bo0"},{"input_id":"8c3cbb4e3d62f84ei0","output_id":"8c3e541dbe551340o0"},{"input_id":"8c3cbb4e3d62f84ei1","output_id":"8c3e857e7f8b514fo0"},{"input_id":"8c3df8b90c20a84bi1","output_id":"8c401e4849def046o0"},{"input_id":"8c3cbb46aadebd4ei1","output_id":"8c401e4849def046o0"},{"input_id":"8c3df815f657ee4fi1","output_id":"8c401e4849def046o0"},{"input_id":"8c3cbb47ae399a4di1","output_id":"8c401e4849def046o0"},{"input_id":"8c3df74f3ba8e34fi1","output_id":"8c401e4849def046o0"},{"input_id":"8c3cbb478a86c344i1","output_id":"8c401e4849def046o0"},{"input_id":"8c3df65722b17f40i1","output_id":"8c401e4849def046o0"},{"input_id":"8c3cbb475c3b7e45i1","output_id":"8c401e4849def046o0"}]}}}
2 Likes

Oh wow, thank you so much, you are amazing! Did you actually genuinely type all of that out yourself? And you know what it all means? Also, how, exactly, do I use this? Just paste it into the “out” field of an expression? And what do I put as the inputs? Anything? I’m quite new to flowlab in general and I don’t quite know how all of this stuff works.

1 Like

Haha, no, I didn’t type that out.
When you copy behaviors and paste them out it’ll turn into text.
All you need to do is copy all the text, then in the editor, just left click anywhere.
There’ll be two options, Cancel and Import, click import, and then paste all that text into the pop-up.

2 Likes

ohhhhhh that makes so much more sense, thank you!

1 Like

Oh, thank you, thank you, thank you, thank you! It works extremely well and I haven’t found any bugs or anything so far. I’ve been trying to fix just this one problem for a few weeks now and you did it in just over an hour.

1 Like