Hold for power

MattVolletMattVollet Member Posts: 86
edited November -1 in Working with GS (Mac)
I just began working with Gamesalad today and I am really enjoying it, I was having a little problem getting what I want to get working (though I know it's possible)

I want to be able to hold down my finger (on iphone) on a football that charges the speed it will be tossed at, then on release it accelerates at an angle dictated by the X,Y of the iPhone accelerometer.

I tried looking into the cannon example and couldn't really get what I wanted from it. Can anyone help out?

Thanks a lot.

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    1) You could try making an invisible actor that acts like a target. Use the wiki section about accelerometer controls to control this actor. Keep it visible until you have it acting the way you want.

    2) Create two game integer attributes (call them targetX and targetY or something)

    3) In the target actor constrain game.targetX to self.position.X and constrain game.targetY to self.position.Y

    4) Then in the football create an integer attribute called powerup (or something like that). In the football have a rule:

    when touch is pressed
    Timer - (EVERY)
    .1 second (play around with this amount)
    change attribute - self.powerup to self.powerup+1 (may need to do +10 or something - play aruond with it)

    rule
    when touch is released
    acclerate toward (use game.targetX for the horizontal coordinant and use game.targetY for the vertical)
    amount use self.powerup

    Haven't ever tried this but it seems like it will work.

    Good luck!

    Welcome to the GS community!
  • MattVolletMattVollet Member Posts: 86
    Thank you a million times. I'll try it out and let you know!
Sign In or Register to comment.