conflicting controls

Hi All,

I am setting up a game where the actor climbs a ladder. I have my actor climbing up and down when using the keyboard. I added in a touch button, but can not get it to work when the keyboard commands are on.

I made two groups, keyboard commands and touch commands. The touch commands are an exact copy except I changed the scripting to match my button rules. If both sets of commands are on my actor will move up very little, but it seem gravity is pulling it down. If I turn one of them off, the on one work perfectly.

Below is a link to screenshots of the two rule groups. Let me know if you see anything that might be conflicting.

https://dropbox.com/s/d55xyruwfchorso/controls.zip?dl=0

Thanks in advance!

Comments

  • allc1865allc1865 Member, PRO Posts: 777
    edited October 2015

    I always have trouble when it comes to ladders.
    If no one else can help you, I suggest buying this template here from DBA (http://www.deepblueapps.com/?product=ladders).
    It's cheaper (and painless) then pulling your hairs out because no one replies! :D (i hate that)

  • quinn221quinn221 Member Posts: 280

    @Lost_Oasis_Games Thanks for the idea, but still nothing....

  • quinn221quinn221 Member Posts: 280

    I have the feeling it has something to go with the gravity settings.... when the are on in both rules, my jump strength is half.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Just add a condition to each existing rule that you already had before you added the keyboard. Just add the key conditions to your touch is pressed and do all instead of any. You can delete the keyboard rules you made.

  • quinn221quinn221 Member Posts: 280

    I did try that in the beginning, but if the touch controls were part of it, it would not work

  • quinn221quinn221 Member Posts: 280

    But it will work that way if both touch area and Keyboard are pressed.....i am stumped.

  • IceboxIcebox Member Posts: 1,485

    @quinn221 I think this is the problem

    when key is down >> change linear velocity to 100 >> otherwise constrain to 0
    when move contains down >> change linear velocity to 100 >> otherwise constrain to 0

    they are both constraining their value to 0 when they are up , so when you have them both on , they wont work , cause one of them is telling it to constrain the velocity to 0 and the other one is telling it to move , thats why when ur using one rule it works fine , just a guess though

  • IceboxIcebox Member Posts: 1,485

    @quinn221 change the way you control , make 2 game attribute booleans game.up game.down

    create an up actor

    create a rule if " any " of the conditions are true , key up is down or touch is inside , change attribute game.up to true other wise change game.up to false .

    now up will always work for both touch controls and up arrow key , then put in the rule you want if attribute game.up is true change velocity to 100 otherwise constrain to 0

    this should work

  • quinn221quinn221 Member Posts: 280

    @Icebox1910 I will give it a shot

  • quinn221quinn221 Member Posts: 280

    Ok...Idea 1, did not work... I will try the second one now

  • quinn221quinn221 Member Posts: 280

    Ok going up work perfect...but when I add in the down... the actor automatically climbs the ladder without a key command or touch command.....

    we are getting closer!

  • quinn221quinn221 Member Posts: 280
    edited October 2015

    @Icebox1910 OK now I am really close... the only issue is the actor will auto climb the ladder as soon as it touches the ladder... here is a link to my climb rules as well as my up actor button, the down is basically the same but with the game.down attribute

    Can you take a look and see if you can see the problem.

    Thanks!

    https://dropbox.com/s/vq2613s777h38o3/Archive%202.zip?dl=0

  • IceboxIcebox Member Posts: 1,485

    @quinn221 i think you messed it up with the rules

    set all of the ladder rules off , just in case this method doesnt work ,

    you will need 4 rules

    1-Rule 1 : if actor overlaps or collides with actor ladder change game.ladder to true otherwise change game.ladder to false

    2- Rule 2 : if game.ladder is true constrain motion linear velocity y = 0
    otherwise accelerate 270 ( gravity)

    3- Rule 3: if game.ladder is true and game.down is true constrain motion linear velocity y to -100

    4-Rule 4: if game.ladder is true and game.up is true constrain motion linear velocity y to 100

    Test it and tell me if theres a problem

  • quinn221quinn221 Member Posts: 280

    ok..it is about 99%.... the only issue now is that gravity pulls the actor down when not pressing the up command on both keyboard and touch pad

  • quinn221quinn221 Member Posts: 280

    the character also get stuck in the climb image state, until he jumps...

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Okay so the gravity issue is you need a neutral state when on the ladder so you need to constrain the actors X and Y position to the current position when on the ladder and no movements are being called. If when at the top of the ladder you need to be sure the actor returns to a default idle standing position once off the ladder. Remember logic is a series of events so think in logic when looking at your code.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    For the gravity issue, put the Accelerate Behavior that causes the gravity in a Rule like this:

    If the player is on/touching a ladder
    don't do anything/no accelerate behavior

    Otherwise
    do the accelerate behavior

    This would turn off gravity while the player is on a ladder.

Sign In or Register to comment.