How to reference an actor's changing attributes properly?

ChimoruChimoru Member, PRO Posts: 137
edited February 2012 in Working with GS (Mac)
I have an actor(1) who's width is being interpolated to a greater size, and I want the scene to change when this actor collides with another actor(2), but ONLY when the first actor's width is a certain number. A rule is set up stating: When actor(1) collides with actor(2) and Actor(1)Width > 300, change scene. I have an attribute (ActorWidth) that is being constrained to the actor's width, and I used a display text to verify it is working properly, but when the actor reaches the specific width while colliding with the second actor, the scene doesn't change. Am I going about this the wrong way, or is this even possible in gamesalad?

Thanks.

Comments

  • UnicornInvasionUnicornInvasion Member Posts: 301
    I am not sure, but what I would do is.

    Make and attribute and call it Actor1Width. Constrain that to the actors width. then when overlaps or collides with actor1 and Actor1Width=or > 300

    Change Scene
  • ChimoruChimoru Member, PRO Posts: 137
    Thats the exact same thing im doing, and you would think it would work but it doesn't. Strange...
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    How big is the actor set to expand to? If it's set to 300, it won't happen because it's not greater than 300. Maybe instead of >300 try =300?
  • ChimoruChimoru Member, PRO Posts: 137
    I have it interpolating to 500, so it goes way past 300 and it's also directly overlapping actor(2). I'm thinking this might be a gamesalad limitation...
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    I believe It's the interpolation keeping it from changing scenes. I'm not sure what your game is like, but you may need to find another method of resizing. Interpolation can't be interrupted until it finishes, unless another interpolate is used, or something like that.

    You may try making the size not interpolate so big, like to 305 or something, and use a timer to constantly check for the width size. You would just add the timer behavior and have it say "every" 0.01 seconds - Then have your rule inside that timer that says when actor is greater than 300, change scene. That way once the interpolate is finished, the timer will keep telling it to check for the width, and should work then.
  • ChimoruChimoru Member, PRO Posts: 137
    I see... Well I'll try to use your method and see if it works. Thanks!
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited February 2012
    do you have the rule if width is greater then or equal to, or do you just have = or just >

    If you dont already change it to greater then or equal to

    edit: just read threw all the posts in the thread, refer to tynans comment below. Theres problems with collide when interpolating
  • CloudsClouds Member Posts: 1,599
    Tshirtbooth has a template for this, the one where you fire balls and where they land they start to grow and when they grow sufficiently large enough and touch another they explode, in that scenario is the basic code you want. If I remember correctly interpolating size will not work with collide/overlap.
  • ChimoruChimoru Member, PRO Posts: 137
    Ok so interpolate is the problem. Thanks for the help guys!
  • ChimoruChimoru Member, PRO Posts: 137
    edited February 2012
    Sorry to bump a week old thread, but I still can't figure this out. I've tried 'change size', i've tried referencing the changing actor's width in a custom attribute, making a timer that checks its size in increments, but I can't figure out how to do this. Let me simplify what I'm trying to do: I have an actor I want to grow at a steady rate, and when it overlaps with another actor (once it is greater than a certain size) something happens. I don't think Tshirtbooth's template will help, because the actors in it aren't steadily growing, their size is being changed instantly.

    Has anybody actually been able to do something like this successfully?
  • anchorsonanchorson Member Posts: 15
    I have had the same problem and even reported it as a bug (for I thought expanding objects should be able to collide). It might be a limitation or maybe I am doing it all wrong. But i believe I've tried all the behaviors available for size change and still GS failed to detect the collision. I posted it as a Q on Q&A at cookbook too; http://cookbook.gamesalad.com/question/4f4a2a59a5d0962bf400000f

    Anyways, I think there might be a workaround for your problem if your actors are circles;
    First here is a tutorial by T-shirt Booth for calculating distance between two actors;


    Now using the distancefrom attribute you can make up a rule where you compare distancefrom to "sum of width of actor1 and actor2". While your actor expands, its width will too. When the sum of the widths of your actors (or sum of their radius) exceed or is equal to distancefrom; you can move to next sceene.

    I hope that helps.
Sign In or Register to comment.