Drag and Drop on Wiki does not seem to work
DaveyJJ
Member Posts: 12
I set up a new project. 1024x768 iPad size. GS 0.8.7. I have two (square) actors set up with the Wiki script for drag and drop correctly set up. Put them in a scene and preview, and they will not not drag and move when the mouse is over them and clicked down and moved. What could be going wrong? This is incredibly frustrating, to say the least.
Comments
make sure you've put a number into Drag and Angular Drag (you might just only need Angular Drag, I don't know). For the test I gave them both 300 each. In the Actor's Rule, put When Actor receives event - touch is pressed, then Move attribute.
I guess you're after swipe as a touch; unfortunately I don't know how to do this yet, to be able to let you know.
;-)
---------------------------------------------------------------
Spiral Gyro Games
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Yesterday I made this to help JCFord out and it might have some relevance to what you are doing. I haven't taken a look at the Drag and Drop in the wiki but I would assume the result you want is something like this:
http://gamesalad.com/game/play/62234
Hope it helps.
Easy to do, but --- face/palm.
@gyroscope. I'm simply trying to do the drag and drop behaviour shown in the Wiki, to move an actor around with a click, drag, and drop. Not move to the mouse position. http://gamesalad.com/wiki/how_tos:gsc_drag_and_drop_movement
@RH. I will look at that later this evening. I have followed the Wiki to the letter though. I also do not need physics etc. This is simply to click to drag and move a playing piece from location A to location B, where it stays after I release the mouse/touch.
PS RH: neat demo; Think I'll have a go at making the outside of the container collidable, out of interest, so it stops the dragged actor...
PPS I've just done the Drag & Drop Wiki and it's working OK. I'll publish it if you like, so you can compare the game files. i'll let you know the link as soon as I know.
---------------------------------------------------------------
Spiral Gyro Games
Added: Here you go: http://gamesalad.com/game/play/62471
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Here's my test project I created this morning. Not working.
http://gamesalad.com/game/play/62542
(and just to be clear, this is the actor in the library - the prototype.)
Create a boolean Attribute, called something like 'dragging' (without the quotes).
Create two Rules, like this:
Rule
When all conditions are valid:
Touch is pressed
-----Change Attribute: self.dragging To: true
otherwise
-----Change Attribute: self.dragging To: false
Rule
When all conditions are valid:
self.dragging = true
-----Constrain Attribute: self.Position.X To: Mouse.Position.X
-----Constrain Attribute: self.Position.Y To: Mouse.Position.Y
(Mouse Position is located in the Devices section.
Also, Mouse gets translated to Touch on a device)
That will do the trick!
Hope this helps!
Joe
EDIT:
So I looked at your project.
First, you should put code in the actor in the Library - Not in the Scene. I would delete that Actor in the Scene. Put all of your code into the one in the Library, then drag it out into the Scene again.
The reason why your code is not working is because in the second Rule, you are using Change Attributes instead of Constrain Attributes. If you change them to Constrain Attribute behaviors, it will work. However, I still recommend putting the code in the prototype (the one in the Library) only. That padlock you clicked on in the Actor is there for a reason.