GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Player jumping?

Braydon_SFXBraydon_SFX Posts: 8,959Member, Sous Chef, PRO, Bowlboy Sidekick GameSalad Employee
edited 6:28PM in Working with GS (Mac)
I need to have my player jump when he touches the iphone/ipad screen.
Any help would be really good

Maybe when you hold it longer, he jumps higher.
Anything ;)

Thanks!

Comments

  • JohnPapiomitisJohnPapiomitis Posts: 6,256Member
    create a attribute called jump. Create a actor, drag it over the whole scene, and change its alpha to 0 so its invisible( or even better turn visible off in it graphics attributes)

    Now in the actor you dragged over the whole scene make a rule:

    when touch is pressed
    -change attribute jump to 1
    then open up the otherwise section of that rule and put a change attribute behaviro in there changing jump to 0 (that wil make it so when the screen is not being pressed, jump=0)

    then finally in your player have a rule when attribute jump=1
    change attribute self motion linear velocity to 300 (adjust the 300 to your jump height)

    cheers
  • Braydon_SFXBraydon_SFX Posts: 8,959Member, Sous Chef, PRO, Bowlboy Sidekick GameSalad Employee
    Cool thanks, but how do i do this step:
    -change attribute jump to 1

    I cant find that.

    Or, when you said: create a attribute called jump
    What does that mean?
    What i did is I see a 'actors', 'atributes' and 'devices'
    I made a 'rump' in the 'atributes' Is that what i am supposed to do?

    If so, then there are many setting when i make one.
    'Boolean', 'text', 'integer', 'real', 'angle', and 'index'
    Am i supposed to choose one of those?
  • svnsvn Posts: 445Member
    Here's a good idea:
    Start with JohnPapiomitis's giant invisible actor. Create two boolean attributes : Jump and Grounded. Tell attribute Grounded when the player touches the ground, the attribute Grounded is On, otherwise its Off. Then tell the attribute Jump when the Jump actor is touched, change attribute Jump to On, otherwise its Off. Now, tell the player actor that when both attributes Jump and Grounded are on, change attribute self.Motion.Linear.X to (any positive number you want).
    Hope this helps.
    Cheers, svn
This discussion has been closed.