Game Development Reference
In-Depth Information
Arguments Description
This function checks whether a button on a given joystick is
Joystick::isButtonPressed() ID, button
Let's now discuss one final example, which combines a lot of topics from this chapter. We
have taken a very simple game where the player plays as a green square, and he should
reach the blue square without touching anything red. The following is a helper function,
which helps us initialize similar RectangleShape objects easily and without much
code repetition:
The initShape() function is quite straightforward—it takes a shape, vector, color, and
assigns them to the RectangleShape object. The function also sets the origin point of
the shape to its center.
The next step is to initialize the objects:
Search WWH ::

Custom Search