Making character jump?

2

Answers

  • allc1865allc1865 Member, PRO Posts: 777
    oops. Sorry everyone. Posted the image in the wrong discussion.
  • -Timo--Timo- Member Posts: 2,313
    edited October 2013
    oh yes, now I can see it. yes thats the wrong discussion ;) did you also solved this problem or still have problems with it?
  • allc1865allc1865 Member, PRO Posts: 777
    Yes, I still have a problem with it; the score won't reset along with my game.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited October 2013
    That because you're cutting off the rule before the code get's to the score or the reset. Remember this is logic and things happen in exact order in a rule. You change the attribute condition first. That shouldn't even be changed there. Take the change attribute game.game reset out of the rule and put it alone at the top of the code stack. When the scene resets that will fire and change it back to false.
  • allc1865allc1865 Member, PRO Posts: 777
    Hi, @timolapre1998, do you or someone mind helping me out? When my character jumps and you move him to the right or left, he slides... So I have my file here: https://www.dropbox.com/s/phdueyiq0xoduj3/jumping.gameproj.zip
    You can download it. Will you please and tell me what's wrong? Thanks.
  • -Timo--Timo- Member Posts: 2,313
    I am not on windows now but does this also happens when you just walk to the left or right?
    if you have something like if game.moveRight is true
    change self.motion.linear velocity.x to 200
    then make it
    if game.moveRight is true
    every 0 seconds
    change self.motion.linear velocity.x to 200
    else
    change to 0

    if you already have this then you probably need to put his friction to 0

    if this also is not working then I will look at it when on windows :)
  • allc1865allc1865 Member, PRO Posts: 777
    I'm on Mac. Not Windows... :)
  • allc1865allc1865 Member, PRO Posts: 777
    Also, I put a drag on my character and that stopped the dragging.
    I'm having trouble with my jumping. It seems when I figure one thing out, another goes bad. :(
  • allc1865allc1865 Member, PRO Posts: 777
    Yeah, that is a lot better. Thank you very much :)
    Let me ask you one more question - and I do appreciate your help - as you saw, it jumps. I added some grass and a background to that same file, and now my jump button doesn't work. Any ideas on why that may be?
  • -Timo--Timo- Member Posts: 2,313
    can you send the file with background and grass?
  • allc1865allc1865 Member, PRO Posts: 777
    @FryingBaconStudios, Hi...no that didn't work either...
  • -Timo--Timo- Member Posts: 2,313
    edited October 2013
    do you also want it to be moveable when in air?
    I would also change your buttons to when touch is inside because thats better on a device :)
  • allc1865allc1865 Member, PRO Posts: 777
    What do you mean? have the character move when he jumps?
  • -Timo--Timo- Member Posts: 2,313
    when he is in air you cant move to right and left. do you want to move right and left when in air? now you only can jump straight up
  • allc1865allc1865 Member, PRO Posts: 777
    Oh. Yes. Move left and right when he jumps.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    You need to spend more time watching videos and learning not keep asking others to fix your code. You don't learn anything that way. I have a complete tutorial as I told you on run and jump watch it and learn how to do it right. Looking at your code I see you don't understand how rules work and code order. I have a video that talks about code order and there is a video on the cookbook about rules. Do the proper study.
  • allc1865allc1865 Member, PRO Posts: 777
    @FryingBaconStudios, Hi. Yes, I watch plenty of videos, and I'll watch yours, too. Thanks for the advice.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Watch those specific videos I mentioned. It's clear from your code you don't understand how logic is ordered. If you did you would have clearly scene you were turning off that rule right away with changing it back to false first.
  • allc1865allc1865 Member, PRO Posts: 777
    Ok. Thanks.
  • allc1865allc1865 Member, PRO Posts: 777
    Yes. Thank you for your help! It's really appreciated. What did you change? You said if self.jumping is false, stay put, if it's true, jump?
  • -Timo--Timo- Member Posts: 2,313
    I changed in the last rule the if game.jumping is true
    do
    rule if game.moveRight is true etc
    bla bla bla ;)

    to

    if SELF.jumping is true. so thats why I said don't mess game.jumping and self.jumping.
    and I changed if overlaps or collide with ground tile copy
    change jumping to false
    else
    change jumping to true <-- added
  • allc1865allc1865 Member, PRO Posts: 777
    Could I get rid of the display text that shows true and false on my character?
  • allc1865allc1865 Member, PRO Posts: 777
    Let me ask you. Did you do something to in the rules to make it work with just that character? Because when I switch out characters, it starts acting funny. First I could move right or left and jump, now if I switch out the character, I cannot move move right or left and then jump.
  • -Timo--Timo- Member Posts: 2,313
    Could I get rid of the display text that shows true and false on my character?
    I added a display text in your player so if you delete it you dont see a true and false on your player.
    Let me ask you. Did you do something to in the rules to make it work with just that character? Because when I switch out characters, it starts acting funny. First I could move right or left and jump, now if I switch out the character, I cannot move move right or left and then jump.
    Hmm... Maybe I edited the player in the screen and not the prototype (dont think so but cant remember) if you add the thing I said in another post then it should work. And else I will look at it when on mac.

  • -Timo--Timo- Member Posts: 2,313
    I cant see the problem. when I delete the player and place a new character it works just the same. you only can have 1 player.
  • allc1865allc1865 Member, PRO Posts: 777
    Hi, thanks. I figured out what the problem was. Thank you for fixing my rules! :) :)
  • -Timo--Timo- Member Posts: 2,313
    Hi, thanks. I figured out what the problem was. Thank you for fixing my rules! :) :)
    glad you fixed it :) sure, no problem. if you have more question then ask ;)

Sign In or Register to comment.