Collision with pacing enemy

butterbeanbutterbean Member Posts: 4,315
edited November -1 in Working with GS (Mac)
So I have an enemy that paces back and forth in a platformer game, but if my main player happens to walk into him before shooting him, I wanted the enemy to keep pacing as normal.

As of now, he gets pushed back, and his velocity increases momentarily, and moves him to another position where he will pace back and forth.

So is it possible to make it so when the player touches the enemy, that he continues to pace without being moved?

Comments

  • KamazarKamazar Member Posts: 287
    Either (not sure if all of these'll work)

    1) MAke the enemy non-collidable

    2) Use the move function

    3) Add the velocity of impact from your main player to that of the enemy opposite the direction the enemy's attack from. Might be a tad trickier.
  • butterbeanbutterbean Member Posts: 4,315
    1) I can't make the enemy non-collidable cuz I want the player to be able to destroy the enemy or take damage when colliding but without moving the enemy...

    this might be trickier than I thought, but I've seen it done in other platformers all the time.... maybe changing the physics of the enemy or tweaking with the numbers will help with it?
  • JGary321JGary321 Member Posts: 1,246
    The actor doesn't need to be collideable for it to be damaged or for it to damage the player. None of my units in my game are collideable. You can still use all of the on collision or overlap rules. That's how u do damage and take damage. That's the route I would go. Make them non collideable.
  • butterbeanbutterbean Member Posts: 4,315
    I didn't drink enough caffeine today... ! Okay so that's a lie, I actually didn't know that you could do that but it makes this task a whole lot easier! :) thanks guys
    also, in the event that you have a player with 3 health bars and they collide or
    overlap with an enemy , I probably need to create an invincibility Rule for the main actor for about 3 seconds so they don't get consecutively right?
  • JGary321JGary321 Member Posts: 1,246
    It will only check once per overlap/ collission. So it won't keep hitting even if the player stands on top of the enemy. Which would probably be ideal for a platformer like that anyways.
  • butterbeanbutterbean Member Posts: 4,315
    Update:

    So here's what I did, instead of adding the attribute collide with: "enemy" and in the enemy actor, putting collide with: player

    I just created a rule under the player that if collides/overlaps with "enemy", take damage

    Is that how you created your rule?
  • JGary321JGary321 Member Posts: 1,246
    yes
Sign In or Register to comment.