Touch Problem ... Please help!!

jerlant360jerlant360 Member Posts: 82
edited October 2012 in Working with GS (Mac)
Hi i'm working on a game where to shoot i have to touch the background , but also i have to tap others enemies to destroy them , the issue is that when i tap over enemies my actor shoot as if i were touching the background

What can i do for when i tap over the enemies my main actor don't shoot?

Thanks

Comments

  • KangavarkKangavark Member Posts: 62
    Try placing the enemies layer on top of the background layer/shoot button so whenever you tap an enemy, it will be touched and the background won't?
  • jerlant360jerlant360 Member Posts: 82
    Thanks man but it didn't work :s
  • gamesfuagamesfua Member Posts: 723
    edited October 2012
    Can you explain first, why you have to touch the background. Why does it have to be the background and not some kind of button. This will help to know. Thanks!
  • jerlant360jerlant360 Member Posts: 82
    I wanted to touch the background because is more comfortable be free to touch anywhere to shoot than touch a fixed button.

    my game is a shoot em up.
    Can you explain first, why you have to touch the background. Why does it have to be the background and not some kind of button. This will help to know. Thanks!
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I had made a demo for this but I can't seem to find it. If you add a rule to your enemy actors that says When Touch is Pressed change attribute game.touchingEnemy to true; Otherwise change attribute game.touchingEnemy to false and then add a rule to your background that says When attribute game.touchingEnemy is false --> shoot bullets, etc., it should work.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • gamesfuagamesfua Member Posts: 723
    Okay this is a really wild suggestion IF tatiang's great idea doesn't work for you. What if you do this... Create an invisible basic actor (square). Make a rule that says when user taps anywhere constrain invisible actor to mouse point (where finger is). So in theory a square is being put on screen wherever you put your finger (but make sure its invisible). When finger tap is released ensure the invisible actor goes back off screen.
    So heres my thinking. You can now say, IF invisible actor overlaps enemy then do X. If invisible actor is not touching enemy then do Y. I think this might work. Let us know how it all goes! Good luck!
  • jerlant360jerlant360 Member Posts: 82

    Thanks guys I really appreciate your help thanks a lot , but I think I'm going to put a button to simplify all my work hahaha





    I had made a demo for this but I can't seem to find it. If you add a rule to your enemy actors that says When Touch is Pressed change attribute game.touchingEnemy to true; Otherwise change attribute game.touchingEnemy to false and then add a rule to your background that says When attribute game.touchingEnemy is false --> shoot bullets, etc., it should work.
    Okay this is a really wild suggestion IF tatiang's great idea doesn't work for you. What if you do this... Create an invisible basic actor (square). Make a rule that says when user taps anywhere constrain invisible actor to mouse point (where finger is). So in theory a square is being put on screen wherever you put your finger (but make sure its invisible). When finger tap is released ensure the invisible actor goes back off screen.
    So heres my thinking. You can now say, IF invisible actor overlaps enemy then do X. If invisible actor is not touching enemy then do Y. I think this might work. Let us know how it all goes! Good luck!
  • gamesfuagamesfua Member Posts: 723
    Sometimes the easier approach is the better approach. That said, my idea I think works. I'm pretty sure I had tested it in the past. I'm also very sure @tatiang is right as well! Either way, good luck!
Sign In or Register to comment.