enemies getting stuck at seam
butterbean
Member Posts: 4,315
So I have a platformer game set up with pieces of ground linked together that are 512X64 and the enemies as they are walking will get stuck at the crux where the ground pieces join.
I was trying to preserve memory by making the ground pieces separate, but should I make one long one for the entire scene which is about 2500 width? My only concern was that we can have pieces larger than 1080 width or height, so what happens if I have pieces of ground that are linked together, and enemies keep getting stuck in that area?
It doesn't consistently happen, but it does happen every 3rd enemy spawned or so.
Also, the rules for the enemies being spawned are quite clear and shouldn't be causing this.
Thank you
UPDATE:
I changed the width of the ground to 1024, and pieced 3 of them together for one long scene, and the enemies (not always) but stop on occasion right where the seam is where the 2 pieces of ground connect, any ideas?
I even overlapped the pieces of ground, and there is always at least 1 or 2 enemies that decide to get stuck right at the seam
I even tested it with a long ground piece with a width of 2,500 and this didn't happen.
Is this a bug?
I was trying to preserve memory by making the ground pieces separate, but should I make one long one for the entire scene which is about 2500 width? My only concern was that we can have pieces larger than 1080 width or height, so what happens if I have pieces of ground that are linked together, and enemies keep getting stuck in that area?
It doesn't consistently happen, but it does happen every 3rd enemy spawned or so.
Also, the rules for the enemies being spawned are quite clear and shouldn't be causing this.
Thank you
UPDATE:
I changed the width of the ground to 1024, and pieced 3 of them together for one long scene, and the enemies (not always) but stop on occasion right where the seam is where the 2 pieces of ground connect, any ideas?
I even overlapped the pieces of ground, and there is always at least 1 or 2 enemies that decide to get stuck right at the seam
I even tested it with a long ground piece with a width of 2,500 and this didn't happen.
Is this a bug?
Comments
I changed the restitution of the enemies to 0.5 and that seemed to fix it for awhile, but one or two still get stuck at the seam Anyone else had this problem, any help would be appreciated or else I'd have to change the dynamics and flow of the entire game which I would rather not do
Looking into the other issue.
EDIT: Also check that your ground actors together are exactly flat. They may look like they are vertically equal, but even a .5 pixel difference can cause a tripup sometimes.
In other words, I can make a 2560 width piece of ground, even if it exceeds the maximum allotted 1024 and it would be okay?
I could try that, but I want the actors to appear to be on the ground, and even if I layered a visible ground actor side by side that was brown, with an invisible ground actor on top, the actors would look as though they were floating.
Also, my actors are all spawning at the same rate, and in the same position, I have them spawning at x axis: 2560 (at the end of the level, and y axis: 90, and they are all spawning and moving in the same way, but only a few stop at the seam of the ground platform, and that's what's concerning to me
Make the actual visible actors non-collidable, place the invisible platform right at the edge of those actors.
Codemonkey, I personally wanted the ground actor to be visible, actually I had the color coordinated with the background, otherwise if I have an invisible ground, I will have to decorate around it to make it look like the actors are walking on something and not just floating/walking. I did also check them to make sure they were flat, and double checked, and they were.
I'm going to retest the game again, otherwise I can try the invisible actor
UPDATE: So when you say invisible actor, you mean almost like an invisible wall but with attributes just like the ground actor so other actors can walk on it correct?
So I can keep the same attributes, just make the ground invisible like an invisible wall?
And I can put this invisible ground (actor) on top of the ground actor that is brown, and just make it a few pixels higher so it still appears the enemies are walking on the ground? Brilliant, I'll try it!
Why does the power of 2 rule not apply to invisible walls?
UPDATE:
I noticed in the cannonball prototype game that the width of the ground was 2149, this is not allowed correct? It was just ease of use for GameSalad?
The invisible ground doesn't need to be a few pixels higher. Just make one long actor whose top border is shared with all three of your shorter, visible actors with images. Don't use the visible actors as the platform your bad guys walk upon, use the invisible platform actor. i.e. Do not allow any collide behaviors reference the visible grounds, nor have any collide behaviors in the ground actors.
The other easier alternative would be, I just make one long ground actor, not drag the gradient ground image into it, and just select a color brown that matches what I have in the scene, and that would be acceptable to have as width 2560?
This would be like the example in the cannonball template game on GameSalad right?
That's good to know! I thought all images, or actors had to conform to the power of 2 rule.
Also, I understand not making the visible ground actor non-collidable, but the invisible one should be collidable right?
Thanks Codemonkey!