How to make a hit box?

jobeijobei Member Posts: 39
edited June 2012 in Working with GS (Mac)
I want to touch a image on the right side of the screen making another image to pop up on the left side of the screen.

Best Answers

  • kinzuakinzua Posts: 554
    Accepted Answer
    @jobei if you want to control the pop-up location, specify the X,Y coordinates of where u xpct it to be
  • tenrdrmertenrdrmer Posts: 9,934
    Accepted Answer
    @jobei

    Stop Rejecting answers just because you don't understand them. This thread is being dropped from a Q@A to a discussion due to your misuse of the feature. you have had 2 different ways explained and both are useable ways of doing this. If your not understanding them then you need to think about taking a step and watching some more tutorial videos to get a better grasp on how gamesalad works.

Answers

  • simo103simo103 Member, PRO Posts: 1,331
    @jobei .. first thing you will need to do is to have the first image 'talk' to the other images and that is achieved thru a game.ButtonPressed attribute which could be type boolean. Then put in your first actor a rule:
    if touch is pressed change attribute game.ButtonPressed to true.

    In you second action you would put a rule:
    if attribute GameButtonPressed is true .... and then you have a number of choices.
    1. The actor could be in the spot you want it but with its Alpha set at 0 (ie: transparent) then the rule would change attribute self.color.alpha to 1
    2. You could have the second actor off scene and the rule would trigger it either sliding in (interpolate) or just jumping instantly to the position you want by changing it's x and Y position
  • jobeijobei Member Posts: 39
    I see what you are saying, but I'm still having a lil trouble with this. How would it work if I put two actors in the same place?
    I want to make a small box over top of a big actor image. So when i touch the box the second actor pops up in the same spot.
    Im not sure if we can do that tho?
  • jobeijobei Member Posts: 39
    I've been working on this all day , and it still not working .

    Let try this, I have two actors on my screen right now. actor A and actor B . I set it up already were actor A is on the left side of the screen and actor B is on the right. I want to be able to touch actor A and that will make actor B destroy.

    If this work right I should be able to move actor A all around the screen and when I touch it, it will always destroy actor B.

    Can anyone help me with this code? :P
  • jobeijobei Member Posts: 39
    here is a demo file for you
    its a mac file so i hope your on mac lol

    https://us.v-cdn.net/5017598/uploads/FileUpload/99/9070909e9664f814fe39f6331ee1d0.zip
    lol aww man, sorry I dont have a mac. I'm using the windows, is there anyway i can get it on windows?

  • master200012master200012 Member Posts: 372
    I'm not a Windows user, but if you have what I'm saying, go for it.

    1. Create a game attribute (boolean) called "hit"
    2. Inside actor A, create a rule that says:
    When all of the following is true:
    Touch is inside
    constrain attribute: self.position.x to devices.mouse.position.x
    constrain attribute: self.position.y to devices.mouse.position.y
    change attribute: game.hit to true (spell it out :P)

    3. Now, inside actor B, create a rule that says:
    When all of the following is true:
    game.hit (attribute) is true
    Destroy this actor.

    Hope this gets you the result you want!
  • jobeijobei Member Posts: 39
    I'm not a Windows user, but if you have what I'm saying, go for it.

    1. Create a game attribute (boolean) called "hit"
    2. Inside actor A, create a rule that says:
    When all of the following is true:
    Touch is inside
    constrain attribute: self.position.x to devices.mouse.position.x
    constrain attribute: self.position.y to devices.mouse.position.y
    change attribute: game.hit to true (spell it out :P)

    3. Now, inside actor B, create a rule that says:
    When all of the following is true:
    game.hit (attribute) is true
    Destroy this actor.

    Hope this gets you the result you want!
    I try it , still didnt work, but thanks tho.

    When I make my rule it say "When all following is happening." it don't say "When all the following is ture" Is that the main reason why it don't work?




  • jobeijobei Member Posts: 39
    This is what I have...

    Inside actor A I created a rule:
    When all of the following are happening: (then i drag attribute into the rule and it turn into "If " with a empty box in front of it) (Then I made a "boolean" and named it "hit")

    if self.hit is true:
    touch is inside:
    do:
    constrain Attribute:
    constrain: self.position.x
    to: self.touch.position.x
    constrain Attribute:
    constrain: self.position.y
    to: self.touch.position.y

    (I made all the constrain attribute under "boolean")

    Inside actor B I created a rule:
    When all of the following are happening:
    if self.hit is true:
    do:
    destroy:


    Then when I go to play the screen, actor B is already gone with out me touching actor A to set off the action to destroy actor B.




  • jobeijobei Member Posts: 39
    This is what I have...

    Inside actor A I created a rule:
    When all of the following are happening: (then i drag attribute into the rule and it turn into "If " with a empty box in front of it) (Then I made a "boolean" and named it "hit")

    if self.hit is true:
    touch is inside:
    do:
    constrain Attribute:
    constrain: self.position.x
    to: self.touch.position.x
    constrain Attribute:
    constrain: self.position.y
    to: self.touch.position.y

    (I made all the constrain attribute under "boolean")

    Inside actor B I created a rule:
    When all of the following are happening:
    if self.hit is true:
    do:
    destroy:


    Then when I go to play the screen, actor B is already gone with out me touching actor A to set off the action to destroy actor B.


    Another thing, I don't know to much about the constrain attribute, but I dont want to move either of my actors. I have them already set up on the screen were I want them. I just want to be able to touch actor A making actor B destroy.



  • jobeijobei Member Posts: 39
    @jobei

    Stop Rejecting answers just because you don't understand them. This thread is being dropped from a Q@A to a discussion due to your misuse of the feature. you have had 2 different ways explained and both are useable ways of doing this. If your not understanding them then you need to think about taking a step and watching some more tutorial videos to get a better grasp on how gamesalad works.

    Oh i didnt know that , I thought by rejecting them was letting someone know im still having trouble. My bad, I'll leave them alone. trust me I been watching almost every tutorial i could find on youtude and a lot of them do helps but , it just hard because there's not really any tutorial for windows gamesalad.

Sign In or Register to comment.