How do I move my player

Get help using Construct 2

Post » Tue Aug 09, 2016 6:13 pm

I will make a game and I need to move the player(sprite) to my touch positing(If I move my finger right the player move right)
How do I move the player the same path my finger do?
B
3
Posts: 12
Reputation: 199

Post » Tue Aug 09, 2016 9:02 pm

I am unsure if what you want is the sprite to follow a path drawn by your finger, just following your finger or mimic a behavior where the sprite is "pinned" to the touch so it moves with your finger.

To have it where you touch a place and the sprite moves towards it. Add the Pathfinding behavior to the sprite then use an action
"On Touch" > "Find Path X: Touch.X - Y: Touch.Y"
"On Path Found" > "Move Along the Path"

To have it where the sprite moves all the time with your touch:
"On Touch" > "Set Position X: Touch.X - Y: Touch.Y"


Hope that helps.
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Tue Aug 09, 2016 9:39 pm

Message: grajwan1906 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Vallar wrote:I am unsure if what you want is the sprite to follow a path drawn by your finger, just following your finger or mimic a behavior where the sprite is "pinned" to the touch so it moves with your finger.

To have it where you touch a place and the sprite moves towards it. Add the Pathfinding behavior to the sprite then use an action
"On Touch" > "Find Path X: Touch.X - Y: Touch.Y"
"On Path Found" > "Move Along the Path"

To have it where the sprite moves all the time with your touch:
"On Touch" > "Set Position X: Touch.X - Y: Touch.Y"


Hope that helps.

I need something like in this game:
https://play.google.com/store/apps/deta ... rles&hl=en
If I do what you say it works?
B
3
Posts: 12
Reputation: 199

Post » Tue Aug 09, 2016 10:48 pm

I make multiplayer game, im a player and every 1 second the game create a ball and the ball move to the player.
The game work good but the peer can't move his player...
How do i fix this?
It is my event sheet:
Image
Image
Image
Image
B
3
Posts: 12
Reputation: 199

Post » Wed Aug 10, 2016 2:03 am

It looks like you're using pathfinding behaviour?

I think you have the time to locate the path set too short... every 0.1 seconds it is re-evaluating the path which will cause it not to move at all in most cases. You need to only look for a path every 1-2 seconds at least. Try that and see if it helps.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499

Post » Wed Aug 10, 2016 6:44 am

grajwan1906 wrote:
Vallar wrote:I am unsure if what you want is the sprite to follow a path drawn by your finger, just following your finger or mimic a behavior where the sprite is "pinned" to the touch so it moves with your finger.

To have it where you touch a place and the sprite moves towards it. Add the Pathfinding behavior to the sprite then use an action
"On Touch" > "Find Path X: Touch.X - Y: Touch.Y"
"On Path Found" > "Move Along the Path"

To have it where the sprite moves all the time with your touch:
"On Touch" > "Set Position X: Touch.X - Y: Touch.Y"


Hope that helps.

I need something like in this game:
https://play.google.com/store/apps/deta ... rles&hl=en
If I do what you say it works?


I couldn't check the game as your link is edited out (a security measure in the forums). Can you at least mention the game's name so I can check it out?
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Wed Aug 10, 2016 7:06 am

SoldjahBoy wrote:It looks like you're using pathfinding behaviour?

I think you have the time to locate the path set too short... every 0.1 seconds it is re-evaluating the path which will cause it not to move at all in most cases. You need to only look for a path every 1-2 seconds at least. Try that and see if it helps.

~Sol

I change this but if I change this the player only if I tap and I want the player move when I touch (tap and hold), and this not fix the problem... I can move my player but the enemy can't his player stuck.
B
3
Posts: 12
Reputation: 199

Post » Wed Aug 10, 2016 7:07 am

Message: grajwan1906 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Vallar wrote:
grajwan1906 wrote:
Vallar wrote:I am unsure if what you want is the sprite to follow a path drawn by your finger, just following your finger or mimic a behavior where the sprite is "pinned" to the touch so it moves with your finger.

To have it where you touch a place and the sprite moves towards it. Add the Pathfinding behavior to the sprite then use an action
"On Touch" > "Find Path X: Touch.X - Y: Touch.Y"
"On Path Found" > "Move Along the Path"

To have it where the sprite moves all the time with your touch:
"On Touch" > "Set Position X: Touch.X - Y: Touch.Y"


Hope that helps.

I need something like in this game:
https://play.google.com/store/apps/deta ... rles&hl=en
If I do what you say it works?


I couldn't check the game as your link is edited out (a security measure in the forums). Can you at least mention the game's name so I can check it out?

The name of the game his "charles" and I want to move the player like in this game.
B
3
Posts: 12
Reputation: 199

Post » Wed Aug 10, 2016 7:19 am

The enemy has the same problem... every 0.1 seconds it tries to find a path. It will never move if it has the find the path constantly. Change the time for enemy also.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499

Post » Wed Aug 10, 2016 7:20 am

You already have a thread about this problem. Please do not make multiple threads about the same issue.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests