Unity 2D Player can edit objects and make them move and rotate with script
Budget: $40 – $70 USD
Hello, I’m developing level editor for 2D game where I have already finished everything except making loop rotation and movement animations. When player places new object it can then select it and choose one of few options: move, rotate, duplicate, remove, scale, ANIMATE. So there are two tasks to do:
1. Make ability to create loop movement animations. When player clicks on button “Movement Animation” there appears menu with 2 sliders (speed slider, pause time slider) and 2 buttons (modes of animations). There also creates two points (like at the image), first points appears at the coordinates of object and the second point appears at 0 coordinates, there is also a line which connects two points. Player can move the points by dragging them. When player clicks on button “Add” there appears third point and the other connections line which now connects second and third point (see the image) etc for infinity amount of points. When player clicks on button “Remove” the last point is being removed. The main thing is to make working moving script (place it in the Obstacle.cs), so the object will move from point 1, to point 2, then to point 3 if it created, then to point 4 etc.
If player chooses first mode, the animation will end at the last point, the object will teleport to the point 1 and it all starts again. If player chooses second mode, at the last point the object will return back through the same route (let’s say first mode is 1-2-3-4 |pause| 1-2-3-4-… while the second mode is 1-2-3-4-3-2-1 |pause| 1-2-3-4-…).
The object is moving with the speed which can be changed with slider, the duration of pause is also changed with the slider.
2. Make ability to create loop rotation animations. When player clicks on button “Rotation Animation” there appears menu with 2 sliders (speed slider, pause time slider), 3 buttons (modes of animations) and input field (angle).
If player chooses the first mode, the object will rotate clockwise, wait a pause and repeat the process. Same for the second mode but it will rotate anti-clockwise. For the third mode it will rotate clockwise and after it reaches required angle, wait a pause and then go back anti-clockwise, wait a pause and repeat the process.
The object will rotate with the speed chosen in slider and the pause also chosen in slider. Similar to the movement animation, the rotating script must be put into the Obstacle.cs, so the object will have animation even if I put it into the prefab and instantiate it at the other scene.
Conclusion: Unity version is Unity 2021.1.25f1. Please note one more time, the thing is that there could be a lot of objects and all of them have the same script "Obstacle.cs" which could get float values of speed,pause, as well as int value of mode selected. Then in Update function (or any other) you should make movement/rotating animation with the values player can change in the game.
1. Make ability to create loop movement animations. When player clicks on button “Movement Animation” there appears menu with 2 sliders (speed slider, pause time slider) and 2 buttons (modes of animations). There also creates two points (like at the image), first points appears at the coordinates of object and the second point appears at 0 coordinates, there is also a line which connects two points. Player can move the points by dragging them. When player clicks on button “Add” there appears third point and the other connections line which now connects second and third point (see the image) etc for infinity amount of points. When player clicks on button “Remove” the last point is being removed. The main thing is to make working moving script (place it in the Obstacle.cs), so the object will move from point 1, to point 2, then to point 3 if it created, then to point 4 etc.
If player chooses first mode, the animation will end at the last point, the object will teleport to the point 1 and it all starts again. If player chooses second mode, at the last point the object will return back through the same route (let’s say first mode is 1-2-3-4 |pause| 1-2-3-4-… while the second mode is 1-2-3-4-3-2-1 |pause| 1-2-3-4-…).
The object is moving with the speed which can be changed with slider, the duration of pause is also changed with the slider.
2. Make ability to create loop rotation animations. When player clicks on button “Rotation Animation” there appears menu with 2 sliders (speed slider, pause time slider), 3 buttons (modes of animations) and input field (angle).
If player chooses the first mode, the object will rotate clockwise, wait a pause and repeat the process. Same for the second mode but it will rotate anti-clockwise. For the third mode it will rotate clockwise and after it reaches required angle, wait a pause and then go back anti-clockwise, wait a pause and repeat the process.
The object will rotate with the speed chosen in slider and the pause also chosen in slider. Similar to the movement animation, the rotating script must be put into the Obstacle.cs, so the object will have animation even if I put it into the prefab and instantiate it at the other scene.
Conclusion: Unity version is Unity 2021.1.25f1. Please note one more time, the thing is that there could be a lot of objects and all of them have the same script "Obstacle.cs" which could get float values of speed,pause, as well as int value of mode selected. Then in Update function (or any other) you should make movement/rotating animation with the values player can change in the game.