How do I make move to position?

0 favourites
From the Asset Store
Vector illustration of a UFO with an alien in three different positions.
  • How easily can I make similar behavior like plugin Rex´MoveTo? I want to move object to coordinates and when arrived then stop.

    Using C3 runtime, thanks a lot.

  • The latest Beta has Tween support: editor.construct.net/r123-2

    Add the behaviour and then "Tween two properties" to the new location.

  • Please can you show me some example? I am not adapt to new behavior. Thank you very much :)

  • blackhornettechnologies.com/Construct3Stuff/Samples/Ubru_MoveToTween.zip

    This moves to the touch point at a fixed velocity: 200 pixels per second. You can change that as you like.

  • I keep saying that MoveTo is not the same as tweening, but Ashely won't listen.. These two behaviors look similar, but serve different purposes.

    With tween you can't make an object to accelerate to max speed, move at constant speed for some time and then decelerate to zero and stop. Yes, you can use one of the "In-Out" functions or linear, but this will not be same.

    MoveTo can change direction and continue moving at the same speed to a new position. Tween can't do this.

    Tween can't be stopped by solids.

    With MoveTo you don't have to care about the time - you tell the sprite to move to a position and that's it, it will arrive when it will arrive. With tweening you need to calculate the duration, which depends on the distance, approximate speed and chosen function.

    The list goes on...

  • And is there any way to make it working like MoveTo? In C3 runtime I cannot use the Rex´s MoveTo am I right? I need it in my project, thanks for any advice.

  • And is there any way to make it working like MoveTo? In C3 runtime I cannot use the Rex´s MoveTo am I right? I need it in my project, thanks for any advice.

    Also I need to make similar thing like Rex´s RotateTo in C3 runtime (rotation with following angle of actual touch position with some speed and acceleration).

    I tried simply (it is without acceleration):

    every tick -> rotate 600*dt degrees toward (Touch.X, touch.Y)

    and this causes massive FPS drop on mobile (down to approx 25 FPS, only this event), how is it possible? How can I recreate in different way RotateTo ? Thank you.

  • every tick -> rotate 600*dt degrees toward (Touch.X, touch.Y)

    I tried this on a very old Android phone and I'm getting 60 pfs and 10-20% cpu utilization. So there must be something wrong with your project.

  • Ubru, I'd first try rotating, and moving, every 0.1 seconds instead of every tick.

  • I keep saying that MoveTo is not the same as tweening, but Ashely won't listen.. These two behaviors look similar, but serve different purposes.

    With tween you can't make an object to accelerate to max speed, move at constant speed for some time and then decelerate to zero and stop. Yes, you can use one of the "In-Out" functions or linear, but this will not be same.

    MoveTo can change direction and continue moving at the same speed to a new position. Tween can't do this.

    Tween can't be stopped by solids.

    With MoveTo you don't have to care about the time - you tell the sprite to move to a position and that's it, it will arrive when it will arrive. With tweening you need to calculate the duration, which depends on the distance, approximate speed and chosen function.

    The list goes on...

    What would the differences between moveto and bullet be (I haven't used moveto)? Sounds the main addition would be setting a target destination and rounding/truncating the last step for precise movement. Maybe adding this functionality to the bullet behavior would be good?

  • Hi again sorry for maybe little confusing desription, I am still trying different things and looking for reason of low FPS.

    I created simple new project with few elements and here is it:

    https://drive.google.com/open?id=1rBa2b6jAsPoJPC8FcDwj4mfImjj4kOua

    Play it via Remote preview on mobile and tap X-times (5-7 is enough) every tap on screen will spawn charge object with 30 frame animation (loop) and in container with charge is also another object with one frame and overlay effect. With more these objects on screen my FPS going down (6 object -> 32 FPS, 7 objects -> 28 FPS, 10 objects -> 22 FPS etc).

    What is wrong with it, it is only object with animation and one frame with overlay graphic effect no more. I cannot use overlay effect? Thanks for advice, this time I hope it is more clear.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I also tried only spawning that object with one frame and overlay effect alone, and after spawning more objects (7-8 and more) FPS is going down rapidly. So it seems that only overlay effect is draining too much FPS so what can I do if I need it multiple-times in my projects?

  • I got an idea :) create new layer and set overlay to it (so only 1 overlay effect at all) and move all object to this layer. It solved my problem.

  • Yeah, effects are slow on mobile. If you have lots of small sprites with effect, it's better to apply it to a layer.

  • What would the differences between moveto and bullet be (I haven't used moveto)? Sounds the main addition would be setting a target destination and rounding/truncating the last step for precise movement. Maybe adding this functionality to the bullet behavior would be good?

    oosyrag I guess it can be added to bullet.

    MoveTo also has MaxSpeed setting, and different settings for acceleration and deceleration. So it's very easy to make natural looking movements - the object speeds up, moves at constant speed and then slows downs to stop. Making the same with bullet will require a lot of events...

    Pathfinding comes close to this, but it has its own issues - you need to find the path first, and sometimes the object does not stop precisely where it should.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)