Pick enemy according to proximity, camera drag.

Get help using Construct 2

Post » Tue Mar 19, 2013 6:22 pm

Hello, I recently started using C2 and I've looked at quite a lot of tutorials, but I couldn't find anywhere how to solve this problem. I want to make a 2D rpg for touch screen devices, so here's what I did:


As you can see, you will only shoot arrows when the enemies are in range, but the problem is the arrows always go towards enemies in the same order(That is, the order in which the enemies were created) instead of going to the closest one, so you will always attack the same enemy no matter where you are. How can I fix this?

A much smaller issue(which I already tried to fix until I gave up): I want to make the camera follow the player(moving slightly slower than the player), then make the camera go a little faster when you release the button until it gets to the player position, as smoothly as possible. The problem is the camera sprite keeps moving around the center of the player forever, vibrating.

Thanks for your time, guys . Yandraker2013-03-19 18:24:00
Posts: 11
Reputation: 372

Post » Tue Mar 19, 2013 6:51 pm

1) just use the pick nearest/furthest condition under the objects pick commands

2) add a condition which checks the distance using the distance expression under the system object, so the condition is only met if it is above say 1 pixel.
Posts: 735
Reputation: 12,142

Post » Tue Mar 19, 2013 7:12 pm

I've just read about both of those things but I'm still confused. Can you be more specific?

1) Which object should pick which? The projectiles or the enemies(coloured balls)? I've tried some things but the projectiles keep homing towards the balls in the same order.

2) I understand what you're saying I have to do, but I'm not sure how to do it. Would that be a 'compare 2 values' condition?Edit: Nevermind, number 2 is solved.

Thanks.Yandraker2013-03-20 00:45:55
Posts: 11
Reputation: 372

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests