Touch, drag, destroy while touch still on

beaudoin_nbeaudoin_n Member Posts: 184
edited November -1 in Working with GS (Mac)
Hi

I am having some problems with my object

Basically it moves when touched (inside) and contraints to x y of touch
when it collides it gets destroyed
And i have a spawner that will spawn that same actor again (on its initial position)

It seems to work well for 1 or 2 times, bu then it gets to either dissapear or just always follow my touch.

I want the player to have to touch the object drag it somewhere.. then when another one appears they need to lift the touch (or at least go back to move on the object position) to reselct the object and drag it again.

I want this to work with iPhone that is why i used the touch instead of the mouse button...

Thanks

Merry Christmas to all

Comments

  • beaudoin_nbeaudoin_n Member Posts: 184
    Ok still not working after trying different things... also noticed that if i move the mouse too quickly i lose my constraint (the object stops moving)

    I don't know how to attach a file here but i'd really like to have some more info on how to achieve this.

    Thanks all in advance

    (btw i used tshirtbooth's ddd.zip file to start up... thanks for all your contributions to this community tshirtbooth!)
  • beaudoin_nbeaudoin_n Member Posts: 184
    OK so here is my object logic

    rule "assign selected"
    when all are valid
    when actor receives touch is inside
    change attribute "game.selected" to true

    rule "move"
    when all are valid
    when actor receives touch is inside
    when "game.selected" = true
    constrain attribute self.position.x to game.touches.touch 1.x
    same for Y

    Then i have 2 checks for collision with objects that go like this
    when actor collides with actore of type "a"
    change attribute "game.selected" to false
    destroy object
    change attribute "game.object" = false
    assign score
    otherwise
    change attribute "game.selected" to false
    destroy object
    change attribute "game.object" = false

    My spawner object
    when game.object = false
    spawn actor (the previous one)
    assign "game.selected" = false
    assign "game.object" = true

    do you see anything wrong in this ?
  • beaudoin_nbeaudoin_n Member Posts: 184
    Ok i uploaded my test code here

    http://gamesalad.com/game/play/32329

    Still no luck getting it to work... to see how it fails easily simply drag the little square to the right and see that then the spawned object returns to its original place... then grag again and keep the mouse button down.. the newly spawned object will be binded to the location you have now. I want the spawned object to always appear at the same place.

    Thanks for your help all.
Sign In or Register to comment.