Touch event with spawned actors

xactoxacto Member Posts: 146
edited November -1 in Working with GS (Mac)
Having an issue with some code. I have made an actor that I want to spawn 4 times in a scene. So I set up another actor to create a timed spawn. Everything spawns ok.

What I am looking to do is when a user touches an actor it is destroyed. However, what happens is once I click on one of them.... all my NEW spawns will show itself then destroy itself after a second. If I placed separate actors without spawning - it works like it should. (only spawning does not work)

http://farm3.static.flickr.com/2569/4007452006_1f62f146c2_o.png

Seems simple enough. Any ideas?

Comments

  • xactoxacto Member Posts: 146
    When all conditions are valid: Attribute game.Gcount is less then or equal to 5
    Timer: Every 2 seconds
    - Spawn Actor, front layer, relative to scene
    - Change attribute game.Gcount to game.Gcount+1
  • xactoxacto Member Posts: 146
    ....anyone.....
  • Fafnir312Fafnir312 Member Posts: 161
    I'm not sure, but perhaps if you moved your timer into the otherwise portion of your "Rule Collide".

    Then the "code" would read:
    If touched they die, otherwise if not nothing else happens they die after five seconds.

    Again, I don't know, it doesn't look like it will fix the issue you're having but I think it'd clean your "code" up a bit. It's something to try. It's what I'd do I think, but I'm new.
  • sdparduesdpardue Member Posts: 110
    You code looked like it would work, so I just decided to try it. It works for me.

    Have a look at "Spawn, Touch, Destroy", http://gamesalad.com/game/play/24792

    The "spawner" is the red box at the center, Gcount is represented at top left, Score is represented at top right.

    I made it so you could download it and compare it to your own.

    Hope this helps.

    Steve
  • xactoxacto Member Posts: 146
    Sdpardue,

    Ok this is strange.... your code does exactly what mine does. It works for maybe one or two clicks -- then they just spawn and "destroy" with no interaction at all. Quick blinks....

    Unless my plug-in is messed up (maybe the case).

    Can you see if this is the same for everyone else? (see link)
    http://gamesalad.com/game/play/24792
  • quantumsheepquantumsheep Member Posts: 8,188
    Does the same for me, Xacto - works then spawn and destroy...

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    Same thing for me too, the first time I click on the soccer ball it destroys as normal. every time after that it's destroyed on it's own.

    I tried downloading the project, but it comes up as a Chess game and gamesalad won't open it.
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    I got it working, but I made a change to the touch command:

    Instead of "Actor receives event Touched is Pressed"

    I switch it to
    "Actor receives event Mouse Button is Down"
    "Actor receives event Mouse Position is Inside"

    Maybe it's a bug with the touch command?
  • xactoxacto Member Posts: 146
    Yes, the "button is down" and "Mouse Position is inside" will work. (thanks)

    So, what does the "touch is pressed" suppose to do?

    Anyone from gamesalad know if this is a bug?
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Maybe a bug. They should do exactly the same thing for the first touch. Using touch(pressed) should be better for multi-touch situations.

    a .game file is just a .zip file. So just rename it with the .zip extension and you will get your .gamesalad file.
  • xactoxacto Member Posts: 146
    I am working on another game which requires multi-touch... so this will be an issue. :(

    Anyway to fix this bug - or is there a work-a-round to this?
  • xactoxacto Member Posts: 146
    .... anyone know if this is a bug?

    Guess I will have to shelf this game until it is fixed. :(
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    its a bug. its on the fix it list.
Sign In or Register to comment.