Layering & collide problem

http_gamesaladhttp_gamesalad Member Posts: 1,340
edited May 2015 in Working with GS (PC)

What I'm trying to achieve is when is when the actor collides with the purple background gameover = . I want the main actor to be able to move around on the grey line. The purple background is set to the far back of the layer the grey actor is above of the purple actor and the main actor is above the grey actor. But when I preview the game it automatically sets gameover = 1 even though the main actor hasn't collided with the purple actor. Can someone help me with this? Thanks :)

Image and video hosting by TinyPic

(This is the main actor without the gameover actor covering it)
Image and video hosting by TinyPic

Comments

  • UtopianGamesUtopianGames Member Posts: 5,692
    edited May 2015

    Try a timer, after 0.5 seconds if not overlapping with grey actor game over.

    To achieve a NOT overlapping simply make a rule overlapping or colliding with Grey and leave the main part blank now open up the otherwise part of the rule and place your code in there.

    It doesn't matter if the purple actor is below the grey it will still register a collide with the grey actor.

    Looks like your making a 2d temple run or stay on the line type of game?

    The method above in action is below basically if were not overlapping with platform we much be dead :)

    1:20 in the video below…

  • ookami007ookami007 Member Posts: 581

    The problem you are having is that even though they are on different layers, the actors are colliding.

    Layers are more for visual rendering... what's on a closer layer renders on top of what's on a further layer.

    But, for collision detection, it simply looks at whether or not they overlap. So, in your case, they DO overlap, because the gray is technically overlapping with the purple.

    Here's a simple example of two methods.

    In the top method (you can control this the F/G keys), the water is actually 3 separate actors surrounding but not overlapping the bricks. As soon the the player touches the water... DEAD!

    In the bottom method, the bricks are on top of the water and it's similar to @DeepBlueApps method, but it sets GameState to 1 (alive) is colliding with the bricks and to 0 (dead) when not colliding, so the water doesn't matter... if he steps off the bricks... DEAD! You can control the bottom actor with the A/D keys.

    https://dropbox.com/s/qjuyo7bm8t1v6dh/Walking%20Off%20Demo.zip?dl=0

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @DeepBlueApps & @ookami007 OMG THANK YOU SO MUCH!!!!! YOU DON'T UNDERSTAND HOW LONG I'VE BEEN TRYING TO GET THIS TO WORK. It's been months tbh. THANK YOUUUUUU!!!!!!!! *

  • http_gamesaladhttp_gamesalad Member Posts: 1,340
    edited May 2015

    @DeepBlueApps & @ookami007 one more question. Is it possible to tell the game to end once the main actor moves just outside of grey line?

    Image and video hosting by TinyPic

    something like this

  • WOLFENSTEINWOLFENSTEIN Member, PRO Posts: 64

    On the screenshot you posted, you'd need 4 different purple actors. (One right down the left hand side, and three on the right in strips, to compensate for the layered gray section.)

    Make sure the purple DOES NOT go behind the gray bit!

    Then, when your main actor overlaps or collides with the purple actor, change scene to 'game over' or however you plan the game to end. I hope this helps.

    (Footnote, if you can't get the actor small enough by dragging the sides, you can get it thinner still by altering the size values in the actor > size tab).

  • WOLFENSTEINWOLFENSTEIN Member, PRO Posts: 64

    Double posts for the win: Alternatively, you could set the scene colour to purple rather than black, this would eliminate the need for purple actors at all, then just run an invisible actor down the boarder and have it collide with that, would save you using big old actors to blanket the screen.

  • ookami007ookami007 Member Posts: 581

    There IS an alternative... you can do whatever you want with the colors and have invisible actors that actually mark the "death" spot. So, surround your gray area with the "death" actor and set their transparency to 0.

    This way, you can adjust them so that the death happens EXACTLY where you want it.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340
    edited May 2015

    @WOLFENSTEIN & @ookami007 I have the vertical line working.. but I'm having trouble with the horizontal line

    The green lines are the walls that'll end the game btw
    Image and video hosting by TinyPic

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @DeepBlueApps @ookami007 @WOLFENSTEIN is this what @DeepBlueApps was talking about? Image and video hosting by TinyPic> @DeepBlueApps said:

    To achieve a NOT overlapping simply make a rule overlapping or colliding with Grey and leave the main part blank now open up the otherwise part of the rule and place your code in there.

    The thing is on the new gamesalad update for windows theres 2 play buttons. When I press play on one of the play buttons everything works properly BUT when I press play on the other one it sets gameover =1 as soon as it starts
    Something I noticed is when I tested this out on my android phone it didn't change gameover = 1 as soon as play =1 .. but when I tested it out on my iOS device it change gameover =1 as soon as the games stars

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    Hope you can help me with this issue , thanks again :)

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    Bump?

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    anyone heard of this problem before?

Sign In or Register to comment.