How do I can enable the player movement with mouse

Get help using Construct 2

Post » Wed Feb 27, 2013 1:34 pm

I have created a game and upload it to the windows store 7 times and still receiving the same error. with the mouse controls. how can i enable the player movement with the mouse control?
that is, if i move the mouse means the player must move with its direction.
B
16
S
1
G
1
Posts: 10
Reputation: 968

Post » Wed Feb 27, 2013 1:42 pm

Im not quite sure what u mean but i think you need the player to be where the mouse pointer is?
If thats the idea, you just need to add a Mouse object and make a event like

System, Every thick / Set position of Player to x - Mouse.X y - Mouse.Y

Sry if i misunderstood you
B
12
S
3
G
1
Posts: 120
Reputation: 1,829

Post » Wed Feb 27, 2013 1:52 pm

If your trying to make a platform where the player moves towards the mouse then you'll need to set up some code to check where the mouse is compared to where the player is.
If play.X > mouse.X then play.X = simulate move left
B
13
S
2
Posts: 87
Reputation: 1,244

Post » Fri Mar 01, 2013 12:29 pm

Thank you so much. That's exactly i needed.
Please provide one more information. i have a sprite object that catches everything falling from the sky. and i want it to stay in the floor and when i move the mouse along with it, it needs to move only in left and right. not in 8 direction. ?
B
16
S
1
G
1
Posts: 10
Reputation: 968

Post » Fri Mar 01, 2013 12:30 pm

@Pakost
B
16
S
1
G
1
Posts: 10
Reputation: 968

Post » Fri Mar 01, 2013 12:54 pm

[QUOTE=abinorathel] Thank you so much. That's exactly i needed.
Please provide one more information. i have a sprite object that catches everything falling from the sky. and i want it to stay in the floor and when i move the mouse along with it, it needs to move only in left and right. not in 8 direction. ?
[/QUOTE]

Every tick
.. set sprite.X to Mouse.X
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Fri Mar 01, 2013 7:00 pm

Yup, that should do the trick.
B
12
S
3
G
1
Posts: 120
Reputation: 1,829

Post » Sat Mar 09, 2013 1:54 pm

@vee41
thank you buddy. It is correctly working
B
16
S
1
G
1
Posts: 10
Reputation: 968


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 18 guests