2
$\begingroup$

My issue is this: I am making a simple game where a cube moves around in a big field. The problem is, when the cube jumps, it stops moving forward. Now I would like it to keep the forward velocity. If there is no other way, I could make it so that force is applied to the cube while running in the air, but that would be unrealistic. Here is the .blend

$\endgroup$
  • $\begingroup$ could you post a picture of your current logic setup? $\endgroup$ – X-27 wants to Reinstate Monica Jul 16 '16 at 21:41
  • $\begingroup$ I added the .blend $\endgroup$ – Billy S Jul 16 '16 at 21:42
3
$\begingroup$

If you enable "Add" on all your motion actuators, you will get behavior closer to what you'd expect. With the logic how you have it now, when you push W, A, S, D or Space, the corresponding motion actuator sets the new location of the cube, based on the old location. The differences in location is what you have in the motion actuators. Because of this, only one can run at once - they are all trying to run at the same time, and they are all trying to set the cube's new location based on what they have filled in, which is different for each object.

However, if you set them to add, each one will add or subtract from the cube's location, instead of trying to set it. When you press Space, while holding forward, instead of the BGE taking the cubes location, adding to it along the Z, and setting the new location, it will simply add to the cube's Z location, creating the expected behavior.

enter image description here

In addition to having your cube able to move and jump at the same time, if you enable the "Add" setting on your other motion actuators, your cube will be able to move diagonally.

$\endgroup$
  • $\begingroup$ Once you get enough (15) reputation, you can also upvote this answer :) $\endgroup$ – X-27 wants to Reinstate Monica Jul 16 '16 at 22:02
  • $\begingroup$ I can upvote it now, it just doesn't show. It's still recorded $\endgroup$ – Billy S Jul 16 '16 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.