Enter House Problem
by Kiyaku · in TGB Platformer Kit · 06/03/2008 (1:57 pm) · 3 replies
Hi,
i want to create a building where you can enter or pass by. There will be 2 Triggers infront of the door, one for leaving and one for entering the house. The house has 2 sprites, the backside (layer 13) and the forground (layer 11). When i pass the trigger to enter the building, i set my player to layer 12 so he is behind the forground layer, which works. when he leave, he gets layer 2 again.
But i have a small collision problem now. I want to give the house some walls that you can't pass when you are on layer 12 but can pass when you are on layer 2.
Any idea how to create something like this? I tried different things yet but nothing seems to work.
(I want to pass the right wall now)

(I don't want to pass the right wall now)

Thanks in advance!
i want to create a building where you can enter or pass by. There will be 2 Triggers infront of the door, one for leaving and one for entering the house. The house has 2 sprites, the backside (layer 13) and the forground (layer 11). When i pass the trigger to enter the building, i set my player to layer 12 so he is behind the forground layer, which works. when he leave, he gets layer 2 again.
But i have a small collision problem now. I want to give the house some walls that you can't pass when you are on layer 12 but can pass when you are on layer 2.
Any idea how to create something like this? I tried different things yet but nothing seems to work.
(I want to pass the right wall now)

(I don't want to pass the right wall now)

Thanks in advance!
#2
thanks for your comment :D
I tried different things with the layer groups now and it seems to changing nothing. Some more details:
First i used a Collision Box with the Platform Object Behavior. I can't find a way to pass the the collision box in any way. I just noticed something weird. When i'm on layer 2 an run against the wall all the time, the background stops moving (paralex movement). But when i switch to layer 12 (i dischecked the layer 12 in the collision tab) and run against the wall, the background keeps moving like i would pass the box.
After this i checked the Platform Behavior CS File and tried to understand the collision method used there. It seems like it's checking the area between all collision points and check if the player is inside or whatever. I might be wrong there.
So this could probably the problem why i can't use ignored layers/groups for the collision.
Second i used a normal collision box without any behavior, just different collision settings (like receiving, sending collision) and changed the Collision Layers so it should just collide on Layer 2. Maybe i get something wrong there but it doesn't collide with ANYTHING, even if activate all collison Layers. The player can just run through it.
I hope this explanation is a bit more detailed and could help to find a solution.
Thanks,
Kiyaku
06/03/2008 (10:34 pm)
Hi Phillip,thanks for your comment :D
I tried different things with the layer groups now and it seems to changing nothing. Some more details:
First i used a Collision Box with the Platform Object Behavior. I can't find a way to pass the the collision box in any way. I just noticed something weird. When i'm on layer 2 an run against the wall all the time, the background stops moving (paralex movement). But when i switch to layer 12 (i dischecked the layer 12 in the collision tab) and run against the wall, the background keeps moving like i would pass the box.
After this i checked the Platform Behavior CS File and tried to understand the collision method used there. It seems like it's checking the area between all collision points and check if the player is inside or whatever. I might be wrong there.
So this could probably the problem why i can't use ignored layers/groups for the collision.
Second i used a normal collision box without any behavior, just different collision settings (like receiving, sending collision) and changed the Collision Layers so it should just collide on Layer 2. Maybe i get something wrong there but it doesn't collide with ANYTHING, even if activate all collison Layers. The player can just run through it.
I hope this explanation is a bit more detailed and could help to find a solution.
Thanks,
Kiyaku
#3
I tried it on a different PC now (Windows instead of Mac) and i got it to work. I probably missed something the last time, silly me.
Now i gave the collision box the Platform Object behavior and changed it to "receive Collision".
The players Collision Layers are all turned on except Layer 12. In my trigger function i switch the setCollisionLayer depending on the player layer. If he's on layer 2, there is no collision with layer 12. if he's on layer 12, i activate the collision with layer 12.
Thanks again for your help.
06/03/2008 (11:42 pm)
Problem Solved!I tried it on a different PC now (Windows instead of Mac) and i got it to work. I probably missed something the last time, silly me.
Now i gave the collision box the Platform Object behavior and changed it to "receive Collision".
The players Collision Layers are all turned on except Layer 12. In my trigger function i switch the setCollisionLayer depending on the player layer. If he's on layer 2, there is no collision with layer 12. if he's on layer 12, i activate the collision with layer 12.
Thanks again for your help.
Associate Phillip O'Shea
Violent Tulip
By the way, the house looks awesome!