Game Development Reference
In-Depth Information
rectangles collide. Do not confuse RectangleShape with the FloatRect class
though, they serve different purposes—the former is for drawing and the latter is a simple
class for storing a rectangle's attributes (top, left, bottom, and right values).
The game logic itself is quite simple. If the player collides with the target square, the play-
er wins (the player should exit the game.) If the player collides with a bad rectangle, the
player loses (the player should restart the game.)
As you can imagine, there is nothing special about the render frame, you just have to draw
all three shapes in any order you wish and run the code. The result will be similar to this:
Feel free to change the code as much as you like and experiment with different settings
(add more shapes and build on the game logic maybe?).
Search WWH ::

Custom Search