Move object and then?

how can I make an object go through for example tot pixels and then make it go back???
or delete it… or rare other of my choice based on needs???
what do I know… for example I want to move a car from position x 100 to position x 350…???
thank you in advance

Hi urkokan

tot = total?

rare?

I’m probably not the only one who doesn’t understand what you’re trying to do. Can you give more detail and/or a drawing of what you want?

1 Like

I’m taking a guess at what @urkokan is after.

I think a tween would be suitable. Use the x positional tween to get the car to move from one position to another.

ops damn translation…I don’t know why the translator translated this way…“tot” I was trying to say an undefined amount of pixels… and by “rare” I meant OTHER to my liking…

would you be so kind as to write me the command???
but inserting a behavior doesn’t weigh down the program?? I’m always a little cold before putting behaviors to objects…

I understand by reading the article you sent me that I could also define the distance that a bullet can travel in this way… if I want it to be 100 pixels it would be enough to say from Player.pointx(“firepoint”) to Player.pointx (“firepoint”)+100 in a platform maybe but in a topdown ?? Player.pointy(“firepoint”)?? Is what I think correct?

Hi again Urkokan. If you read this wiki page it says to be aware of the performance drop if you use physics or platform behaviors on many many objects. But in gerneral I don’t think you should worry about it. GDevelop uses behaviors and so should you!

I still don’t understand your problem properly but the best thing you can do is just try things and see what happens.

And then if you have problems, show us screenshots of your events. If we can see what you’ve tried, then it won’t matter so much if the translations aren’t perfect.

https://wiki.gdevelop.io/gdevelop5/tutorials/how-to-debug-poor-performance#fps_counter

tnk you for your answer

i want a saw go form left and right… but this way not working…
or rather… it works but it jerks towards the end… and too fast…
it does most of the way in an instant and then slows down in the very last part of the way

Thanks for posting our events Urkokan. I can’t have a good look now but you have a huge game area. And you’re tweening the object across a large distance in half a second. What happens if you increase it to a longer time, for example 1.5 seconds (1500ms)?

I noticed you’re saying to toggle the boolean value. That’s useful for some things but if I can, I just use the set boolean variable to true/false action instead. It’s less confusing.

no I just copied the same instructions I had for making the objects pulsate…

I actually found a road… and this is it… but I’m afraid it’s dirty… because it was too simple and sometimes simple solutions ruin everything…

Having fixed points that are hardcoded in your events is bad programming practice and makes it very specific and not reusable.

Instead, if you look at the example platformer project that you can generate in GDevelop, the movement is controlled by 2 turn-around objects that the saw would move between. You start the saw in a direction by changing it’s X position. When it hits a turn-around object, separate the saw and turn-around object, and reverse the direction of the saw.

are you talking about putting a hitbox for the saw?

No, though the saw has a default hitbox.

Create a new project from he platformer template in GDevelop, and check how the objects are moved back and forth in that.