- Home /
Moving An Object Slowly and Indefinitely? [C#]
Hello!
I am currently working on a 2D game for a project for school in which you are jumping from one platform to the next; attempting to outpace the rising kill zone.
I am trying to get said kill zone to move up slowly and forever (until you die, of course!), but I seem to be having trouble getting it to move slow. Currently, it moves way too fast; faster than I can even see on-screen. I have tried co-routines and making the speed at which it moves up a very small number, but nothing I try seems to work.
Any help would be greatly appreciated. Thanks!
Current Script:
Answer by jchester07 · Oct 26, 2017 at 03:24 AM
Don't use coroutine. It moves too fast since you are adding speed directly to your position.
void Update()
{
transform.position += Vector2.up * speed;
}
It's easier this way. Vector2.up will add 1 unit to y axis to the killzone's current position. Adjust your speed as desired.
Your answer
![](https://koobas.hobune.stream/wayback/20220612141844im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
help with a player moving in a grid with obstacles 2d 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers