How to slide a bullet object?

0 favourites
  • 7 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • Hi all, I'm new in Construct 2 & I'm trying to make an enemy sprite move when it gets hit by player. So far the enemy is moving to direction accordingly but it looks as if the enemy just snapped to that position on hit. What I want is the enemy should move with a sliding effect, like when it gets hit it should look like it got pushed back instead of just snapped. Here is my capx,

    drive.google.com/file/d/10HoyXafApOMP_yQJQBNhv3hVGxmUPBHX/view

    A solution is really appreciated! Thanks in advance!

  • To move an object linearly over time, you can utilize the bullet behavior. Your enemy will also have the bullet behavior. The start speed will be 0.

    When the enemy sprite gets hit by the player, set the enemy bullet speed and angle to the desired values.

    You can also utilize the timer behavior to determine when to end the movement. On hit, trigger the timer for the desired duration, and on timer complete set the enemy bullet speed back to 0.

  • To move an object linearly over time, you can utilize the bullet behavior. Your enemy will also have the bullet behavior. The start speed will be 0.

    When the enemy sprite gets hit by the player, set the enemy bullet speed and angle to the desired values.

    You can also utilize the timer behavior to determine when to end the movement. On hit, trigger the timer for the desired duration, and on timer complete set the enemy bullet speed back to 0.

    Thanks for your response. I already did something similar like this. Please check my capx file. What I simply want is the sprite should move with a slide effect, not just snap to the position.

  • You used a "Move at angle action". This will complete instantly. Instead, use the bullet behavior actions "Set angle of motion" and "set speed", with a timer for duration.

    Since you're already using the bullet behavior for the enemies normal movement, you can either add a second bullet behavior to control the knockback, or disable the normal movement events while the enemy is getting knocked back. Again, the timer behavior will be useful here.

    [quote:9d7aj68z]When the enemy sprite gets hit by the player, set the enemy bullet speed and angle to the desired values.

    You can also utilize the timer behavior to determine when to end the movement. On hit, trigger the timer for the desired duration, and on timer complete set the enemy bullet speed back to 0.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for your suggestion. I tried your way, but now the enemy is not moving after getting hit by player. Anything wrong below?

  • [quote:1aqk1me5]When the enemy sprite gets hit by the player, set the enemy bullet speed and angle to the desired values.

    This is where you have the start timer actions. Set the bullet speed and angle. You want to leave the start timer as it is, but you can get rid of the tag if you want - all the timers can be the same.

    [quote:1aqk1me5]on timer complete set the enemy bullet speed back to 0.

    You only need one of these events. On Timer, set enemy bullet speed to 0.

  • Sorry, I can't understand your point. Can you explain through the event sheet I gave?

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