Issues with Boolean's/D-Pad movement.
whycali
Member, PRO Posts: 87
I currently have 3x Boolean's
1 = moveLeft
1 = moveRight
1 = jump
Currently when I am pressing the actor for moving right or left and then hit the jump button the Hero will jump in the direction i was moving. If i remove my finger from the jump button mid jump my hero stops moving in the direction i was going and the hero just falls down. When the hero falls down i then have to lift my finger off the left or right button and place it down again to get the hero to move again. How do i fix this issue.
My goal would be to get the hero to keep moving after i press the jump button with out having to lift my finger from the left or right button.
Thank you all for your support and help.
-WhyCali
Comments
Use constrain motion linear velocity x instead of change attribute or move for movement right and left
For movement i am currently using Motion Linear Velocity X = 150 for right and -150 for left and using Motion Linear Velocity Y = 250 for jump.
is it a change attribute or a constrain ? can you show the rules ?
Mine is setup as a Change Attribute. It works great when using the keyboard for the left, right, and space bar. but buttons not so much. So should i change it from Attribute to Constrain. if so what is the reason behind that just so i know.
Change attribute fires once if the condition is true , constrain updates constantly. It might be something else thats causing this though , test it
@Icebox Thank you for your help. when i get back to my machine i will try swapping it from change attribute to constrain. Thanks again for your help. I will update you on if it worked later on this evening.
You welcome, make sure your right and left buttons rules are when touch is "inside" instead of pressed, this might be the problem as well since you dont have the issue with keyboard.
ok. Currently its when "pressed". What would be the reasoning behind using "Inside"?
When you play on your device it allows you to swipe your finger to the left or right, with pressed you have to release the right button then touch the left button to go from right to left which causes issues to the player
@Icebox I changed the code from "Change Attribute" to "Constrain" still having the same issue. I have attached my walking rules and my jump rules.
Try this
if game.moveright is false and game.moveleft is false
constrain motion linear velocity x to 0
otherwise
2 rules
if game.moveright is true
constrain motion linear velocity x to 150
if game.moveleft is true
constrain motion linear velocity x to -150
in your right button
if touch is inside change attribute move right to true otherwise false
in your left button
if touch is inside change attribute move left to true otherwise false
try to avoid having many change attributes to 0 on your otherwise section it might cause you trouble later on
@Icebox Should i set up the Jump rules the same way? I havent tried the above rules yet was at the SJ Sharks game last night
@icebox So I implemented the rules that you stated above but i am still having the same issue. When i am moving and Jump and release the jump button the character falls down and then i need to remove my finger from left or right buttons (depending on what direction im going) in order to start moving again.
I'm sorry I cant tell without looking at all of the rules.What ever problem you have, it must be cause of a condition. Its either in one of the otherwise in your list of rules thats causing the actor to stop , or its a logic you have. I cant tell without looking through the rules. If you create a new actor and put the rules I gave you , they will work.
You might have the issue cause you have both keys and buttons. One says when both key are up constrain motion x and your button says when move right or left is true constrain motion linear velocity. I dont know how you set up your conditions for it. If you want attach a small demo file with the actor and ground only and ill look through it.
@icebox Hey i just wanted to say thank you i went back and found a bunch of things conflicting with the code you had me change. things are working perfectly now. I just wanted to say thank you so much for taking the time to walk me through this.
You welcome , Im glad you figured it out good luck with your project