How to determine mouse direction?
I am needing to know how I would determine which way the player is dragging. Not dealing with position in scene space. But rather is the mouse dragging to the left or to the right?
Thank you.
Thank you.
Comments
Then a Rule, when DragXPos > XPos
---do your stuff
otherwise
----do your stuff
Don't forget to add a Rule:
When touch is released,
Change attribute XPos to draggedActor.Position.X
Hope that helps you and it works out.
----------------------------------------------
http://davidgriffinapps.co.uk/
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
On area actor
when touch is pressed turn a boolean on
otherwise turn it off
On draggable actor
when boolean is true
move with the mouse by use of the offset method
Now what I'm wanting to do is determine which way the draggable actor is moving. This is slightly more difficult than I expected because there is no velocity on the draggable actor. So determining which direction it's moving, I would guess needs to deal something with position.
But then that presents another problem cause what if the actor is on the right side of the scene but I want to tell it no you're moving to the left?
I don't know if that cleared it up any?
Here's a demo on swipe that may be illuminating as well.
Edit: Just read your comment about velocity. Have you checked linear velocity already? It should detect it, even if the draggable actor itself doesn't have a velocity behavior.
Make two real attributes
Draggable Actor X
Mouse Click X
Constrain draggable actor X to draggable actor's self.position x
When mouse is click, change game.mouse.click x to device mouseclick x (hopefully this registers the mouse click)
Then, if game.actor x > game.mouse click - going right (so on and so forth)
Untested.
But these thoughts are definitely pushing me in the right direction.
create 4 real self attributes
self.X1
self.Y1
self.X2
self.Y2
every 0 seconds
change attribute self.x2 to self.x1
change attribute self.y2 to self.y1
change attribute self.x1 to self.positionX
change attribute self.y1 to self.positionY
(outside of the timer)
if X2 is > X1
change self.goingright to true
otherwise
change to false
if y2 is > y1
change self.going up to true
otherwise
change to false
----------------------------------------------
http://davidgriffinapps.co.uk/
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Thank you so much everyone!