making my actor jump?

Hipster_Owl_StudiosHipster_Owl_Studios Member, PRO Posts: 214
edited November -1 in Working with GS (Mac)
I am trying to make my actor jump with a button, ive tried ways to do it but im lost i dont know how to make my actor jump i know how to make him jump by pressing the space bar(well kinda he jumps but then floats off top of the screen) but im making an ipad game and i want a jump button can someone help me out as to how should i approch this?

Comments

  • iDeveloperziDeveloperz Member Posts: 1,169
    Yeh sure.

    Create a game attribute called jump. (integer)

    Then create an actor called jump switch.

    Add a rule {

    When touch is pressed.
    Change attribute _ game.jump to 1
    }

    Then in your actor that you want to jump add this rule {
    when game.jump = 1
    (timer) __For 0.1 seconds__
    Accelerate ^2500

    (timer) __after 0.1 seconds__
    change attribute _ game.jump to 0
    }
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Also, there's more stuff here: http://gamesalad.com/wiki/

    Under heading HOW TO'S, click link "Movement", then you'll find the link: "How do I make an actor jump?"

    :-)

    ---------------------------------------------------------------
    Spiral Gyro Games

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • KamazarKamazar Member Posts: 287
    iDeveloperz said:
    Yeh sure.

    Create a game attribute called jump. (integer)

    Then create an actor called jump switch.

    Add a rule {

    When touch is pressed.
    Change attribute _ game.jump to 1
    }

    Then in your actor that you want to jump add this rule {
    when game.jump = 1
    (timer) __For 0.1 seconds__
    Accelerate ^2500

    (timer) __after 0.1 seconds__
    change attribute _ game.jump to 0
    }

    Why mess around with attributes at all?

    If you touch
    Accelerate for 1.5 seconds

    Turn "run to completion" off, and it'll let you jump higher depending on how long you hold down the button.
  • Hipster_Owl_StudiosHipster_Owl_Studios Member, PRO Posts: 214
    hey guys thanks alot for the help i really appreciate it but i have one more problem its kinda silly but my actor jumps but he doesnt come back down he just flies up off the screen? y is this so?
  • iDeveloperziDeveloperz Member Posts: 1,169
    Reduce the acceleration.

    Try 100 then 200....

    :)
  • Hipster_Owl_StudiosHipster_Owl_Studios Member, PRO Posts: 214
    still nothing all it does is make my actor go up slowly but he still continues to rise up im assuming i need some type of gravity or phyics in my scene or actor idk wats the problem...
  • iDeveloperziDeveloperz Member Posts: 1,169
    Go into the scene attributes and add gravity to about 300.
  • iDeveloperziDeveloperz Member Posts: 1,169
    No wait in-fact don't do that. I cba telling you how to do everything else. Sorry, Im just tired thats all.

    Add a rule into the actor that jumps, accelerate down 300.

    Then make it collide with a floor. Then on the floor and the actors restitution 0.

    :)
  • iDeveloperziDeveloperz Member Posts: 1,169
    Infact,

    Just download this... http://gamesalad.com/game/play/54538

    Edit: Sorry guys I should have edited the last 2 posts.
  • Hipster_Owl_StudiosHipster_Owl_Studios Member, PRO Posts: 214
    Thanks alot man! i apprecite all ur help and the patients lol if u ever need my help jst write me on my profile and let me know! also one more quick question my actor jumps now and he lands but when he lands he keeps going down off into the screen.. now can u explain how i make a rule saying he cant pass the ground now i made an actor that wont show up(invisable) now i draged it across my entire scene all i need to do is pretty much add the rules what rules do i need?
  • iDeveloperziDeveloperz Member Posts: 1,169
    Add a floor actor going across the bottom of the scene where your actor walks on.

    Then make you actor that jumps collide with actor of type floor.

    Its all in that link I posted.
Sign In or Register to comment.