iOS Accelerometer Issue controlling character.
I have an issue with my game, the actor controlled by accelerometer with this code constrain attribute > self.Position.X self.Position.X +(15* game.Accelerometer.Y ) which works great... but the problem is when the character collides with a vertical object, it just sticks, as the constrain attribute overrides the bounce behaviour.
Is there a way to bounce off the vertical object considering the accelerometer value can be quite high. The best example I can think of is something like a wooden labyrinth set-up.
Currently I am sticking to things like Super Meat Boy and I don't want that.
Pinball style is what I am after, the harder you hit the more you bounce back.
Any help would be much appreciated
Is there a way to bounce off the vertical object considering the accelerometer value can be quite high. The best example I can think of is something like a wooden labyrinth set-up.
Currently I am sticking to things like Super Meat Boy and I don't want that.
Pinball style is what I am after, the harder you hit the more you bounce back.
Any help would be much appreciated
![:) :)](http://forums.gamesalad.com/plugins/emojiextender/emoji/twitter/smile.png)
Comments
Is there a way to track an actors velocity and then use that as a variable to make a bounce bigger based on the actors speed? That is an idea I will look in to...
It's kind of like bouncing a basketball on Jupiter due to the accelerometer. We want to play normal basketball in a heavy gravity environment.
Up and down bouncing is fine, it's just left and right that gets overpowered by the accelerometer.
Set up the walls with physics like this:
Density = 100
Friction = 0
Bounciness = 0
Fixed Rotation = checked
Collision Shape = rectangle
Then in the ball actor set up the physics like this:
Density = 1
Friction = 0
Bounciness = 0
Fixed Rotation = unchecked
Collision Shape = circle
Then in the ball actor use the following behaviors:
Collide
-- Bounce when colliding with: actor of type: wall
Timer -- every .2 seconds
--Accelerate:
----Direction: (vectorToAngle( game.Accelerometer.X , game.Accelerometer.Y )+90)%360
----Relative To: Scene
----Acceleration: 300
Oh -- I see an error. The ball needs a bounciness of .95 or higher.
The +90 is for landscape left rotation. If the game is in portrait mode remove the +90.
To get it to be more responsive/quicker/better make the timer smaller. (.1 is twice as fast as .2 etc.)
The slower the acceleration, the more precise the game will feel.
Hope that helps!