User Tag List

Results 1 to 8 of 8

Thread: make the spaceship movement operate using accelerometer

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    paobrasil's Avatar
    Join Date
    Apr 2012
    Location
    Rio de Janeiro, Brazil
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    make the spaceship movement operate using accelerometer

    Hello again my friends,

    I have a built in spaceship movement but I want to use the accelerometer to operate the keyboard right arrow movement when i tilt my device to right and the same method to the left...

    But i've tried here without success...my object its rotating uninterruptedly.... Can someone help me here?

    Best regards

  2. #2
    Clicker Multimedia Fusion 2 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleUnicode Add-on
    iamjot's Avatar
    Join Date
    Nov 2008
    Location
    Austria
    Posts
    712
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I made this game a while ago - do you mean sth like this?

    https://www.youtube.com/watch?v=pt90R6URUu4

    Its called Stromfeld

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    paobrasil's Avatar
    Join Date
    Apr 2012
    Location
    Rio de Janeiro, Brazil
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply......

    Well, no...I want to use the tilt to rotate the ship....not to move in X axis....the spaceship movement already do this when you press the keyboard left and right arrow....but I want to transfer this to tilt left and tilt right.....

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    paobrasil's Avatar
    Join Date
    Apr 2012
    Location
    Rio de Janeiro, Brazil
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well....it's EXACTLY this engine in this classic game Asteroids: http://www.classicgamesarcade.com/games/asteroids.swf

    when you press right and left keyboard arrow......well...I want to do this using tilt right and tilt left

    Best regards

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    paobrasil's Avatar
    Join Date
    Apr 2012
    Location
    Rio de Janeiro, Brazil
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nobody? =/

  6. #6
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, ┼rhus
    Posts
    3,455
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    You could easily make your own vector-style movement engine (I can't remember if the Vector movement is ported to iOS).

    You constantly add the values from the accelerometer to the current movement speed values (x and y direction) divided by some constant which will means how fast a your object will accelerate (larger values = smaller speeds)

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    paobrasil's Avatar
    Join Date
    Apr 2012
    Location
    Rio de Janeiro, Brazil
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for the reply Anders......but the problem it's that I want to use the X value of accelerometer to change de animation direction of my active.....but I dont know why, it is not working....maybe it's because the animation it's numbered integer......and the accelerometer it's fractionated....

  8. #8
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, ┼rhus
    Posts
    3,455
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    The accelerometer returns values between -1 and +1 (as far as I remember) typically rounded to -1 or 0 if you set the direction value to the current X value of the accelerometer.
    If you want to map the current X-tilt of the device to an animation frame or a direction you need to use a little bit of math so that [-1,+1] comes into a range like [0,32]:

    Set direction to:
    ((x-accelerometer-value+1.0)/2.0)*32

    The first +1 puts the value into the range [0,2]
    Dividing by 2 gives you the range [0,1]
    Multiplying by 32 gives you the range [0,32]

    You can modify the above formula to fit your needs.

Similar Threads

  1. Movement synchronization issues (physics spaceship movement)
    By SecondSons in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 24th January 2014, 10:52 PM
  2. Spaceship movement left and right trought bouncing ball movement instead 8 direction?
    By daryuss in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 22nd May 2012, 09:33 PM
  3. examples of how to make a spaceship movement using angles (NOT directions)
    By brett in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 19th December 2011, 12:15 AM
  4. Spaceship Movement
    By drnebula in forum File Archive
    Replies: 5
    Last Post: 29th May 2011, 05:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •