Tilt control (Please help Ive made an animation to show you what i am trying to do)

JordeyyJordeyy Member Posts: 409
edited March 2013 in Working with GS (Mac)
I have tried to incoperate tilt control into my game

My game involves shaking the iphone to start my bike , then rub the screen to gain speed with my bike then jump as far as I can

What I wanted to do is make it so when I'm in the air after jumping off the ramp , I can control the bikes angle by tilting my iPhone

i want to achieve this so bad that i have made an animation , showing you what i want to accomplish, so everyone knows what i mean

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Here's a suggestion: place an actor on the scene with a DisplayText behavior that contains the accelerometer attribute(s) you are using for movement. Then watch to see what happens when your iPhone is level, tilted left, tilted right, etc.
  • JordeyyJordeyy Member Posts: 409
    @tatiang if I record what happens when I run my tilt controls on you might understand me better ,

    Cause my bike is suppose to jot move until I shake my screen then rub my screen

    But when I activate the tilt control , it just starts my bike moving, without me shaking or running the screen
  • JordeyyJordeyy Member Posts: 409
    @tatiang
    www.youtube.com/watch?v=5DEqQZXTL8g

    That's what happens
  • goliathgoliath Member Posts: 1,440
    http://marketplace.gamesalad.com/#category=13&product=6910

    Would that help? It's my template on perfect tilt controls.... (there's also a Youtube link for you to watch how it works)
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2013
    @Jordeyy,

    You often ignore suggestions and just add more details or more questions. I know you've made huge progress with GameSalad but I gave you a specific thing to try for a specific reason. I think maybe you didn't understand the reason. I work from an IT troubleshooting standpoint and then from a programming standpoint. So I like to isolate problems.

    You're saying that when you hold the phone level, the actor moves. So my question is/was, when the phone is level, what is the value of the accelerometer attribute you're using? And furthermore, what is the rule condition you're using for that attribute?

    Because what if you think that the attribute should be 0 but it's really -418? Or what if it's 0 and your rule condition is When attribute [attributeName] > 90? I have no idea unless you post your exact rules and the values of the attributes you're getting when your phone is in each position.

    Honestly, a video doesn't help at all. Showing me what the actor does when the phone is tilted a certain way doesn't give me any additional information.


    Edit: I got thrown off by you typing "running the screen" when I realize you meant "rubbing the screen." So it sounds like you need to take a close look at the conditions you have in place for when your bike moves.
  • JordeyyJordeyy Member Posts: 409
    @tatiang here are my rules, could you please see if they look right also i will try your suggestion now

    image

    image
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    The screenshots look good. Once you post the values you're getting for game.Accelerometer.X when the iPhone is level, rotated left, and rotated right, we'll go from there.

    Can I assume there's nothing hidden in the "else" section of those rules?
  • JordeyyJordeyy Member Posts: 409
    @tatiang thats correct , there is nothing in the "else" section i will connect my ipod to gamesalad viewer now and tell you the results
  • JordeyyJordeyy Member Posts: 409
    @tatiang i did what you asked me to , and my bike kept julting foward without me doing anything, also the tilt controls didn't work in the air

    here is a video showing you the numbers displayed



    you see it move foward at the end
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2013
    The reason the video doesn't help is because I have no idea if the phone is level. It would be better if you wrote "When the phone is level, game.Accelerometer.X is about 0.81." Okay, let me be as clear as possible:

    When you hold your phone level (in landscape mode without rotating left or right), like in this screenshot... image

    ....what is the value of game.Accelerometer.X? When you rotate it to the left 45°, what is the value of game.Accelerometer.X? When you rotate it to the right 45°, what is the value of game.Accelerometer.X?

    From the video, it appears that your phone is showing game.Accelerometer.X at about 0.8 when the phone is level (assuming it's level... I can't tell from a video). So if that's the case, you'll need to adjust your rules.

    If you are assuming that 0 is level, 0.5 is rotated right, and -0.5 is rotated left, you're basing that on the idea that 0 is the midpoint of the range. In your case, it looks like 0.8 is the midpoint of the range, so you'd need a condition -0.5 less than that and a condition 0.5 greater than that.
  • JordeyyJordeyy Member Posts: 409
    @tatiang rotated 45° right its between 0.01-0.03

    rotated 45° left its between 0.01-0.04

    and straight its about 1

    do these numbers help ?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    They do help.

    45° left 0.02 straight 1 45° right 0.03

    Do you see a problem? Maybe try game.Accelerometer.Y.
  • JordeyyJordeyy Member Posts: 409
    @tatiang ok bro I will try that now and , tell you if it works
  • JordeyyJordeyy Member Posts: 409
    @tatiang ive been testing out changing X to Y but what parts do i change

    ive highlighted the parts i dont know if to change

    image
  • JordeyyJordeyy Member Posts: 409
    I have added a video , showing everyone what i am trying to do
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2013
    What happens when you change one of them? What happens when you change two of them? What happens when you change all three of them? This is what programming is... it's trial and error.
  • JoeMeisterJoeMeister Member Posts: 602
    Try this. It's absolutely better the anything else I tried over the past two years. And its smooth and not jerky.
    http://forums.gamesalad.com/discussion/53471
  • JordeyyJordeyy Member Posts: 409
    @tatiang ino what you are saying bro , i have tested lots of different combinations

    i was wondering if im using the wrong self.motion , cause my bike is supose to rotate to balance the bike i am wondering if it would be better to use

    self.motion.angularvelocity ?
  • JordeyyJordeyy Member Posts: 409
    @JoeMeister i downloaded that but could nott figure out how to make the bike rotate like in my video instead of moving forwards and backwards
  • JordeyyJordeyy Member Posts: 409
    has anyone else got any ideas ?
  • JordeyyJordeyy Member Posts: 409
    @tatiang have you looked at my last reply bro ? :)
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I've given you all the help I can. At this point, you just need to try different attributes and values and see what works. This is the hard part of coding and game design. I'm sure you'll figure it out but it may take some time.
  • JordeyyJordeyy Member Posts: 409
    @tatiang ok bro , thanks for all your help :)
Sign In or Register to comment.