Left and right touch controls

Fredrik BixoFredrik Bixo Member Posts: 239
edited July 2012 in Working with GS (Mac)
Hello there,

I have tried this by myself but it don't works as i want it to. when I press on the half right side on the screen the actor goes right and left the same. But If i press the right side as an example when left is already pressed it don't works and same with the right. It's like it does not Recognize it.

My rules:

when mousebutton is down and mouse position is < 240 go right. when mouse button is down and mouse position is > 240 go right.

What am I'm doing wrong? I want it to move even when the you have two fingers on the screen.

Thanks,
Fredrik

Best Answer

Answers

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Go to my website http://gleesongroupmedia.com/gsguide/gsguide.html

    Go to templates and download the jump controls. How it works is left and right movement and when you have say right pressed and press left it will issue a jump command. Same basic idea and you don't have to use the jump part.
  • Fredrik BixoFredrik Bixo Member Posts: 239
    edited July 2012
    No if I understand you right thats not exactly what I'm looking for.

    I can send an image of my rules:

    image

    This is the right actor.its a invisible actor thats is on the right half of the screen. I have a left actor also that is the same only that I have swapped the "constrain attribute". It works with just change attribute also I just tested me around a little bit :D
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited July 2012
    Yes it's the same download the template all the stuff on my site is free. Of course you have to release one side to go in the other direction why would you want your character trying to go in two directions at the same time?
  • Fredrik BixoFredrik Bixo Member Posts: 239
    Becouse sometime you not remove your finger from the screen before you press to the other side and then you continue to move and the controls feels a little bit laggy.

    I just want my actor to move to where the latest touch is pressed NOT to where the first touch is pressed :)
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Then use multi touch to design them.
  • Fredrik BixoFredrik Bixo Member Posts: 239
    Yeah right but how? :)
  • Fredrik BixoFredrik Bixo Member Posts: 239
    edited July 2012
    Ok this is what I come up with. Is working pretty good. The only thing is that after you have pressed on the screen two times or more its not working and its starting to go to the wrong direction.https://dl.dropbox.com/u/3282996/touch.zip

    Any ideas someone?
  • MotherHooseMotherHoose Member Posts: 2,456
    @gameARN

    you are trying this with a mouse down condition …
    a desktopComputer responds to each mouse/touch as a separate condition

    the devices have multiple touch conditions
    for actual gamePlay to verify that user is touching with another touch on screen
    … you will have to code that way and test with GS Viewer or in an ad hoc build

    in your image of Rules… when touch is pressed
    it is only constraining when touch is active
    thus when touch is released the Otherwise: section of the rule triggers

    try:
    - gameAttribute for touchState (touch is R or L) … index type … 1 = R; 2 = L

    on sensorActor
    Rule: when
    Event: touch is pressed
    -Rule: when
    -Attribute: touch1.Position.X > 240
    -changeAttribute: touchState To: 1
    -Otherwise:
    --changeAttribute: touchState To: 2
    Otherwise:
    changeAttribute: touchState To: 0

    on the actor that the touch is controlling
    have a Rule for each touchState (0; 1; 2)

    quick look/see demo: http://www.mediafire.com/?pgcdcb0pwtfvrki

    @};- MH
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited July 2012
    Keep trying stuff out and think about it, this is who you learn. You'll be better off in the future than jumping on the forum after only trying for 20 minutes. If you really want to be better in GS once someone points you in the right direction put in some real effort and if after giving it some serious thought then come back. I won't be doing you any favors if I write this code for you.
  • Fredrik BixoFredrik Bixo Member Posts: 239
    edited July 2012
    hey guys I fixed it. dont know really what I did but in some way I fixed it. Thank you guys for you help and Im really glad you helped me :) haven't tested motherhoose way yet. but thank you anyway!
Sign In or Register to comment.