!Help! Need to Spawn 2x actor 2 after destroying actor 1

dabbuhldabbuhl Member, PRO Posts: 52
edited February 2014 in Working with GS (PC)
I am working on a game. I have actor 1, I made a rule that when you touch or mouse is pressed on actor 1, Spawn actor 2 (actually spawn 2 copies of actor 2), which does work, then destroy actor 1, this also works. So, when you click on actor 1, 2 actor 2s appear and actor 1 disappears. I wanted to add in multiple actor 1 to the scene, but when I do this, (let's say I have 4 copies of actor 1 on the scene) if I click on any of the actor 1, all of them spawn 2 copies and then destroy. I only want the one that I am clicking or touching to do this rule independent of the other actor 1s on the screen.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    This all depends on what your rule conditions is, which you didn't say. When Touch is Pressed means that the actor is clicked/tapped on, while When mouse is down means that anywhere on the scene is clicked/tapped. Which condition are you using? Try When Touch is Pressed.

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

  • dabbuhldabbuhl Member, PRO Posts: 52
    I am using the windows game salad to make an iphone game. When I preview the game and use only the rule, when Touch is pressed, nothing happens but when I use Mouse is Down, actor 1 does destroy and 2 actor 2s appear. The only problem is that all actor 1s do this action and not independently. So, if I remove Mouse is Down, how can I test within the preview for the Touch is pressed? am I doing something wrong with the rule Touch is pressed to make it not seam to work.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Touch is pressed works in Windows or on a mobile device, as does when mouse is down.

    You need to use when touch is pressed or when touch is inside. If it doesn't work, post a screenshot of your rules or type them out exactly as they are and we'll go from there.

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

  • dabbuhldabbuhl Member, PRO Posts: 52
    edited February 2014
    If I wanted 20 independent actor1, I wouldn't have to make actor1.1, actor1.2, actor1.3, and so on just to have independence would I? I'm thinking that each one should be able to be clicked on and act independent if I have 1 or 100 copies. They should not ALL spawn actor2 and destroy if any 1 actor1 is pressed or mouse is clicked. Kind of like an asteroids game where there are multiple big rocks that, when shot, turn into 2 medium rocks. I will post a screenshot when I get home tonight. Thanks for the help.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    If I wanted 20 independent actor1, I wouldn't have to make actor1.1, actor1.2, actor1.3, and so on just to have independence would I? I'm thinking that each one should be able to be clicked on and act independent if I have 1 or 100 copies. They should not ALL spawn actor2 and destroy if any 1 actor1 is pressed or mouse is clicked.
    You're right. You just make a single "prototype" actor and then copy or spawn it multiple times on the scene. Each actor copy follows the prototype rules that check to see If Touch is Pressed. If you use an If Touch is Pressed rule and click on one of the actors, only that actor should spawn two new actors. To verify this, you can add a Log Debugging Statement and then open the Debugger window... you should see a single statement appear when you click on one of the actors. If all of the actors are responding to the rule, you will instead see that many statements (e.g. if you have 15 actors, you'll see 15 statements appear on after another).

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

  • dabbuhldabbuhl Member, PRO Posts: 52
    If I wanted 20 independent actor1, I wouldn't have to make actor1.1, actor1.2, actor1.3, and so on just to have independence would I? I'm thinking that each one should be able to be clicked on and act independent if I have 1 or 100 copies. They should not ALL spawn actor2 and destroy if any 1 actor1 is pressed or mouse is clicked.
    You're right. You just make a single "prototype" actor and then copy or spawn it multiple times on the scene. Each actor copy follows the prototype rules that check to see If Touch is Pressed. If you use an If Touch is Pressed rule and click on one of the actors, only that actor should spawn two new actors. To verify this, you can add a Log Debugging Statement and then open the Debugger window... you should see a single statement appear when you click on one of the actors. If all of the actors are responding to the rule, you will instead see that many statements (e.g. if you have 15 actors, you'll see 15 statements appear on after another).
    So if I made a prototype of actor1 and it works correctly, then added 20 actor1 onto the screen, and when pressed, they all react to the rule, what could be the problem?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    If it doesn't work, post a screenshot of your rules or type them out exactly as they are and we'll go from there.
    So if I made a prototype of actor1 and it works correctly, then added 20 actor1 onto the screen, and when pressed, they all react to the rule, what could be the problem
    Here's the hard part about helping people on the forums: I really can't answer that without a screenshot or without seeing the rules verbatim. Just saying "I made a prototype" and "they all react to the rule" doesn't let me see what you're seeing. And there's either something wrong in the way you coded it (likely) or it's a bug (unlikely).

    At this point, it would be quicker for me to just preview the file and see why it's not working. Can you compress the project file as a .zip, upload it to a file-sharing service such as Dropbox or MediaFire, and then send me the link to download it (via private message or post it here)?


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

  • dabbuhldabbuhl Member, PRO Posts: 52
    If it doesn't work, post a screenshot of your rules or type them out exactly as they are and we'll go from there.
    So if I made a prototype of actor1 and it works correctly, then added 20 actor1 onto the screen, and when pressed, they all react to the rule, what could be the problem
    Here's the hard part about helping people on the forums: I really can't answer that without a screenshot or without seeing the rules verbatim. Just saying "I made a prototype" and "they all react to the rule" doesn't let me see what you're seeing. And there's either something wrong in the way you coded it (likely) or it's a bug (unlikely).

    At this point, it would be quicker for me to just preview the file and see why it's not working. Can you compress the project file as a .zip, upload it to a file-sharing service such as Dropbox or MediaFire, and then send me the link to download it (via private message or post it here)?


    Here is a link to my dropbox with the game as I have it now:

    https://dl.dropboxusercontent.com/u/43145818/bubble.zip

    If you look in the attributes of the Bubble_large, you will see that I have it set to touch is pressed and to spawn 2 Bubble_medium, then destroy (this would basically be like asteroids by touching a Large bubble, it spawns 2 new Medium bubbles) but it does nothing. If I add the Mouse Down, it will do this function but all the large bubbles then do the function and not independently (which from all my reading is what should happen). So, why doesn't the touch is pressed work?

    Also, if you change the Bubble_large Physics, collision shape to Circular, the bubbles just kind of stick to the walls. If you leave it to Rectangle (normal setting) it will bounce but if it is at the corner of the graphic (which is a square) it will bounce but looks like it is not touching.

    Please let me know if you can help.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited February 2014
    This is what your rule looks like:

    image

    You'll notice that the rule conditions you have are When Touch is Pressed OR Mouse button is Down.

    To explain, let me hand it over to someone who really knows about this stuff:
    When Touch is Pressed means that the actor is clicked/tapped on, while When mouse is down means that anywhere on the scene is clicked/tapped. Try When Touch is Pressed.
    You used both conditions which means that any time the person clicks anywhere on the scene, the actor with that rule will split into two new actors. You need to remove the Mouse button is down condition. With Touch is Pressed alone, it does work on Mac Creator at least:

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

  • dabbuhldabbuhl Member, PRO Posts: 52
    This is what your rule looks like:

    image

    You'll notice that the rule conditions you have are When Touch is Pressed OR Mouse button is Down.

    To explain, let me hand it over to someone who really knows about this stuff:
    When Touch is Pressed means that the actor is clicked/tapped on, while When mouse is down means that anywhere on the scene is clicked/tapped. Try When Touch is Pressed.
    You used both conditions which means that any time the person clicks anywhere on the scene, the actor with that rule will split into two new actors. You need to remove the Mouse button is down condition.
    I understand the 2 rules, but when you remove the Mouse is down and only have Touch is Pressed, nothing happens at all to the bubbles. If you open the game in Gamesalad and remove the Mouse is pressed and then run the preview, you will see what I mean.

    Please help!
  • dabbuhldabbuhl Member, PRO Posts: 52
    So if this works in Mac, do you think it is in the Windows version that I am using is the problem?>
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    So if this works in Mac, do you think it is in the Windows version that I am using is the problem?>
    Yes (in fact, you can see in the video I posted above). You might see if this helps at all: http://forums.gamesalad.com/discussion/59247/windows-creator-first-stop-if-you-experience-unexpected-behaviours.

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

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited February 2014
    Hi @dabbuhl,

    the Windows version normally behaves the same as the Mac version. As @tatiang indicated, a "touch is pressed" should work for your purpose.

    However, I tried your project and it seems to be corrupted. Even creating a brand new actor and rules inside your project shows this wrong behaviour.

    If I create a new project all is fine and as expected.

    I suggest you send your project to Gamesalad to have a look at. I had a quick look at the XML files and didn't find anything obvious, like duplicate Actor IDs.

    If you are not too far with your project, try creating it totally from scratch.
Sign In or Register to comment.