How do I make the player and enemy react dif. to an object?

Get help using Construct 2

Post » Sat Sep 26, 2015 2:18 am

Simple question: I want the player to go through an object that the enemy can't. I gave the player a solid, platform, and physics behavior. The enemy has just a platform behavior, and the object (a square) only has a solid behavior. How do I accomplish this? Do I need more behaviors or do I just need to use the event sheet to make the player go through this object but not the enemy? Any help would be great!
B
11
Posts: 27
Reputation: 433

Post » Sat Sep 26, 2015 6:42 am

Hi Sebastian!

You have many ways to this I guess. Here is what I would do with my little knowledge ^_^ :

-You could set the Square's solid disabled as soon as the player is overlapping it, and enable it back if the player is not, but it would also allow the enemies to pass as long as the player is passing on it, so it might be stupid.

-You could "bump" out enemies on collision with the square if it is not solid by using the "Set Vector" platform action or even more dirty by reseting there position to self.X-20 if they are on the left (20 is an example here) and self.X+20 if they are on the right side of the object.

If you send me your CAPX project I can try to build something and send it back.

Vega
B
19
S
3
Posts: 35
Reputation: 945

Post » Sat Sep 26, 2015 6:44 am

Ow, and also, if your player, your enemy and your square all had the physics behavior only you could simply set player>disable collision with square! But I guess.... it's not as simple as that, right ?

I hope I can help
B
19
S
3
Posts: 35
Reputation: 945

Post » Sun Sep 27, 2015 4:56 am

Yes, thank you Vega. You have some good suggestions. I came up with a solution for now, and it seems to be working. The reason I was asking this is because I followed a tutorial a while ago to begin the project I am currently adding on to. The tutorial showed me how to make a basic platformer came. One thing they showed me is how to keep the enemy on the platform by using 2 blue squares on each end of the platform to basically change its direction when collided with it. But for some reason, when I added a new animation, it created a bug in the game and this "blue-square-on-each-end-of-platform-to-keep-enemy-on-platform" method doesn't work anymore and glitches. I don't know what happened, and I am quite frustrated with it. I used the debugger and it appears to be mirroring the enemies but not changing their direction unless they 'land' on the square rather than just simply colliding with it. This makes no sense and their is no reason for it not to be working. This new animation I made should in no way, shape, or form messed with the collision detection of the blue squares and the enemy. Anyway, so I made the squares solids to keep the enemy from going passed them, and they now seem to turn around like they're suppose to, but I have this invisible square my player keeps standing on and running into on the platforms with enemies... so that brought me to the question I asked you. My solution was just to make the squares really small and put them on the ground --- big enough to stop the enemy, but small enough with the help of shaping the bottom of the player's collision polygon to more of a circle to make him pass right over it. So thanks for your help, and now you understand better what my real problem was.
B
11
Posts: 27
Reputation: 433


Return to How do I....?

Who is online

Users browsing this forum: Manubis, Ryan Kocourek, TheSupreme, TylerJS and 10 guests