Help me sort out an actor problem

MattButlerStudiosMattButlerStudios Member Posts: 486
edited March 2014 in Tech Support
Ok, so I have two actors that I am dealing with. One of the actors is red and the other is black. The red actor serves as the color you cannot touch or you the game will restart. This color is filling the entire screen and serves as the background. On top of this red actor I put the black actor. The black actor serves as a path that is fine to travel on without dying. My problem is that even though I have put the black actor on top of the red actor, my character still dies even though it is traveling on a safe (black) path. I am thinking that this is caused due to the red actor beneath it. Is there a rule or something that I can apply to make the black actor override the red one? Thanks for you help everyone!

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Try this in the character actor:

    image

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

  • MattButlerStudiosMattButlerStudios Member Posts: 486
    edited March 2014
    I tried this and unfortunately it didn't work. Here is the image that I am trying to configure. The black is what I want the ball to roll on. The red is what I have put as the background and it also resets the scene when touched. How can I make that the background without it always reseting the scene when the ball is sitting on the black path above the red?

    image
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2014
    [Reduced the image size a bit for you.]

    You may need to:

    (1) Change the ball actor's collision shape from rectangle to circle
    (2) Add collision "sensors," rectangular actors that sit outside of the black area by a certain offset amount (you'd need a bunch of these) and add the collision rules to these actors.

    GameSalad does not support custom collision shapes, which is what you're attempting to do.

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

  • MattButlerStudiosMattButlerStudios Member Posts: 486
    I know that the problem is not with the collision shapes, because my levels have worked just fine previously. Is there a way to add priority to when rules are applied? I don't want to have to rely on sensors, because that will be a lot of work. I just don't understand how the actor that is beneath another actor can still affect what is going on.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited March 2014

    @MattButlerStudios Because you've got your ball actor on top of an overall background which includes your "safe" areas as well as collision and out of bounds areas, there's no way of detecting any sort of collision without adding invisible actors.

    (If your track was horizontal and vertical, you could perhaps detect collisions via tables, or another way, which would take a long time to make work, would be to constrain your x and y locations of your ball player, and when out-of-bounds of certain parameters would be your collision detector... )

    So neither of those are feasible... the only feasible way - with your setup as it is - is exactly what @tatiang recommends... i.e, first make your collision shape of the ball actor to round, and then add invisible collision boxes to all of your track. It does involve a fair bit of work, especially if you've got a lot of other track images, but that's the only solution in your situation, I'm almost certain.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • joshiwujoshiwu Member Posts: 207
    If ball is colliding with black
    Timer.every.1 sec. Add 1 point to score.
    Else
    Reset scene

    The red actors are not needed for this method. Just put the consequences of failure under else.

    Although it may be possible to use the red pieces. Like this
    If colliding with black.
    Add point to score every 1 second
    else
    If colliding with red
    Reset scene

    But still doesn't turn the red into walls. To turn red into walls you could have red actors that collide with black actors moved to a different layer, but to make this method perfect you have to use exact math. Hopefully positions divisible by 4. Or something to the like.

    @matbuttlerstudios
  • joshiwujoshiwu Member Posts: 207
    As different layers will avoid collision.
  • MattButlerStudiosMattButlerStudios Member Posts: 486
    Thanks for all of the answers guys. I want to go the route of using actors and keep it relatively simple. Could someone explain to my why the red is still detected by the ball even though there is a black path between them? Thanks
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi Matt, even when you've put your invisible actors as collision detectors, is that what you're saying? If so, it could be that you haven't deleted the collision rules in the overall background image...

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MattButlerStudiosMattButlerStudios Member Posts: 486
    @gyroscope‌ I haven't used the invisible actors yet. I am going to do that now. I am just asking if all actors are detected at the same time or if their rules and behaviors are detected by which order they are in your image or storyboard
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Here's the deal: your red actor is either a red rectangle or it's a cutout image without the black area. Either way, the actor itself is a rectangular shape the size of the scene. When you add a collide rule, the condition checks to see if your ball actor is overlapping the "red" actor. Ignore the red portions of the image and think about the dimensions of the actor. Collisions/overlaps run deep... if you stack thirty actors, the top actor will still detect a collision with the bottom actor.

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

  • MattButlerStudiosMattButlerStudios Member Posts: 486
    Ok. That answers my question. I went ahead with the invisible actors and all is good. Thanks so much for you help and quick responses!
Sign In or Register to comment.