Move to a position problem

So i’m working on some sort of belt puzzle in my game and at the start of it my character has to “lock back” the belts by pulling them back into their place. Character simply pulls the lowest belt and the remaining 2 belts move back into the place. The problem is that i can’t seem to get the “Add Force to Move to a Position” event to work properly.

When the objects are above the X position i’ve wrote down it works lovely but if they are below the said position they’ll all freak out. One of the objects even go AWAY from the position.

Here is the code i’m using for it

Any help? I’ve tried “move towards an object” aswell that doesn’t work either

Hi @GrocKing …if you’re moving vertically up and down …you could just add or subtract say 2 to the y() or use lerp…which might be less problematic. What’s the event that changes the var to ‘none’?

I’m not vertically moving y coordinates basically keeps them “in place” i’m only moving on X coordinates

That’s the grabbing mechanic. Character grabs the lowest one and the above 2 gets into place when moving it back

Sorry…I got it the wrong way round…replace what I what I said with x…I thought when I sent it… should I check I’d got that the right way round and then got distracted!

1 Like

Yep that worked like a charm. A lot less code aswell. Thanks c:

1 Like

Mores sense would be to tween it to position

1 Like

This one works so not needed It moves pretty smooth since it only adds 2 pixels per frame. Works like a tween more or less.

Maybe you didn’t learn it the hard way like most of us did but sooner or later you will
You don’t use tween to smoothly move something
You more like use it to stop something somewhere where you want

I thought i’d be laughed out of town for suggesting x=x+2! ‘It’s not 1984 grandad!’ ‘Take your ‘plus fours’ - get back on your penny farthing and get out of here!!’
But it worked!! - I know it’s like repairing an ipad with a vacuum tube - but see above’ he’s happy!!

1 Like

I’m pretty much using the coordinates for that? It doesn’t move when it’s at certain coordinates.

Check how moving object toward some coordinates is different than tweening it there

And then you will have perfect understanding of what im talking about

The thing is that I believe he wants it to move at a set speed. To do that with a tween you need to work out how far the start position is from destination with an expression in the time parameter. I think it’s easier in this case to just add 2. If it’s starting from an x that is not a multiple of 2 and you want it to go to an exact location he could tween it when it’s within 4pixels of destination and then everyones happy.

What you think does not matter here
What you know and what you will check actually does

I know its possible to do it - but surely it’s simpler not to. What’s the harm in using x=x+2 once in a while?

Yeah that was the point exactly. Move with the character at certain speed as if the character is grabbing all 3 at the same time. It’s tied to key press and also has another condition in there to check for grabbing so it works. Not sure why is he so on about tweening.

Bruh

It does feel like there’s an x=x+2 party going on here and you keep coming in and turning the music off and telling everyone to stop having fun!
i understand what you’re saying and he could pause the tween when the s key is not pressed etc - but I’ve stepped out of a capsule from an era when every byte was precious and using a tween would have required 8k of my 16k rampack!

@petlimpet @GrocKing
You both act like i have some agenda behind using tweens over force

I HATE TWEENS
You two just fail to understand the issue which i already explained
None of you did what i told you to do just to test it
Cause if you would do it then there would be no argument here

Sooner or later you both will learn why you need tweens to move and stop object at certain position
And you will learn it the hard way like most of us did
And there will be no winners
I wish i could just use forces but that in many scenarios is not an option
If you can get away with forces then trust me be happy

1 Like

I’m not anti tweens at all! I use them all the time, and sometimes to nudge things to a position after using forces etc but i can’t really see the point of using one here, but I’m sure Grockling won’t mind trying it with a tween and seeing what happens…