Need Help Please!!! Swipe right to move left!?
bora
Member, PRO Posts: 45
Hi,
i made a gallery with a width of over 2000 px and i want move the cam like i scroll the background.
How can i do that?
I have an Actor that controll the cam whit this rule:
Touch is pressed
(Change Attribute) self.offset to self.Position.Y-game.Mouse.Position.Y
(Constrain Attribute) self.Position.Y to game.Mouse.Position.Y+self.offset
That works fine but not inverted (offset is an attribute (real))
Thanks!
i made a gallery with a width of over 2000 px and i want move the cam like i scroll the background.
How can i do that?
I have an Actor that controll the cam whit this rule:
Touch is pressed
(Change Attribute) self.offset to self.Position.Y-game.Mouse.Position.Y
(Constrain Attribute) self.Position.Y to game.Mouse.Position.Y+self.offset
That works fine but not inverted (offset is an attribute (real))
Thanks!
Comments
Heres a tip, its more complicated than you think it is, because you have to mimic the effect that happens when you swipe and then release the screen (the screens momentum keeps it moving).
UNLESS, you don't care and you just want the screen to stop immediately after the players finger loses contact with the screen.
In which case, there are several ways you can do that.
I have a easier suggestion though.
Just have the right and left sides of the screen act as a movement button. When the left side is pressed, have the screen move to the left and when the right side is pressed have it move to the right.
To do this:
Create a box, throw it in the center of the scene, make its alpha 0 and have it control the camera.
Inside that actor create a rule (all):
When game.Touch1.X > (half screen width) and game.touchCount > 1 and self.Position.X < 1800 (or wherever your image ends minus half the screen width):
Constrain attribute self.linearVelocity.X to 50 (or whatever speed you want)
create a duplicate of this rule for the inverseWhen game.Touch1.X < (half screen width) and game.touchCount > 1 and self.Position.X > (half the screen width):
Constrain attribute self.linearVelocity.X to -50 (or whatever speed you want)
When you press the screen and the location you press is less than half the screen width, it will move that box to the left, if its higher than half the screen width it will move to the right. That box is invisible, and controls the camera, so the camera will follow it and no one will know its there.
Inside the actor create real attribute call positionOffset
Touch is pressed
(Change Attribute) self.offset to self.Position.Y-game.Mouse.Position.Y
(Change attribute) self.positionOffset to
game.Mouse.Position.Y
(Constrain Attribute) self.Position.Y to ((game.Mouse.Position.Y-self.postionOffse)*-1)+self.offset+self.positionOffset
Tell if is it you want.
Thanks!
http://forums.gamesalad.com/discussion/52054/free-ipad-cover-flow-with-snap#latest
hippikon this is exactly what i want!
Thanl You very much >-