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

0 favourites
  • 4 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • 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!

  • 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

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)