How do I make enemy knockback?

Get help using Construct 2

Post » Fri Jun 26, 2015 7:00 pm

Hi,

I need to make my enemy be knocked back when it is on collision with the character, I can make the enemy knock back through the bullet behavior, but when it falls down, the enemy should stop falling down on the ground, but it not work use the enemy's y position to set gravity. please help, thanks

file: https://www.dropbox.com/s/yupvnkgy8kr7yk5/2.capx?dl=0
B
11
S
3
Posts: 172
Reputation: 1,178

Post » Fri Jun 26, 2015 10:39 pm

Try adding the "Behaviors" > "Solid" attribute to the ground sprite.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Sat Jun 27, 2015 12:35 am

@gumshoe2029 it's not work to add solid
B
11
S
3
Posts: 172
Reputation: 1,178

Post » Sun Jun 28, 2015 5:44 pm

Did you add solid to the sprite itself too?
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Sun Jun 28, 2015 7:33 pm

@gumshoe2029 add solid to sprite still the same
B
11
S
3
Posts: 172
Reputation: 1,178

Post » Sun Jun 28, 2015 8:40 pm

laoniustudio wrote:@gumshoe2029 it's not work to add solid

After adding the solid behavior to the ground tiles, try setting Bounce off solids to Yes on the treasureFlower. Still, I don't think this gives the expected result.

It looks like this might be a job better handled by the Platform behavior instead of the Bullet one. I'll post a modified .capx shortly.

EDIT:
Updated .capx: bit.ly/1BOJlWg
(Looks like I can't properly post URLs yet)
B
5
S
1
Posts: 6
Reputation: 294

Post » Sun Jun 28, 2015 10:40 pm

@mrsocial99mfine thanks, your solution is perfect, thank you so much
B
11
S
3
Posts: 172
Reputation: 1,178

Post » Mon Jun 29, 2015 7:27 am

@mrsocial99mfine i got another problem when I add continuously moving background, the knock back method till work fine, but when the ground move to the second 0(I have draw 0 on the tilebackground), the treasureFlower disappear, and keep disappear when it move to the 0 position, please help, thanks

new file: https://www.dropbox.com/s/dlji5tb8dp0q1 ... .capx?dl=0
B
11
S
3
Posts: 172
Reputation: 1,178

Post » Mon Jun 29, 2015 11:21 pm

It looks like when the highlighted line runs, the ground shifts right?

Image

When this happens, you'll find that if the treasureFlower is on the floor then it will shift along with the the ground tiles. However, if treasureFlower isn't on the floor (i.e., it is in the air being knocked back) then it will stay where it's at while the ground shifts to x=0.

One way to solve this would be to remove the Solid behavior from the current TiledBackground and then add another sprite to act like the real ground and make it
  • Invisible
  • Stationary and
  • Have the Solid behavior
I've went ahead and did this already bit.ly/1eW6qwf but you'll have to decide whether this works for the rest of your game.
B
5
S
1
Posts: 6
Reputation: 294

Post » Tue Jun 30, 2015 3:05 am

@mrsocial99mfine cool, thanks
B
11
S
3
Posts: 172
Reputation: 1,178


Return to How do I....?

Who is online

Users browsing this forum: max2612 and 20 guests