How do I make a sprite go to a position over time?

Just started using Construct 2? Post your questions here

Post » Mon Jan 04, 2016 1:31 am

Probably one of the biggest beginner questions in existence, but I honestly can't find anything about this!

All I want to do is have a sprite go to a location (at a consistent speed throughout) in a specific time, and stop once it's there. That's really it!

Here's an image of what I want to do if it's needed. You can ignore the text.

Image

I really don't know how else to explain this further because it's such a simple thing that I can't seem to work out. If anyone could just let me know the proper way to go about this, I'd really appreciate it.

As a quick sidenote, I do not mean having a sprite that always goes the same speed to a location - because then if the distance is a lot smaller in one occasion compared to usual, it'll finish it much faster than a longer distance. What I'm wanting is for the time this movement happens in to always be the same. So the one moving a smaller distance will move slower to ensure it takes the same amount of time.
B
7
S
1
G
1
Posts: 11
Reputation: 527

Post » Mon Jan 04, 2016 1:53 am

Haha I know, it is something quite simple and we need to use it all the time, but it is complex. The easiest option that I always use, is using rexrainbow's moveto plugin: viewtopic.php?f=153&t=63156&hilit=moveto

If you want it to have an ease in and out speed effect, you will need to use lerp: viewtopic.php?t=64020&start=0#286732
B
45
S
23
G
31
Posts: 692
Reputation: 20,610

Post » Mon Jan 04, 2016 1:55 am

you can do this easily with bullet behaviour, there is a moveto example in the new project dialog..

Just set the speed based on the distance..
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 » Mon Jan 04, 2016 2:19 am

rekjl wrote:Haha I know, it is something quite simple and we need to use it all the time, but it is complex. The easiest option that I always use, is using rexrainbow's moveto plugin


Thanks! That plugin is exactly the type of thing I was looking for.

Just as one last question, how would I set the speed to be correct depending on the position the sprite is going to be moving to?

What I mean is that if I wanted a sprite to get to a position within 1 second exactly, the speed would change accordingly to ensure it takes exactly that long, no matter what the distance is. It'd move quicker if the distance was large and slower if the distance was small because of this. Do you know a 'proper' way to calculate this? My horrible workarounds have always been these extreme mess of events that never really work out that well. (You can probably tell I'm a real newbie with this!)

Edit: Never mind this, I'm going with the LiteTween plugin. (Check the post below.)
Last edited by Frisk on Mon Jan 04, 2016 1:44 pm, edited 1 time in total.
B
7
S
1
G
1
Posts: 11
Reputation: 527

Post » Mon Jan 04, 2016 3:57 am

LIteTween is another option, and is time based.
viewtopic.php?t=70700&start=0
ImageImageImage
B
71
S
21
G
232
Posts: 3,695
Reputation: 129,866

Post » Mon Jan 04, 2016 1:42 pm

Message: Frisk is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
blackhornet wrote:LIteTween is another option, and is time based.


Ah, this one is perfect. All I need to use here is the linear option and change the duration / position for each location, and it works flawlessly. Many thanks!
B
7
S
1
G
1
Posts: 11
Reputation: 527


Return to Beginner's Questions

Who is online

Users browsing this forum: FartsLolz, Google [Bot] and 2 guests