MoveTo behavior request?

Discussion and feedback on Construct 2

Post » Fri Jul 18, 2014 4:48 pm

rexrainbow wrote:@megatronx

Do you mean that pause/resume the moving by action?


I would like to be able to cancel the previous movement coordinates. So lets say, I set move to X, Y, but in between I want to change those to another target. But as it is right now, the object will have to get to original target first before moving to the next. I would like to stop it, and move to new target even without it reaching original target.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
89
S
30
G
22
Posts: 1,985
Reputation: 20,099

Post » Fri Jul 18, 2014 5:00 pm

@megatronx

Uh... no, it would not. It will move to the latest target set by action. And there has an action to stop the moving.
B
108
S
26
G
267
Posts: 4,456
Reputation: 149,747

Post » Fri Jul 18, 2014 5:08 pm

I guess the argument here is we have lerp, and it can be more customized.
Of course the argument to that is you might not want the "ease in".
Image ImageImage
B
169
S
50
G
169
Posts: 8,285
Reputation: 108,214

Post » Fri Jul 18, 2014 5:45 pm

If i have a bird following the player and set the the bird speed at 200 and then i want the speed to be 250.
How can i do this with lerp?
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155

Post » Fri Jul 18, 2014 6:00 pm

lerp(self.x,target.x,yourspeed*dt)
lerp(self.y,target.y,yourspeed*dt)

Target, as well as yourspeed can be a variable.
Image ImageImage
B
169
S
50
G
169
Posts: 8,285
Reputation: 108,214

Post » Fri Jul 18, 2014 6:18 pm

newt wrote:lerp(self.x,target.x,yourspeed*dt)
lerp(self.y,target.y,yourspeed*dt)

Target, as well as yourspeed can be a variable.


This is a misuse of the lerp function, and should not be used (the ease in actually when you are using this is caused by the fact the distance between the self and the target is reduced, but the target will not be reached except if there are errors accumulating)

If you want to go from a to b, either move with clamp(self.x+speedx, self.x, target.x) (depending on where is the target, you might want to adapt the formula) or using lerp(initialx, target.x, percentage) with percentage increasing from 0 to 1
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Fri Jul 18, 2014 6:38 pm

@A0Nasser are you using this plugin with construct r175? I'm getting this error from construct:
'
" Unable to load plugin in ' C:"Program Files\Construct 2\exporters\html5\rex_moveto\' : Found "GetPluginSettings" global, but this is not a function. "
B
12
S
3
G
1
Posts: 188
Reputation: 1,377

Post » Fri Jul 18, 2014 6:48 pm

@vitorfgd
Yes i'm using it with r175 and it's work fine.

How did you upload it to C2?
You need to put the folder on the C2 behaviors path.
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155

Post » Fri Jul 18, 2014 6:57 pm

Damm, sorry, I'm used to the plugin cocoonjs and was putting this in plugins folder. Many thanks for the warning @A0Nasser. ; )
B
12
S
3
G
1
Posts: 188
Reputation: 1,377

Post » Fri Jul 18, 2014 7:11 pm

Aphrodite wrote:
newt wrote:lerp(self.x,target.x,yourspeed*dt)
lerp(self.y,target.y,yourspeed*dt)

Target, as well as yourspeed can be a variable.


This is a misuse of the lerp function, and should not be used (the ease in actually when you are using this is caused by the fact the distance between the self and the target is reduced, but the target will not be reached except if there are errors accumulating)

If you want to go from a to b, either move with clamp(self.x+speedx, self.x, target.x) (depending on where is the target, you might want to adapt the formula) or using lerp(initialx, target.x, percentage) with percentage increasing from 0 to 1


Its perfectly reasonable for something like this.
If you need it to be to the pixel add a wait x seconds, put a set xy to target xy, and change the Boolean that gave it movement to false.
Then again "to the pixel" isn't a very good idea either.
Image ImageImage
B
169
S
50
G
169
Posts: 8,285
Reputation: 108,214

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: Centra, Yahoo [Bot] and 4 guests