Answer the question
In order to leave comments, you need to log in
How to make coordinate dependency swift?
I've only been studying for a couple of weeks. Prior to this, I had never done programming at all. From which I get very confused in the syntax =( And often I can’t understand why this or that entry does not work.
Task: 4. Now the most interesting thing is that the character can move the box if it is in the place where the character wants to go. The main thing is that none the object can't leave the room Move the box :)
Q: why can't I write something like "if pers.x == box.x etc" like this: box.switchMove(Move).
It seems to me logically explaining that, on the condition, move the box along the same coordinate axes of the Box.
Answer the question
In order to leave comments, you need to log in
box.switchMove(Move) // Что??
Move
this is the name of the type, it cannot be used here. And box.switchMove(Move.Left)
so on, you can write. That is, you need to calculate in which direction you moved pers
and choose which parameter to pass: Move.Left
, Move.Right
, Move.Up
or Move.Down
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question