unpause spawns actor-don't know how to fix

SAMmanSAMman Member Posts: 228
edited November -1 in Working with GS (Mac)
Hey guys, In the game I am working on I have it st up so that when Touch is Pressed an actor is spawned. pretty simple, but when I pause the scene it spawns an actor, and when I unpause the scene by touching the unpause button while it is in pause it spawns an actor at the same time it unpauses. Is there a way to fix this and still use the pause behavior, since I finally got that working the way I wanted. Thanks.
SM

Comments

  • starcatstarcat Member Posts: 107
    you have when touch is pressed, use when touch is Inside.
  • SAMmanSAMman Member Posts: 228
    thanks, just tried that with both buttons and it is still spawning for some reason.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    have you tried using an attribute to disable to spawn when paused?

    make a attribute called spawnoff. have it set to 0

    The rules you have to touch the screen and spawn a actor, put those in a rule when attribute spawnoff=0

    when you press the button to pause the game, where the pause game behavior is also put a change attribute behavior and change spawnoff to 1

    then when you have your touch is pressed rule to unpause game, also put a timer after 1 second with run to completion checked, and put a change attribute behavior changing spawnoff to 0

    that will turn the spawn rules off when your pause, then when you unpause the game will turn back on after a second so the unpause touch wont spawn a actor. Sometimes this works sometimes it doesnt or you have to adjust somehting. This is one of those workarounds you gotta keep playin around till you find what works for you
  • SAMmanSAMman Member Posts: 228
    yes it seems like playing around with it is the case. I have been messing with it for about 4 days now and it is getting frustrating. If anyone has any other suggestions that would be very helpful at this point. Thanks for all those so far.
    SM
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Are you using the pause behavior?

    Where are the spawn rules Are you actually using un-pause but then it spawns because a spawn rule is in the background actor? Theres all sorts of reasons I can see this happening but really we need to know more about the way you have it setup.

    Or is it you have a pause button and you are not really pausing and instead just spawning something that says pause?
  • SAMmanSAMman Member Posts: 228
    Good questions, thanks. I forget to write things sometimes. yes, I am using the pause and un-pause behaviors. I have actual pause and un-pause buttons. and there is a spawn rule in the background of the game scene. hope that helps. thanks.
    SM
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Well thats your problem. Your Spawn rule should look something like this then

    When touch is pressed
    and When game.mouseposition.x is > 50
    and When game.mouseposition.y is > 50

    You have to play with the numbers based on the location. That particular Rule would be good for a button in the bottom left corner that was around 50x50

    hopefully that helps you out. And you need to have your un pause button in the same spot otherwise the press on that will do the same thing.

    If that solution doesn't work for you you will have to re work how to spawn what ever it is you are spawning.

    ___________________________________________________________________________________
    TEMPLATES AND PROJECT HELP BY TENRDRMER. CLICK HERE!!!

    AppSolute Entertainment on Facebook
    AppSolute Entertainment on iTunes
  • SAMmanSAMman Member Posts: 228
    actually that makes a lot of sense. I will try that thanks Tenrdrmer! Could you take a look at this post? No one answered, I hope posting it as a link in another post is cool.
    http://gamesalad.com/forums/topic.php?id=27242&replies=1#post-204345
    SM
  • SAMmanSAMman Member Posts: 228
    I got it to work but unpause still spawns, I can't decide if it is me or a bug.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Its almost definetly your code. Is your unpause button in the same spot as your pause button or somewhere else on the screen?

    ___________________________________________________________________________________
    TEMPLATES AND PROJECT HELP BY TENRDRMER. CLICK HERE!!!

    AppSolute Entertainment on Facebook
    AppSolute Entertainment on iTunes
  • SAMmanSAMman Member Posts: 228
    it's in the same spot. ugh, I don't know what this is, I compared to a template example and I can't see a difference. lol. In the template the pause button changes to an unpause arrow, mine is supposed to do that but the pause button doesn't disappear like it should, maybe I have an attribute that is keeping it there.
Sign In or Register to comment.