Jump butto issue
kajuto
Member Posts: 314
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
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.
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.
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.
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
MH
JohnPaiomitis: the attribute called DoubleTap, it should be a Boolean, integer or what?
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
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
http://www.mediafire.com/?5ugwfyfmfg4lzrg
cheers