Having a User Drag Actors
Conifer_Apps
Member Posts: 100
Alrighty - I'm not completely positive that this question hasn't been asked before, but I'm not sure. Before I explain the problem, I'll explain what I need to happen. When a user of this game clicks a button, an actor is spawned. The user can then drag the actor to where they want it. When the "GO" button is pressed, gravity is enabled and the actual game part of my game is commenced.
What I need to happen is I need a way to have the user be able to manipulate this actor's position on the screen. Essentially, the user is dragging a square actor around. How can you constrain two attributes' X and Y values to that of the position of a finger? Thanks so much! :-) =D>
What I need to happen is I need a way to have the user be able to manipulate this actor's position on the screen. Essentially, the user is dragging a square actor around. How can you constrain two attributes' X and Y values to that of the position of a finger? Thanks so much! :-) =D>
Best Answer
-
tatiang Posts: 11,949The place to start would be Googling drag actor gamesalad. But I'll go ahead and give you a head start:
When touch is pressed
Constrain self.Position.X to game.Mouse.Position.X
Constrain self.Position.Y to game.Mouse.Position.Y
(game.Mouse.Position attributes are in the Devices section of the attribute drop-down menu in the expression editor.)New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Answers
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User