How To Set Actor Touch Position

tanchowyeeiosapptanchowyeeiosapp Member, PRO Posts: 36

I'm newbie on gamesalad, can everyone help for this?

http://postimg.org/image/3rniw212n/

I already set the actor able to move anywhere, and the picture show is one actor only.

Now when I touch A and B the actor also can move, but I want seperate only touch A can move, if touch B the actor will not move. What should I to do?

....

Comments

  • ArmellineArmelline Member, PRO Posts: 5,331

    Are A and B both using the same actor and same image, or two different actors and two different images?

  • tanchowyeeiosapptanchowyeeiosapp Member, PRO Posts: 36

    Armelline, A & B is same actor, also use 1 image, that mean same image...

  • ArmellineArmelline Member, PRO Posts: 5,331
    edited July 2015

    Then they will always move together. You need to split them into two actors in order to have them move independently.

    If you want both to move when you touch A (but not when you touch B), add a condition saying something like "When touch is pressed and touch.position.y > self.position.Y+100", that will mean only touches near the top are registered.

    If you're trying to make B swing like a rope though, that's not very easy but there are tutorials out there.

  • tanchowyeeiosapptanchowyeeiosapp Member, PRO Posts: 36

    Armelline, I have try seperate 2 actor before, one is for A and one is for B, I also need A & B move togather when I touch A, but how to join the actor A and B togather?

  • tanchowyeeiosapptanchowyeeiosapp Member, PRO Posts: 36

    Armelline, I know swing like a rope is very difficult for newbie, I just want to know how actor A and Actor B combine togather...

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    @tanchowyeeiosapp said:
    Armelline, I know swing like a rope is very difficult for newbie, I just want to know how actor A and Actor B combine togather...

    You just admitted you're in over your head and then ask Him to code it for you like that is easy to explain. you see the contradiction in your question there, right? It's always best to be building projects at or just above your level of knowledge. you don't learn anything by having people do your work for you. If you're really serious about being a developer you can't skip the important steps of learning.

  • tanchowyeeiosapptanchowyeeiosapp Member, PRO Posts: 36

    The_Gamesalad_Guru: Forum is for asking question, something you don't know you can ask here, that is no problem, I ask the question here, because I want to learn, you thing just 2 actor can do all my work, just 2 actor can complete all the game project?

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    As he said there are tutorials out there you can watch that can explain it all. some things can't just quickly be explained in a forum post.

  • tanchowyeeiosapptanchowyeeiosapp Member, PRO Posts: 36

    The_Gamesalad_Guru, I think you want invite me to join your course? right?

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    @tanchowyeeiosapp said:
    The_Gamesalad_Guru, I think you want invite me to join your course? right?

    I have no course and all my videos are free

  • tanchowyeeiosapptanchowyeeiosapp Member, PRO Posts: 36

    So, I ask question here, do you have any solution?

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    I do but it would take me too long to type it all out as it's not easy to explain.

  • tanchowyeeiosapptanchowyeeiosapp Member, PRO Posts: 36

    The_Gamesalad_Guru you have reply this post 3 time, so do you have any solution to the topic? "How To Set Actor Touch Position"

  • KevinCrossKevinCross London, UKMember Posts: 1,894

    Not sure I fully understand this question but let's see how far off I am.

    You want actor B to follow actor A when actor A is touched but you want to keep the distance between the two the same when you're dragging A? Is that correct? And I'm guessing you want the same to happen if you drag actor B. You want A to follow but at the same distance it was at before the drag started?

  • tanchowyeeiosapptanchowyeeiosapp Member, PRO Posts: 36

    @KevinCross said:
    Not sure I fully understand this question but let's see how far off I am.

    You want actor B to follow actor A when actor A is touched but you want to keep the distance between the two the same when you're dragging A? Is that correct? And I'm guessing you want the same to happen if you drag actor B. You want A to follow but at the same distance it was at before the drag started?

    The image I show you below is only 1 actor not 2 actor...
    http://postimg.org/image/3rniw212n/

    The image show that A & B actor position,

    • What I want is only people touch A position, the actor can detect,
    • If people touch B position, I don't want the actor to detect.

    You clear for the above explain? if not I will explain again...

  • KevinCrossKevinCross London, UKMember Posts: 1,894

    I can't view that image at work as the site is listed as one that often hosts adult related images.

    And no it's not so clear now. Which is a shame as I wrote out the code to have the actors drag behind each other based on my understanding of your question.

  • KevinCrossKevinCross London, UKMember Posts: 1,894

    Will have another go...

    You've got one actor, and if they press one side/half of the actor you want to register the touch and do something, but if they touch the other side of the same actor you want to ignore the touch

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited July 2015

    If touch is inside and Touches.Touch 1.X <= self.Position.X + (self.Width / 2)
    ...Constrain Attribute: self.Position.X = Touches.Touch 1.X
    ...Constrain Attribute: self.Position.Y = Touches.Touch 1.Y

    That should register touches on the left half of the actor. You can do the same with Mouse Position.X or whatever it's called.

    I'm not near GameSalad to try this so I can't guarantee this will continue working when you're dragging the actor around the scene.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879

    I think this is what you are after:

    When (all)
      Event: Touch is pressed
      Expression: game.Mouse.Position.Y- self.Position.Y > 100
          Change Attribute: self.yOffset To: self.Position.Y - game.Mouse.Position.Y
          Constrain Attribute: self.Position.X To: game.Mouse.Position.X
          Constrain Attribute: self.Position.Y To: game.Mouse.Position.Y + self.yOffset
    
  • tanchowyeeiosapptanchowyeeiosapp Member, PRO Posts: 36

    I have capture the video here, everyone can help me this?

    I'm not well speaking English, Sorry for the broken english,

    Here the video:

    Here the Rule screenshoot, I set for the 3 actor
    http://s1219.photobucket.com/user/cyee19862/media/Rule.jpg.html

    ...

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879

    Merged the duplicate threads.
    (Please don't duplicate threads. Just bump the original one when an appropriate amount of time has passed.)

  • tanchowyeeiosapptanchowyeeiosapp Member, PRO Posts: 36

    @RThurman said:
    Merged the duplicate threads.
    (Please don't duplicate threads. Just bump the original one when an appropriate amount of time has passed.)

    You know how to solve this problem? Because I think many people don't understand what I say before, so I capture the video...

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879

    Yes, I know how to solve the problem. And I gave an answer. Look at the posting just before the video.

  • tanchowyeeiosapptanchowyeeiosapp Member, PRO Posts: 36

    @RThurman said:
    I think this is what you are after:

    When (all)
      Event: Touch is pressed
      Expression: game.Mouse.Position.Y- self.Position.Y > 100
          Change Attribute: self.yOffset To: self.Position.Y - game.Mouse.Position.Y
          Constrain Attribute: self.Position.X To: game.Mouse.Position.X
          Constrain Attribute: self.Position.Y To: game.Mouse.Position.Y + self.yOffset
    

    RThurman, I newbie, I just learn the gamesalad around 2 week, avobe rule you tell me, I'm not very understand...

    I have set the first rule: Actor receives events: "touch" is "Pressed"
    Here the screenshoot: http://s1219.photobucket.com/user/cyee19862/media/1_1.jpg.html

    But I don't know how to set "Expression: game.Mouse.Position.Y- self.Position.Y > 100"

    Can you tell me more detail how to set this second rule?...

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879

    Here is a GameSalad example to study.

    Click the mouse near the top of the actor and it moves. Touch too low and the actor won't move.

  • tanchowyeeiosapptanchowyeeiosapp Member, PRO Posts: 36

    @RThurman said:
    I think this is what you are after:

    When (all)
      Event: Touch is pressed
      Expression: game.Mouse.Position.Y- self.Position.Y > 100
          Change Attribute: self.yOffset To: self.Position.Y - game.Mouse.Position.Y
          Constrain Attribute: self.Position.X To: game.Mouse.Position.X
          Constrain Attribute: self.Position.Y To: game.Mouse.Position.Y + self.yOffset
    

    Hi, RThurman, for starting I really not familier to gamesalad, but I have no chooise, I need to try again the rule above, now I follow what you say to set the rule, Thank You Very Much RThurman, You Are you Are Awesome!!!

  • tanchowyeeiosapptanchowyeeiosapp Member, PRO Posts: 36

    @RThurman said:
    Here is a GameSalad example to study.

    Click the mouse near the top of the actor and it moves. Touch too low and the actor won't move.

    Really Really Really, Thank You very much, @RThurman

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879

    You are very, very welcome!

  • tanchowyeeiosapptanchowyeeiosapp Member, PRO Posts: 36

    @RThurman said:
    I think this is what you are after:

    When (all)
      Event: Touch is pressed
      Expression: game.Mouse.Position.Y- self.Position.Y > 100
          Change Attribute: self.yOffset To: self.Position.Y - game.Mouse.Position.Y
          Constrain Attribute: self.Position.X To: game.Mouse.Position.X
          Constrain Attribute: self.Position.Y To: game.Mouse.Position.Y + self.yOffset
    

    Hi, @RThurman, Last time you help me set the above rule, everyting work well, Now I can touch position A move around without problem. I have another question about this, I also need only position A "Overlaps or Collides" something only A Position can detect, if B position touch something, B will not detect, can I know what should I to set for this?...

    http://postimg.org/image/3rniw212n/

    ...

Sign In or Register to comment.