How do I spawn a sprite on a certain spot when overlapping?

Get help using Construct 2

Post » Tue Aug 16, 2016 6:00 pm

I would like to spawn a sprite when a sprite makes collision with another sprite.

Example would be player has a sword then player swings the sword to hit an enemy and when the sword hits the enemy then the collision part where the sword hits the enemy spawns slash/blood. How do I spawn a sprite at that spot?

Right now, I only know how to spawn from player, enemy, or sword but it will not spawn in the correct spots when hitting enemies at certain angles and larger enemies.
B
10
S
4
Posts: 56
Reputation: 919

Post » Tue Aug 16, 2016 6:06 pm

You use image points, under the spawn action you'll see the Object but also Image Point. If you open the image editor, the default image point is 'Origin'. You can create other points on the image, and spawn things on them using the spawn action.
B
47
S
17
G
81
Posts: 2,221
Reputation: 48,089

Post » Tue Aug 16, 2016 6:11 pm

Thanks for the fast reply.

I do use image points but is there a way to select a specific one based on location such as if the sword was to hit the enemy's foot then spawn based on that image point and if the sword was to hit the enemy's head then spawn from that point?

I am looking for accurate positions in spawning slash/blood for hitting enemies in random spots. If not specific spots then it doesn't look accurate.
B
10
S
4
Posts: 56
Reputation: 919

Post » Tue Aug 16, 2016 6:32 pm

I use just one action (system pick) :
Image

Imagepoint 1 is the foot here so it breaks down as : if sword is colliding with the foot > spawn blood on the foot.
B
47
S
17
G
81
Posts: 2,221
Reputation: 48,089

Post » Tue Aug 16, 2016 11:02 pm

Thanks. This what I was looking for. Only problem is when hitting multiple spots at once then it will trigger both image points.
B
10
S
4
Posts: 56
Reputation: 919

Post » Tue Aug 16, 2016 11:11 pm

Well it will need tweaks for sure. You can put in a condition that checks if you're already overlapping an imagepoint then don't do this action. There's a detection in C2 for nearest/furthest. You could incorporate that somehow to find the nearest imagepoint to the sword and only trigger that one. It's all about investigation :D
B
47
S
17
G
81
Posts: 2,221
Reputation: 48,089

Post » Tue Aug 16, 2016 11:48 pm

I see. I am having problems getting them to work correctly. I have tried if overlapping with image point 1 then 2 won't spawn and vice versa but neither will spawn. How do I get it to find the nearest image point without giving it a specific number of the image point? When I tried it wants a number for the image point.
B
10
S
4
Posts: 56
Reputation: 919


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests