A Little problem with my enemies

0 favourites
  • 4 posts
From the Asset Store
Pixel Enemies for SHMUP consists of 45 enemy ship sprites to be used in your game.
  • Hello friends c:

    I have a little problem with my enemy on construct 2.

    When my character jumps over an enemy's head, I'd like it to be repelled whenever it has contact with the enemy's sprite. But since I don't know how to make this part of the programming, she is just standing over it like a platform for it has colision.

    Any tips on how to program that part of repelling?

    Example:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Does your enemy has any behaviors like platform or solid? Do you want the player only bounce upwards on the enemy or should it also bounce to the direction it moves?

  • Actually he have solid and platform behavior, i want my character being repel if she stands still above him like on the print.

  • The easiest is if the player bounces only upwards.

    Make a second ImagePoint on your enemy (Image Editor, second icon from bottom on the left, in the image point window press the plus icon) and place the ImagePoint on the top of your enemy (8 on the Numpad).

    You need 2 events:

    + Player: On collision with Enemy

    + System: Player.Y < Enemy.ImagePointY(1) -> Player: Simulate Platform pressing Jump

    If you don't want that your player jumps as high as the normal jump you can use vectorY:

    + Player: On collision with Enemy

    + System: Player.Y < Enemy.ImagePointY(1) -> Player: Set Platform vector Y to -250

    Be aware that the value of vectorY has to be negative.

    The second ImagePoint isn't really necessary. You could also use the origin ImagePoint, but you can get funny side effects if the origin ImagePoint is not in the middle of the Sprite.

    If you use the origin you need only Enemy.Y

    I assume that your player has the platform behavior and the enemy the solid.

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