O
O
Oleg Komenda2018-02-01 17:13:22
C++ / C#
Oleg Komenda, 2018-02-01 17:13:22

How to prevent the character from going beyond the window?

Hello, I am writing a small game on sfml
And I ran into a question, I did not find an answer on the Internet.
There is a location:
5a73203ec7214622841252.jpeg
How to make it so that the character cannot go further than the end of the game window?
Thank you in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SagePtr, 2018-02-01
@rafamont

When moving, check the player's coordinates, and if they go beyond the window - do not change these coordinates and do not play the walking animation, as if there was no movement at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question