How do I move to a position ?

Get help using Construct 2

Post » Fri Nov 13, 2015 10:35 am

Hai.

I know there is a move to position action, but it just move there in one step.
What if i need to move at a certain speed toward a direction ?

i saw there is set angle and move forward actions, but this makes the sprite rotate. Wich i don't want..
There's also using the lerp(self.X,target.X,percentage) that works, but it'll only ease out and i can't control the speed.

Someone knows ?
Thanks a lot :s
twitch.tv/neozoom/
Dev stream from time to time !
@FireCamp_games <-- twitter
B
6
S
2
G
2
Posts: 52
Reputation: 969

Post » Fri Nov 13, 2015 10:38 am

Two user created plugins come to mind - 'Move To' by RexxRainbow and 'Liteween'.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,374
Reputation: 58,430

Post » Fri Nov 13, 2015 10:39 am

you need a plugin to set a vector movement ....? hu... ok. i'll check then.
thank you

PS: but there is no other way than using pugin ? (just asking)
twitch.tv/neozoom/
Dev stream from time to time !
@FireCamp_games <-- twitter
B
6
S
2
G
2
Posts: 52
Reputation: 969

Post » Fri Nov 13, 2015 10:43 am

You could look at the move to example shipped with Construct2..
It uses the bullet behaviour..
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 » Fri Nov 13, 2015 10:47 am

I was still editing my post - adding links - when you responded.

I was also going to mention the bullet behavior, but LittleStain has already beat me to it.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,374
Reputation: 58,430

Post » Fri Nov 13, 2015 10:48 am

Thanks ! i'll check that

Or maybe make a function that i can use anywhere, with Custom movements or i dunno
twitch.tv/neozoom/
Dev stream from time to time !
@FireCamp_games <-- twitter
B
6
S
2
G
2
Posts: 52
Reputation: 969

Post » Fri Nov 13, 2015 10:53 am

Ok i see for the bullet example, but it rotates the sprite.
You cannot set angle to position without rotating the sprite... so that doesn't do it for me.
twitch.tv/neozoom/
Dev stream from time to time !
@FireCamp_games <-- twitter
B
6
S
2
G
2
Posts: 52
Reputation: 969

Post » Fri Nov 13, 2015 11:05 am

Ok, i finally found how to install and use MoveTo " by Rex, seriously this thing is crazy useful.
Why not in C2 ? like , it shouldn't be hard to implement it no ?
even like this as it is, just add rex's folder (if he accept) into the install of the software ?

Thank you so much anyway, i'll gain soooo much time now. :)
twitch.tv/neozoom/
Dev stream from time to time !
@FireCamp_games <-- twitter
B
6
S
2
G
2
Posts: 52
Reputation: 969

Post » Fri Nov 13, 2015 11:21 am

WeneW wrote:Ok i see for the bullet example, but it rotates the sprite.
You cannot set angle to position without rotating the sprite... so that doesn't do it for me.


You could just set "set angle" to "no" in the bullet properties..
And instead of using set angle, set the angle of motion of the bullet..
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 » Fri Nov 13, 2015 11:27 am

LittleStain wrote:
WeneW wrote:You could just set "set angle" to "no" in the bullet properties..
And instead of using set angle, set the angle of motion of the bullet..


No. because set angle of motion ask a degree. Wich i don't have. I have a target (object .X and Y) and thats all.

Its a big hole in C2 i think, to at least not have a kind of "lengthdir" function in it...
People could easily code their own tween movements with events if there was just that.
or a simple option "move toward position" with a pixel per tick.

But , you can still use a var to store the angle toward position, then reset angle of the object to 0.
And use this var to set angle of motion.... it works, but OMG its complicated for such a small thingy.


Anyway LiteTween is better i find than moveTo. Hope it'll be stable :s seems pretty heavy behavior
twitch.tv/neozoom/
Dev stream from time to time !
@FireCamp_games <-- twitter
B
6
S
2
G
2
Posts: 52
Reputation: 969

Next

Return to How do I....?

Who is online

Users browsing this forum: newt, Nicolas951, rayolf and 21 guests