Touch issues

CaddoMoneyCaddoMoney Member Posts: 13
edited November -1 in Working with GS (Mac)
I have an actor that I am trying to move when a touch is received and follow that touch when released. I have the touch tracking working, but for some reason, when I touch outside of the actor, the actor "jumps" to that new position.

My rule is Actor receives event touch is inside

Constrain Attribute: self.Position.X to game.Touches.Touch 1.X

I've also tried adding an additional rule of Actor Receives event touch is pressed thinking that the two of them would help only move the actor when touched.

It seems that there's some step that I'm just not getting.

Comments

  • CaddoMoneyCaddoMoney Member Posts: 13
    I *think* that I might have fixed it - I had a Constrain Attribute set of self.Position.X to max(min( game.Mouse.Position.X ,480),0) taking that out seemed to help, the actor doesn't seem to move as quickly as before - is there anything else that I might be overlooking?
  • BeyondtheTechBeyondtheTech Member Posts: 809
    What do you mean by "follow that touch when released?" If there's no longer a touch to the display, I'm not sure it will know where to go. Are you looking for a dragging or swiping effect?
  • JGary321JGary321 Member Posts: 1,246
    Are you trying to get it to move or just appear where you touch?

    Constraining the X/Y to your Touch X/Y is going to make it Appear wherever you touch. If you want it to MOVE to the location you need to use the move command.
  • quantumsheepquantumsheep Member Posts: 8,188
    I'm looking at something similar to the Space Invaders Infinity Gene (http://itunes.apple.com/us/app/space-invaders-infinity-gene/id323665063?mt=8)

    The controls on that sound like what caddomonkey's asking for - essentially when you touch anywhere on the screen it used that point as the centre for a joystick. It's incredibly elegant but I'm not sure how you'd go about doing it in GS...

    Edit - actually, reading the original post again, it sounds nothing like what I described - sorry!

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • CaddoMoneyCaddoMoney Member Posts: 13
    Sorry, that made a little more sense in my head - it's been a long week. Just to try to clarify a bit - think of the actor as a pong paddle that only moves on the x axis. When the user touches it and moves their finger to the left, it should move to the left. When the user is touching it and drags their finger across to the right of the the screen, it should move to the right. If the user touches outside of the paddle area, it shouldn't move.

    So when touching the actor move the actor under the finger in the direction of the finger. When not touching the actor, but touching the screen, don't make the actor jump to the newly touched position on the screen.

    Does that make more sense? Like I said, it's been a long week ;)

    Slightly different from what qs brought up, but that sure would be chockfull of awesome if GS could do that as well.
  • JGary321JGary321 Member Posts: 1,246
    Just tested this:

    When touch is PRESSED
    constrain self.position X(or Y) to game.touches.touch1.X(or Y)

    This works perfectly for me =)
  • ktfrightktfright Member Posts: 964
    My game sort of plays like what you are trying to do. Its just like what JGary321 said.
  • CaddoMoneyCaddoMoney Member Posts: 13
    Thanks guys, it's working now - taking out the Constrain Attribute set of self.Position.X to max(min( game.Mouse.Position.X ,480),0) helped. I had that in there for testing on the mac so I could test without syncing the phone every time.
Sign In or Register to comment.