JUMP AND CHANGE !!!

app-etiteapp-etite Member Posts: 139
edited November -1 in Tech Support
hi guys,

I have a character (actor) with a running animation. when you touch the screen he jumps ok, but..

when he jumps I want a different animation played... or a different image at the least.

I have tried with both change image and animate but when i preview it the original actors run cycle is flickering behind it.. please help ive been at it for dayyyyssss!

thanks

App-etite Studios

Comments

  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    You could have an attribute that's a boolean called Jump, in the original animate rule, add 'if Jump is false' then animate. When you jump, turn the jump to on and then change the animation again.

    Let me know if this works

    Ace
  • app-etiteapp-etite Member Posts: 139
    thanks for the quick reply ace!

    i have a jump boolean which which I have used in the runcycle. ( when attribute game.jump is true, change attribute self.motion.linearvelocityY to 500) (so that jumps while he runs)

    then I have RULE when attribute self.Motion.linearvelocityY is more than 0.5 change image to "jump pic"... with a for 5 second timer on too. That just produces a quick flick but i want it to stay till it touches the ground again.

    Im trying your way now.Thanks
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    Then you could also add a rule that when he hits the ground, change jump to false, that way you are not using timers or anything.

    The reason why it's flicking back is that if you have your animation set to 15 frames per second, 15 times in a second it is changing the image.

    If you set it that it wont animate when jump is true, you shouldn't have a problem.

    Ace
  • app-etiteapp-etite Member Posts: 139
    ok thats why its flicking. But what behavior is there to use to say stop playin this animation when jump is true?? : (

    -App-etite
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    just have when jump is false then you run animation. Then have another rule when jump is true with jump animation, that way the wont play when the other is. Then when you jump after however many seconds u want change jump back to false
  • app-etiteapp-etite Member Posts: 139
    thanks guys! that works!!!... but my problem is now that if i hold jump, it holds the jump animation until i let go.
    and if i keep clicking he keeps jumping higher and higher :(

    any suggestions how to fix this.? thanks

    -app-etite
  • touchcreamtouchcream Member Posts: 63
    I usually don't use any boolean for that. I just set this rule :

    -if actor collide with ground
    ----running animation
    -else (otherwise)
    ----jumping animation

    It should work just fine without any other attribute ;)
  • app-etiteapp-etite Member Posts: 139
    figured out how to stop double jump, with a timer

    'after 0.02, run to completion unchecked..

    RULE inside of that
    'actor recieves event' 'overlaps or collide' with 'actor of type' 'ground actor" then put my jump rule in there.

    But, any ideas how to have the jump animation play after a quick touch and not a hold? if hold the screen he stays in the jump position until i let go.

    thanks guys

    -App-etite.
  • app-etiteapp-etite Member Posts: 139
    hi touch cream

    but wouldn't your solution make my character jump continuously? and also im using a boolean attribute for iphone touch screen. so when the player touches it my character jumps. can you explain more?

    Thanks

    -App-etite
  • app-etiteapp-etite Member Posts: 139
    bump id dee bump bump, bump bump!! :)
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    please dont bump your thread after 20 min.

    Now for your question where you have when touched is pressed change jump to 1 and then after 0.2 seconds change attributeto 0, take that out and try it like this

    Have a rule in your button when touch is pressed change jump to 1 then have another rule when touched is released change jump to 0.

    Then whatt you want to do in the player is when attribute jump =1 change attribute self motion linear y to self motion linear y+100

    do it like that instead of having a move up behavior or whatver for your jump.

    Then lastly if you didnt already you should have a acceerlate down behavior relative to the scene sitting by itself in the player, and not in any rules. That will act as your gravity and bring the player back down after the jump.
  • app-etiteapp-etite Member Posts: 139
    it does work nice the way you explained but my main problem is with the changing animation once the player presses jump.

    At the moment I have when attribute game.jump is false animate the runcycle.

    underneath i have when actor touches floor and game.jump is true or 1

    ANIMATE
    (animation)

    and change velocity y

    but it only plays one frame, one pic. and the player will stay in that pose until I let go off the touch. therefore the player can be just sliding along in a jump pose if the play was to hold the screen.. not good.

    any thoughts

    Thanks
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Ok this should work then. Like ace suggestions for the run animation have it when player collides with ground, notwhen jump =1. Then for you jump animation have when jump =1 play jump animation with restor original im age checkes and loop unchecked then have your change linear velocit y rule under it.

    now you should have a perfect jump with the animations working correctly
  • app-etiteapp-etite Member Posts: 139
    Thanks guys..

    Everything works now.. Just need to tweak it..

    Again thanks!

    -app-etite
Sign In or Register to comment.