D
D
Denis Birkin2016-07-18 19:00:27
Programming
Denis Birkin, 2016-07-18 19:00:27

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.
ddde3a5d266f4b5c9593bc9f97b2a925.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Zhilin, 2016-07-18
@Anton3

box.switchMove(Move) // Что??
Movethis 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 persand choose which parameter to pass: Move.Left, Move.Right, Move.Upor Move.Down.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question