Accelerometer function How - to

RussianMoneyRussianMoney Member Posts: 4
edited November -1 in Working with GS (Mac)
Hi all, would it be possible to make a simple how to for using the accelerometer function on Gamesalad? I am having trouble understanding how it works. If you could do something like simulate an actors movement left-right-forward-backwards using the accelerometer it would be so very helpful.
Thanks!!!

Comments

  • BuckyStarrBuckyStarr Member Posts: 12
    Now that we have the viewer working this would be a big help.

    Is there a proxy we can create that allows for one set of controls to be used for testing/playing on the MAC and then have them translated to accelerometer functions when they are exported to the phone?

    An example would be that the arrow keys are used on the iPhone and when the games is exprted those are translated to accelerometer function.

    Sorry if this is answered elsewhere on the board.

    $e*
  • BuckyStarrBuckyStarr Member Posts: 12
    Thank You Code Monkey;

    I am having a peculiar problem here though, might be hardware but it is a brand new 3G and I have had no other problems to date.

    First off I notice that there is an expression in the Speed field of MOVE. Could you explain what that is?

    My problem involve something simple. I copy this rule and drop in an integer (where I notice your expression is) and it works fine.
    If I reverse the multiplier in the attribute change (from -0.1 to 0.1 and I flop the directional vector I do not get the reverse effect.
  • BuckyStarrBuckyStarr Member Posts: 12
    OK solved the problem, simple BONEHEADED Geomtry issue involving an artist, geomtry, an electronic device and the brain of a claw hammer.
  • nulonulo Member Posts: 315
    does gamesalad uses mac book pro accelerometer!?
    that would be awesome to test some functionalities on the game.
  • nulonulo Member Posts: 315
    did a simple test with a actor and some accelerometer rules. and not working.
    did i do something wrong or is it just no compatible?
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    GameSalad does not use the accelerometer of the mac book pro. But I left the possibility open if we choose to implement it. Thanks for testing it though. :)
  • nulonulo Member Posts: 315
    alright. the implementation would be really great. since we could test the accelerometer controls right on the gs preview!
    that would be incredibly time saving.
  • BuckyStarrBuckyStarr Member Posts: 12
    I spent couple of hours figuring it out but when you realize what it is you get a huge "OMG, I cannot beleive I missed that"

    If you are implementing simple rules to make a tilt Right -> Move Right and Tilt left ->Move left function the BASIC rules set up in the turtorial is correct for one direction.

    To implement the OPPOSET direction though you have to think not just in numbers but GEOMETRICALLY. So if you reverce the conditional integer from -0.1 to 0.1 you also have to invert the changed condition so rather than "Less than" it needs to be "Greater than"

    I have a fully funtional control set now using this simple logic
  • quantumsheepquantumsheep Member Posts: 8,188
    Care to elaborate on that Wintermute? Maybe add to the wiki perhaps under the same tutorial?

    I tried to implement this last night, but got nowhere fast - I'm not geometrically or mathematically inclined alas!

    It did, however, inspire a whole new control system for one of my works in progress - and all it used no accelerometers at all! :)

    EDIT: Additionally, I found the responsiveness to be a little lacking using the accelerometers - but that could just be me getting it a whole heap of wrong ;)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • BuckyStarrBuckyStarr Member Posts: 12
    I will be glad to elaborate, try and do that later tonight

    I have found some lag as well but I want to experiment with something other than a simple "Move".
  • BuckyStarrBuckyStarr Member Posts: 12
    I updated the wiki with screen shots of my rules. They are just the "Up/DOWN" rules but the same goes for "Left/Right"

    $e*
  • quantumsheepquantumsheep Member Posts: 8,188
    Nice one mate - many thanks! :)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • JGary321JGary321 Member Posts: 1,246
    hey Quantum, you said you had an idea for a new control scheme. Care to elaborate??
  • quantumsheepquantumsheep Member Posts: 8,188
    Oh, it was nothing special mate - just something that worked really well on a project of mine, and was another 'choice' after using the keys or the accelerometer ;)

    Essentially, you press anywhere on the screen, and the actor moves towards that spot as long as you hold the mouse button down.

    This was nice because you could make the actor move left, for example, by holding down a spot on the screen anywhere to the left of it (i.e. right next to the actor's left, or right on the edge of the screen - or anywhere in-between).

    It seemed more accurate than using the accelerometer, but again, that might be because I was doing it wrong!

    I'm setting up a targetX and targetY variable, and then constraining those to the mouse. I then make the actor move towards targetX and targetY. Or something *like* that.

    If you want to try it out and get stuck, let me know and I'll write something more useful up :)

    Cheers,

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • JGary321JGary321 Member Posts: 1,246
    Thats similar to a control scheme i was thinking up. Just not quite as good. I was gonna make a button actor on the edge of the screen, but I love the idea of being able to touch anywhere. Thats real good.
  • quantumsheepquantumsheep Member Posts: 8,188
    Yep, it actually feels pretty nice - a little like point and click for RTS games.

    Dammit - there's *another* idea for a game! ;)

    EDIT: ACTUALLY, thinking about it, it's like the control on Nintendo DS games like Zelda and Animal Crossing.

    That Nintendo is VERY clever!

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • BuckyStarrBuckyStarr Member Posts: 12
    I am just a fountain of stupid questions...

    Do I need to create an attribute to link Accelerometer.Z to player rotation?
  • quantumsheepquantumsheep Member Posts: 8,188
    Don't worry about stupid questions - it's how we all learn!

    I *still* can't wrap (pun intended) my head around scrolling backgrounds and other stuff that other find incredibly easy to do!

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • butterbeanbutterbean Member Posts: 4,315
    [ I'm setting up a targetX and targetY variable, and then constraining those to the mouse. I then make the actor move towards targetX and targetY. Or something *like* that.

    If you want to try it out and get stuck, let me know and I'll write something more useful up :) ]

    Hey Quantum!

    I love the idea of your control scheme as quoted above

    Would you mind writing up a tutorial or showing screens of how you did this! I am making a game that could make very good use of this as oppose to the accelerometer or D-Pad

    Also, quick question on the D-Pad, does it show up on the Ipod/Itouch as visible? Or is it mapped to the screen as invisible?

    :)
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    I've provided some example images with the D-Pad on and off.

    http://gamesalad.com/wiki/game_attributes
  • butterbeanbutterbean Member Posts: 4,315
    Thanks Codemonkey, that's helpful :)

    Quantum, if you see this, I would still like to see your examples of actor moving towards target x, and target y :)
  • quantumsheepquantumsheep Member Posts: 8,188
    Butterbean,

    Sorry I can't help you right now - I'm reading this at work, working late the next two days then away for the weekend! Busy busy sheepy!

    Off the top of my head, just put a rule on your actor that says:

    If the mouse button is held down

    Then add the Move To behaviour and for position, put:

    > game.mouse.position.X ^ game.mouse.position.Y

    That should essentially do it.

    Hope that helps, sorry I can't help more right now.

    Cheers,

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • butterbeanbutterbean Member Posts: 4,315
    Thanks quantum, I'll try what you have said above, and if it doesn't work, I'll get back to you next week! :)
Sign In or Register to comment.