Select object, now follow where I tap...

Get help using Construct 2

Post » Tue Jan 31, 2012 2:07 pm

Hi everyone.
First of all, super excited about Construct 2, and glad to see how helpful the community is around here. I've read through several threads in the forum, but unfortunately I'm still having problems figuring out a few basic things. Essentially, what I'm trying to do is first, is to have my "character" look right(if moving right) or left(if moving left) when I tap/click the screen. The concept is not a "Platform" like Mario Bros or Gianna Sisters, but rather Monkey Island or diablo, isometric.
Yes, I did see the answer for the "diabloLikeMov.capx", but I have no idea how to recreate it as it makes little sense to me what everything does.
Is there a simple way to achieve this?
Thanks ahead of time.
B
16
S
5
Posts: 3
Reputation: 1,273

Post » Tue Jan 31, 2012 5:33 pm

The diabloLikeMov.capx works as follow :

When you click anywhere on the screen (event 1) you set two variables of the collision box of the character to "where you want to go" (xTarget,yTarget).
I also set a 'moving' boolean to true. It's like a flag that means "yeah now you move!"

Basically I use these variable to drive the character.

The event 2 just check if you are close or not to the target. It's to avoid imprecision problems. If you are less than 5px from the target, then stop ('moving' to false)

The hardest part is probably the
event 5 -> Collision: Set position to ....
This event just move the collision sprite a little each tick toward the xTarget,yTarget position.

All the other things are just to change the animation according to the direction of the movement. The "aPref' variable means 'animation prefix' ("B" for Bottom, "T" for Top, "R" for Right and "L" for Left plus 4 combinaison for diagonal movements)

(I updated the diabloLikeMov.capx with some comments)Yann2012-01-31 17:35:52
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Tue Jan 31, 2012 5:57 pm

Yann, thank you so much for your answer, really appreciate it. I'll be looking at the diablolikeMov again and see if I can recreate this.
B
16
S
5
Posts: 3
Reputation: 1,273


Return to How do I....?

Who is online

Users browsing this forum: MarkThomas, signupdemo and 0 guests