How do I make 2D Mouse follow & °

Get help using Construct 2

Post » Fri May 15, 2015 7:34 pm

Hello everyone who is reading this!

I got stuck on one of the things and couldn't find in on forums as I don't know what it is called..!

Basically I have a character which is running left & right etc... .

Character shoots if mirrored shoot left if not mirrored shoot right.
But I'm unsure how to make the character shoot where the mouse is so the player could actually shoot where he wants not only left and right... .

Image

I'm not sure what should I do or how I should do it?

My first thought that came in mind was making the body animation separate with hands and every tick or / Sec mouse X - mouse Y ? that's the first problem!

The second problem is how do I make it so he cant aim too high and too low and when he when mirror then mirror hands too! I have no idea how to do this but to learn how to do it would be awesome!

Thank you everyone for your attention!
Any help is much appreciated!
B
8
S
3
Posts: 120
Reputation: 989


Post » Fri May 15, 2015 8:45 pm

@Lordshiva1948 I cant PM you I need 500rep, and I don't know what it's called what I want how I suppose to find it ? :D
B
8
S
3
Posts: 120
Reputation: 989

Post » Fri May 15, 2015 9:32 pm

I'm thinking it works like this so only the hands move?
Image
I'm using 2 sprites.. but what next? I mean is this the best way? or there is another way?
Because I'm also wanting to change the animation later on to without weapon! will i need to hide them or something ?
Thank you!
Last edited by Frap1K on Sat May 16, 2015 10:20 am, edited 1 time in total.
B
8
S
3
Posts: 120
Reputation: 989

Post » Fri May 15, 2015 11:35 pm

Changing animation doesn't mean you have to hide them, you just change animation..
If the actions are different with the other animation you either add the condition - is playing animation, or put all events in a group and activate deactivate them depending on the animation.

Now you have seperated the arms, the next step is pinning them to the body using the pin behaviour.
Then you add an action of rotating the arms.. either you rotate them towards position mouse.x,mouse.y , or rotate toward angle(sprite.x,sprite.y,mouse.x,mouse.y)
Then you add a condition to limit the rotation of the sprite , probably using either "is between angles" or "is within angle"
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat May 16, 2015 9:28 am

@LittleStain But when I press Right the character mirrors it self but the arms stay to the Left?

Could you show me an example? I don't get it :(

Here is my characters moves & what i did:
Image
B
8
S
3
Posts: 120
Reputation: 989

Post » Sat May 16, 2015 9:58 am

LittleStain wrote:Changing animation doesn't mean you have to hide them, you just change animation..

But I did my hands as a second sprite! Is that bad? Or I should of just placed it in the Player aniamtion? But then only hands will Animate ?
B
8
S
3
Posts: 120
Reputation: 989

Post » Sat May 16, 2015 2:04 pm

Anybody ?
B
8
S
3
Posts: 120
Reputation: 989

Post » Sat May 16, 2015 2:40 pm

Ok
Now you have you char and his arms and there pinned
Next make a statment that if player is mirrored than mirror arm else dont mirror arm
After that make your origin for your arm at the shoulder than repostion accoringly
Now youve done that you should than set arm angle to position and x and y is your mouse x and y
This should be done every tick
If you need more help feel free to post
Yo and tell me how it goes on monday yh
B
5
Posts: 24
Reputation: 279

Post » Sat May 16, 2015 2:41 pm

And fraps1k
Try completing more of the level becuaee your teacher wants something to show on wednessday
B
5
Posts: 24
Reputation: 279

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests