Trying to make a dash move and combat system for my game

I’m trying to code a dash move where pressing X will cause the player to zip forward, but it doesn’t work if you keep the left or right arrow keys held. I also want to add attack moves if you press the C key, but don’t know how to do this. Please help.
My game: Heroes of Megtoweropolis Cyber Runner - Flowlab Game Creator

2 Likes

Ah, I am familiar with this problem. (Also, if you have a help request, please post it on the help request category)
The reason that the dash does not activate when the player is moving is because the player movement uses Velocity, and therefore disrupts the dash also using velocity.

Simpler: The dash using velocity cannot happen when the movement is using velocity.


There are a few ways to fix this:

I know of a pretty easy solution, although there are always more efficient and just better ways.
So, basically, you need the dash to have higher priority of the player’s movement than the movement. To do this, you need to turn off the player movement for a set amount of time while the dash is in effect. You can do this with switches for every speed input. This does restrict the player’s movement, of course. But it allows the player to move quicker, dashing.

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":0,"outputCount":0,"name":"Movement","behaviorType":"logic.NodeGroup","x":0,"y":-384,"group":0,"id":"98b516a8964fa644","notes":null,"n_o":0,"isMenuItem":false},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":-32,"group":"98b516a8964fa644","id":"98b516a9b479974e","startVal":-15,"tag":"move left"},{"inputCount":3,"outputCount":3,"name":"Velocity","behaviorType":"logic.properties.Physics","x":540,"y":0,"group":"98b516a8964fa644","id":"98b516a9a162c74b"},{"inputCount":3,"outputCount":3,"name":"Flip","behaviorType":"logic.properties.Flip","x":540,"y":-112,"group":"98b516a8964fa644","id":"98b516a97a0c7745","notes":"Flip","n_o":1,"vertical":false},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":64,"group":"98b516a8964fa644","id":"98b516a9cb7c7243","startVal":15,"tag":"move right"},{"inputCount":0,"outputCount":2,"name":"Keyboard","behaviorType":"logic.triggers.Keyboard","x":-360,"y":32,"group":"98b516a8964fa644","id":"98b516a9ed7c644e","keyCode":87,"repeats":false,"delay":0},{"inputCount":0,"outputCount":2,"name":"Keyboard","behaviorType":"logic.triggers.Keyboard","x":0,"y":96,"group":"98b516a8964fa644","id":"98b516a9a1061048","keyCode":68,"repeats":true,"delay":0},{"inputCount":0,"outputCount":2,"name":"Keyboard","behaviorType":"logic.triggers.Keyboard","x":0,"y":-32,"group":"98b516a8964fa644","id":"98b516a94cdd0b4e","keyCode":65,"repeats":true,"delay":0},{"inputCount":3,"outputCount":3,"name":"Animation","behaviorType":"logic.properties.Animation","x":180,"y":-160,"group":"98b516a8964fa644","id":"98b650495edc1143","notes":"Animation","n_o":1,"animationName":"Walk","loop":true,"priority":0},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":0,"y":896,"group":"98bb9289ac137248","id":"98bb92899db4ca43","notes":"3. Adjust the Jump force","n_o":0,"startVal":80,"tag":"jump force"},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":360,"y":576,"group":"98bb9289ac137248","id":"98bb92894da97b45","_startVal":0,"dataType":2},{"inputCount":3,"outputCount":3,"name":"Impulse","behaviorType":"logic.components.Impulse","x":630,"y":576,"group":"98bb9289ac137248","id":"98bb92891e659048"},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":360,"y":896,"group":"98bb9289ac137248","id":"98bb928950c47c4d","_startVal":0,"dataType":2},{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":-180,"y":576,"group":"98bb9289ac137248","id":"98bb9289305a1941"},{"inputCount":3,"outputCount":2,"name":"RayCast","behaviorType":"logic.components.RayCast","x":0,"y":576,"group":"98bb9289ac137248","id":"98bb928900930c42","notes":"1. Set Raycast to your \"Floor\" object\n \n2. Adjust its length depending on your Player's Object size\n-> This Raycast MUST trigger when the player is on the ground, and miss when the player isn't","n_o":0,"targetClassId":19736885,"direction":90,"length":50,"oX":0,"oY":0},{"delay":1,"count":1,"inputCount":3,"outputCount":1,"name":"Timer","behaviorType":"logic.triggers.Timer","x":360,"y":736,"group":"98bb9289ac137248","id":"98bb92893e445443"},{"inputCount":0,"outputCount":1,"name":"Bundle Input","behaviorType":"logic.NodeGroupInput","x":-180,"y":896,"group":"98bb9289ac137248","id":"98bb928974f69347","portId":"98bb9289ac137248i0","tag":"in","dataType":2},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":630,"y":960,"group":"98bb9289ac137248","id":"98bb9289552d5f40","startVal":0,"tag":"stop"},{"inputCount":3,"outputCount":3,"name":"Velocity","behaviorType":"logic.properties.Physics","x":810,"y":960,"group":"98bb9289ac137248","id":"98bb9289ad81c149"},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":990,"y":896,"group":"98bb9289ac137248","id":"98bb92890f83214e","startVal":0,"tag":"double jump"},{"inputCount":3,"outputCount":3,"name":"Impulse","behaviorType":"logic.components.Impulse","x":1170,"y":864,"group":"98bb9289ac137248","id":"98bb9289a51cf84a"},{"inputCount":1,"outputCount":0,"name":"Message","behaviorType":"logic.components.Message","x":1170,"y":960,"group":"98bb9289ac137248","id":"98bb9289e7bde24b","msg":"double jumped","route":"SendToSelf"},{"delay":2,"count":1,"inputCount":3,"outputCount":1,"name":"Timer","behaviorType":"logic.triggers.Timer","x":0,"y":736,"group":"98bb9289ac137248","id":"98bb9289481b724b"},{"inputCount":1,"outputCount":0,"name":"Message","behaviorType":"logic.components.Message","x":630,"y":672,"group":"98bb9289ac137248","id":"98bb9289231a9341","msg":"jumped","route":"SendToSelf"},{"inputCount":1,"outputCount":0,"name":"Jump & Double Jump","behaviorType":"logic.NodeGroup","x":-180,"y":-48,"group":"98b516a8964fa644","id":"98bb9289ac137248","notes":"Doible jumping effect . (Ignore)","n_o":1,"isMenuItem":false},{"inputCount":3,"outputCount":3,"name":"Animation","behaviorType":"logic.properties.Animation","x":-180,"y":96,"group":"98b516a8964fa644","id":"98bd1398eae7ac4a","notes":"Optional falling animation\n","n_o":1,"animationName":"Fall","loop":false,"priority":1},{"inputCount":0,"outputCount":1,"name":"Collision","behaviorType":"logic.triggers.Collision","x":-360,"y":144,"group":"98b516a8964fa644","id":"98bd5af7d497394a","targetClassId":19736885,"targetEntityId":0,"collisionFilter":15,"collideWithEntity":false,"delay":0},{"inputCount":0,"outputCount":2,"name":"Keyboard","behaviorType":"logic.triggers.Keyboard","x":0,"y":320,"group":"98b516a8964fa644","id":"98c972b51a93f44e","keyCode":16},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":320,"group":"98b516a8964fa644","id":"98c98f9da2abd543","notes":"Dash velocity. In this case using Impulse","n_o":1,"startVal":100,"tag":"","roundMode":1},{"inputCount":3,"outputCount":3,"name":"Impulse","behaviorType":"logic.components.Impulse","x":360,"y":320,"group":"98b516a8964fa644","id":"98c9dc66deaf4843"},{"inputCount":3,"outputCount":3,"name":"Animation","behaviorType":"logic.properties.Animation","x":180,"y":464,"group":"98b516a8964fa644","id":"98cb1dfd91e2d546","notes":"Animation\n","n_o":1,"animationName":"Dash","loop":true,"priority":2},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":360,"y":-48,"group":"98b516a8964fa644","id":"98d1b5c553b4904b","notes":"Negative Velocity Movement","n_o":1,"_startVal":1,"dataType":2},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":360,"y":96,"group":"98b516a8964fa644","id":"98d1b655b0e2ce4a","notes":"Positive X movement","n_o":1,"_startVal":1,"dataType":2},{"delay":5,"count":1,"version":2,"inputCount":3,"outputCount":1,"name":"Timer","behaviorType":"logic.triggers.Timer","x":0,"y":192,"group":"98b516a8964fa644","id":"98d3533523f5594b"},{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":-360,"y":256,"group":"98b516a8964fa644","id":"98d906bfa9cbb148"},{"inputCount":3,"outputCount":2,"name":"RayCast","behaviorType":"logic.components.RayCast","x":-180,"y":240,"group":"98b516a8964fa644","id":"98d9129560994544","notes":"Ground Sensor","n_o":1,"targetClassId":19736885,"direction":90,"length":50,"earlyOut":false,"oX":0,"oY":0,"pin":false},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":176,"group":"98b516a8964fa644","id":"996f91203884da4e","startVal":0,"roundMode":1},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":360,"y":224,"group":"98b516a8964fa644","id":"997036f2a1f8dc42","notes":"X movement stop. (0 input)","_startVal":1,"dataType":2},{"delay":10,"count":1,"version":2,"inputCount":3,"outputCount":1,"name":"Timer","behaviorType":"logic.triggers.Timer","x":0,"y":432,"group":"98b516a8964fa644","id":"9972d0b483df4042"},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":-180,"y":336,"group":"98b516a8964fa644","id":"9972def9ef51bc40","_startVal":1,"dataType":2},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":270,"y":576,"group":"98b516a8964fa644","id":"9ddd986f617e674f","_startVal":0,"dataType":2},{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":90,"y":592,"group":"98b516a8964fa644","id":"9dddce4428660643"},{"inputCount":3,"outputCount":1,"name":"Spawn","behaviorType":"logic.components.Spawn2","x":450,"y":608,"group":"98b516a8964fa644","id":"9dddfdca33f56b44","notes":"A trail for the dshing","n_o":1,"entityClassId":19744887,"spawnX":0,"spawnY":0},{"inputCount":1,"outputCount":1,"name":"Extractor","behaviorType":"logic.properties.Extractor","x":270,"y":800,"group":"98b516a8964fa644","id":"9ddec35615388d49","targetId":0,"prop":"y","version":2},{"inputCount":1,"outputCount":1,"name":"Extractor","behaviorType":"logic.properties.Extractor","x":270,"y":688,"group":"98b516a8964fa644","id":"9ddec3dbc5cca34f","targetId":0,"prop":"x","version":2},{"inputCount":1,"outputCount":0,"name":"Message","behaviorType":"logic.components.Message","x":-180,"y":496,"group":"98b516a8964fa644","id":"cd2f11900ad4b240","notes":"Ignore","n_o":1,"msg":"not on ground","route":"SendToSelf"},{"inputCount":1,"outputCount":0,"name":"Message","behaviorType":"logic.components.Message","x":-180,"y":624,"group":"98b516a8964fa644","id":"cd2fa7480f6ee942","notes":"Ignore","n_o":1,"msg":"on ground","route":"SendToSelf"},{"inputCount":3,"outputCount":4,"name":"SoundEffect","behaviorType":"logic.components.SoundEffect","x":720,"y":432,"group":"98b516a8964fa644","id":"d87f2bdd5c43e641","notes":"sfx","n_o":1,"sound":null,"loop":false,"volume":52,"url":null,"soundName":"actions sound effect 3","soundURL":"/effects/adventure/actions/drawKnife3.ogg.mp3"},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":540,"y":416,"group":"98b516a8964fa644","id":"d87f6323621f7c4b","_startVal":0,"dataType":2},{"delay":4,"count":0,"version":2,"inputCount":3,"outputCount":1,"name":"Timer","behaviorType":"logic.triggers.Timer","x":360,"y":432,"group":"98b516a8964fa644","id":"d87fa98bf023654f"},{"inputCount":3,"outputCount":4,"name":"SoundEffect","behaviorType":"logic.components.SoundEffect","x":540,"y":256,"group":"98b516a8964fa644","id":"d880e122ca27dc4d","notes":"sfx","n_o":1,"sound":null,"loop":false,"volume":100,"url":null,"soundName":"whoosh sound effect 2","soundURL":"/effects/whoosh/17.ogg.mp3"}],"links":[{"input_id":"98d1b5c553b4904bi2","output_id":"98b516a9b479974eo0"},{"input_id":"98d1b655b0e2ce4ai2","output_id":"98b516a9cb7c7243o0"},{"input_id":"98bb9289ac137248i0","output_id":"98b516a9ed7c644eo0"},{"input_id":"98bd1398eae7ac4ai0","output_id":"98b516a9ed7c644eo0"},{"input_id":"98b650495edc1143i0","output_id":"98b516a9a1061048o0"},{"input_id":"98b516a9cb7c7243i1","output_id":"98b516a9a1061048o0"},{"input_id":"d87f6323621f7c4bi1","output_id":"98b516a9a1061048o0"},{"input_id":"98b650495edc1143i1","output_id":"98b516a9a1061048o1"},{"input_id":"996f91203884da4ei1","output_id":"98b516a9a1061048o1"},{"input_id":"d87f6323621f7c4bi0","output_id":"98b516a9a1061048o1"},{"input_id":"98b650495edc1143i0","output_id":"98b516a94cdd0b4eo0"},{"input_id":"98b516a9b479974ei1","output_id":"98b516a94cdd0b4eo0"},{"input_id":"d87f6323621f7c4bi1","output_id":"98b516a94cdd0b4eo0"},{"input_id":"98b650495edc1143i1","output_id":"98b516a94cdd0b4eo1"},{"input_id":"996f91203884da4ei1","output_id":"98b516a94cdd0b4eo1"},{"input_id":"d87f6323621f7c4bi0","output_id":"98b516a94cdd0b4eo1"},{"input_id":"98bb92894da97b45i2","output_id":"98bb92899db4ca43o0"},{"input_id":"98bb928950c47c4di2","output_id":"98bb92899db4ca43o0"},{"input_id":"98bb92894da97b45i0","output_id":"98bb92894da97b45o0"},{"input_id":"98bb92891e659048i1","output_id":"98bb92894da97b45o0"},{"input_id":"98bb9289231a9341i0","output_id":"98bb92894da97b45o0"},{"input_id":"98bb92893e445443i0","output_id":"98bb92894da97b45o0"},{"input_id":"98bb92893e445443i1","output_id":"98bb928950c47c4do0"},{"input_id":"98bb928950c47c4di0","output_id":"98bb928950c47c4do0"},{"input_id":"98bb92890f83214ei0","output_id":"98bb928950c47c4do0"},{"input_id":"98bb9289552d5f40i1","output_id":"98bb928950c47c4do0"},{"input_id":"98bb928900930c42i2","output_id":"98bb9289305a1941o0"},{"input_id":"98bb92894da97b45i1","output_id":"98bb928900930c42o0"},{"input_id":"98bb9289481b724bi1","output_id":"98bb928900930c42o0"},{"input_id":"98bb928950c47c4di0","output_id":"98bb928900930c42o0"},{"input_id":"98bb9289481b724bi0","output_id":"98bb928900930c42o1"},{"input_id":"98bb928950c47c4di1","output_id":"98bb92893e445443o0"},{"input_id":"98bb92899db4ca43i1","output_id":"98bb928974f69347o0"},{"input_id":"98bb9289ad81c149i1","output_id":"98bb9289552d5f40o0"},{"input_id":"98bb92890f83214ei1","output_id":"98bb9289ad81c149o1"},{"input_id":"98bb9289a51cf84ai1","output_id":"98bb92890f83214eo0"},{"input_id":"98bb9289e7bde24bi0","output_id":"98bb92890f83214eo0"},{"input_id":"98bb92894da97b45i0","output_id":"98bb9289481b724bo0"},{"input_id":"98bd1398eae7ac4ai1","output_id":"98bd5af7d497394ao0"},{"input_id":"9972def9ef51bc40i2","output_id":"98bd5af7d497394ao0"},{"input_id":"98d1b5c553b4904bi0","output_id":"98c972b51a93f44eo0"},{"input_id":"98d1b655b0e2ce4ai0","output_id":"98c972b51a93f44eo0"},{"input_id":"98d3533523f5594bi0","output_id":"98c972b51a93f44eo0"},{"input_id":"997036f2a1f8dc42i0","output_id":"98c972b51a93f44eo0"},{"input_id":"d880e122ca27dc4di0","output_id":"98c972b51a93f44eo0"},{"input_id":"9972def9ef51bc40i0","output_id":"98c972b51a93f44eo0"},{"input_id":"98c98f9da2abd543i1","output_id":"98c972b51a93f44eo0"},{"input_id":"9972d0b483df4042i0","output_id":"98c972b51a93f44eo0"},{"input_id":"98cb1dfd91e2d546i0","output_id":"98c972b51a93f44eo0"},{"input_id":"9ddd986f617e674fi1","output_id":"98c972b51a93f44eo0"},{"input_id":"98c9dc66deaf4843i2","output_id":"98c98f9da2abd543o0"},{"input_id":"98b516a97a0c7745i0","output_id":"98d1b5c553b4904bo0"},{"input_id":"98b516a9a162c74bi0","output_id":"98d1b5c553b4904bo0"},{"input_id":"98b516a97a0c7745i1","output_id":"98d1b655b0e2ce4ao0"},{"input_id":"98b516a9a162c74bi0","output_id":"98d1b655b0e2ce4ao0"},{"input_id":"98d1b5c553b4904bi1","output_id":"98d3533523f5594bo0"},{"input_id":"98d1b655b0e2ce4ai1","output_id":"98d3533523f5594bo0"},{"input_id":"98cb1dfd91e2d546i1","output_id":"98d3533523f5594bo0"},{"input_id":"98d9129560994544i2","output_id":"98d906bfa9cbb148o0"},{"input_id":"cd2fa7480f6ee942i0","output_id":"98d9129560994544o0"},{"input_id":"98bd1398eae7ac4ai0","output_id":"98d9129560994544o1"},{"input_id":"997036f2a1f8dc42i0","output_id":"98d9129560994544o1"},{"input_id":"cd2f11900ad4b240i0","output_id":"98d9129560994544o1"},{"input_id":"997036f2a1f8dc42i2","output_id":"996f91203884da4eo0"},{"input_id":"98b516a9a162c74bi0","output_id":"997036f2a1f8dc42o0"},{"input_id":"997036f2a1f8dc42i1","output_id":"9972d0b483df4042o0"},{"input_id":"9972def9ef51bc40i1","output_id":"9972d0b483df4042o0"},{"input_id":"9ddd986f617e674fi0","output_id":"9972d0b483df4042o0"},{"input_id":"996f91203884da4ei1","output_id":"9972def9ef51bc40o0"},{"input_id":"997036f2a1f8dc42i1","output_id":"9972def9ef51bc40o0"},{"input_id":"9dddfdca33f56b44i2","output_id":"9ddd986f617e674fo0"},{"input_id":"9ddd986f617e674fi2","output_id":"9dddce4428660643o0"},{"input_id":"9ddec3dbc5cca34fi0","output_id":"9dddce4428660643o0"},{"input_id":"9ddec35615388d49i0","output_id":"9dddce4428660643o0"},{"input_id":"9dddfdca33f56b44i1","output_id":"9ddec35615388d49o0"},{"input_id":"9dddfdca33f56b44i0","output_id":"9ddec3dbc5cca34fo0"},{"input_id":"d87f2bdd5c43e641i0","output_id":"d87f6323621f7c4bo0"},{"input_id":"d87f6323621f7c4bi2","output_id":"d87fa98bf023654fo0"}]}}}

Here is a very messy bundle I have to do this. I tried to put some labels to help you out. I’m on a tight schedule, but, if you want, I could configure a new, easier bundle for you.

If you need more explaining or want a custom bundle, tag me here.

-Ember.Y