Jump butto issue

kajutokajuto Member Posts: 314
edited March 2012 in Miscellaneous
Hi there .! I recently made a actor that can move forward and backward and also I pressed touch the button jump , he jump. How can I , when I pressed DOBLE the button jump the actor stick to the roof and keep walking... Help I really appreciate it please

Comments

  • FloridaGamesFloridaGames Member Posts: 328
    Your problem is quite clear, button is spelled with an "n" ;)
    All kidding aside, the solution isn't very difficult just make a DOBLE boolean and a roof boolean, when Doble is true and actor(jumpbutton) is pressed: change roof to true. On you main character actor: When roof is true: change scene.gravity y to 180 and self.rotation to 180.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    You cant change the scene gravity in game.

    Simply just have your jump rules in a rule when the player collides with the ground, that way you cant double jump or anything.

    Also use a accelerate behavior in the down direction relative to scene to act as gravity.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Disregard the second and third part of my comment, i cant edit my post and i misunderstood what your after.

    But scene gravity cant be changed in game, so you want to use an accelerate behavior. Do this.

    Make an attribute called doubleTap

    In your jump button have when touch is pressed, change attribute doubleTap to doubleTap+1
    Then have a timer in there after .5 seconds run to completion checked, change attribute doubleTap to 0

    Then have a rule when attribute doubleTap=2 accelerate in the up direction relative to scene, then in the otherwise section have a accelerate behavior in the down direction.

  • FloridaGamesFloridaGames Member Posts: 328
    Oh, my bad. I don't work with gravity a lot. So change acceleration direction to 90, start it at 270.
  • MotherHooseMotherHoose Member Posts: 2,456
    your roof or top where you want to have the player walk upside down …

    on playerActor:
    Rule: when
    Event: overlaps/collides with actor roof
    -changeAttribute: self.Graphics.Flip Vertical To: true
    -changeAttribute: self.Position.Y To: correctY
    …here it is good to work out what the Y should be rather than using a constrain To: (roof.Position.Y-(roof.Size.Height/2) -(self.Size.Height/2)
    …put a displayText on the player with Text: self.Position.Y and drag the player till it look correct and use that Y value

    image MH
  • kajutokajuto Member Posts: 314
    Hey JohnPapiomitis ! hi there! thanks everyone for answer my issue.

    JohnPaiomitis: the attribute called DoubleTap, it should be a Boolean, integer or what?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited March 2012
    interger

    Also i missed out a part of it, you want to have another attribute called flip and have that be a boolean.

    When doubletap=2 change attribute flip to true

    then it should be when attribute flip is true (not when double tap=2)
    accelerate up relative to scene
    otherwise
    accelerate down relative to scene



    cheers
  • kajutokajuto Member Posts: 314
    i figured out just 5 mins ago, jaja but i did what u told me, but it didn't work. in my Jump Button, i used Keyboard A is down. i'm going to tell u the code :

    Jump Button Actor
    Event key A is down
    -change att Game.Jump to True
    -change att Game.DoubleTap to Game.DoubleTap+1
    -Timer , after 0.5s to 0

    Rule
    -Accelerate to direction 90, relative to Scene and Acceleration 100
    -Otherwise to direction 270, relative to Scene and Acceleration 100


  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited March 2012
    Me and the forum arent getting along today, so i made you a quick demo. It uses the A key.

    http://www.mediafire.com/?5ugwfyfmfg4lzrg

    cheers
  • kajutokajuto Member Posts: 314
    thanks for the help JohnPapiomitis, but there is a prob with that actor, if i don't have a roof of that height or maybe higher, the actor can jump as many time the player want to. i don't want that, i just want when the jump button tap 2 time, the actor stick to the roof and i can control him to walk forward or backward..can u modified the demo?! please and thanks for all
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    The roof has nothing to do with it, all that does is act as a collide so the player doesnt go up forever. It doesnt matter where it is, so you must have changed something. And the left and right movements will work the same as if hes on the ground, you dont have to have seperate ones or anything
  • kajutokajuto Member Posts: 314
    I meant about he jump two time it stick but only happen when the roof is close to te hero actor but if not, he can jump as many time he want is like simulating a jetpack I want to limiting the hero actor only maximum two jump
Sign In or Register to comment.