Bullets going through walls

For questions about using Classic.

Post » Sat Jun 05, 2010 7:17 pm

Ok, I'm going to try to be as clear as possible.
I'm basically making a game like Gauntlet.
I have my enemies spawning at spawn points, they have bullet behaviors on them so that they will aim towards the player. However, once they hit a wall (I have it set so that when they hit them, they rotate towards the player) they fly towards the player, regardless of what's in the way including the solid walls. How do I prevent them from doing so? How do I make them recognize that the wall is there, and that they need to go around it to get to the player?
B
1
G
2
Posts: 5
Reputation: 635

Post » Sat Jun 05, 2010 7:37 pm

Using Rojohound's path movement behavior would be one possible way to do it.

viewtopic.php?f=2&t=5693
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Sat Jun 05, 2010 8:12 pm

I'm sorry, I guess I wasn't clear enough. What I need the enemy characters to do is simply not go through the walls. I built mine similarly to the Ghost Shooter tutorial, where they hit something and then rotate towards the player. Does this simply overwrite the "solid" function? Because the enemy characters are really flying thorugh the walls.
B
1
G
2
Posts: 5
Reputation: 635

Post » Sat Jun 05, 2010 8:30 pm

try adding a "on step" condition combined with a condition that checks if the enemy is overlapping a wall. If so then the action would be to reverse the speed.

Edit: Looks like "On step" is not necessary. A simple check if overlapping (or colliding) and then setting the rotation towards the player will work. and yes it does override the solid attribute.
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Sat Jun 05, 2010 8:51 pm

I've tried that, but it still zooms right through the walls.

I've just switched the enemy movement to ball movement. It fixed the problem, except now it will randomly go through the walls. It will hit several and then go through, or sometimes it will go through the first one. I tried it both with solid and non solid attributes on the enemy object, but that doesn't seem to effect it. I'm so close!!!
B
1
G
2
Posts: 5
Reputation: 635

Post » Sat Jun 05, 2010 9:02 pm

It seems to work fine for me. Are you doing something different than this .cap?

http://www.box.net/shared/ztv5kcehnj
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Sat Jun 05, 2010 9:09 pm

Here's what I have. I hope you see something that I can't.

http://www.box.net/shared/49qk8tfk7e
B
1
G
2
Posts: 5
Reputation: 635

Post » Sat Jun 05, 2010 9:26 pm

I don't like the ball behavior. Perhaps the latest build (which I haven't updated to yet) fixes the problem but it has always been buggy.

That being said your problem is that your situation is more complex that just bouncing off a wall. If the player gets really close to the wall you have a potential where the enemy will have to overlap the wall in order to approach the player. You will also run into situation where the enemy will fly past the wall as well.

That's why the custom movement/path movement behavior is better for stuff like this. If you don't choose to go with that then you have to add more complex conditions to make sure the enemy is never overlapping the wall.

This seems to be pretty stable:
http://www.box.net/shared/ztv5kcehnj
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Sat Jun 05, 2010 10:09 pm

Thanks so much for your help.
The reason that I'm not using the path movement is because I'm trying to create a game for a camp to teach kids in three hours. The path movement is far too complicated. But this new version seems to be far more stable.
B
1
G
2
Posts: 5
Reputation: 635


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests