C
C
CSharpMutant2021-05-22 19:04:27
C++ / C#
CSharpMutant, 2021-05-22 19:04:27

How to return the position of an object back?

I'm making a perfect slice game - the essence of the fruit cutting game.
I have one problem, I can’t solve it in any way, the thing is this: I have a knife, after pressing mouse (0) it changes the rotation value in z to 90. Pressing it again flips another 90.
I need to make it so that it after it reaches the 90 degree z position, it returns back to the starting position.
Strangely written, but please help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IDzone-x, 2021-05-23
@IDzone-x

Well, I didn’t understand much, but here’s an example of how you can:
(Carefully pseudo code)

private bool  _dir = 1;
...
if(mouse.down(0) 
{
    "Какая-то хрень с ножом"(градус * _dir);
    _dir = -_dir;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question