1 value - is the name of the game object, the following 4 parameters - its boundaries - the left upper point - x and y, and the lower right - also.
The last value - this is the scale factor - it is taken when calculating the boundaries.
Now create a file for a description of the properties - to establish a link between the objects and the boundaries of game objects
//
// description Ball properties
//
begin =;
Name = ball;
Collided = true;
end =;
//
// description Hole properties
//
begin =;
Name = hole;
Collided = true;
end =;
As you can see the description of a particular notation, ie. a meta-language.
Property Name - represents the ID of the game object to which will be attached property boundaries defined by the borders of the file.
Property Collided = true - means that will be used collision checking or otherwise collisions for a given game object. The value can be set in false. But in the context of this lesson to us for both objects need collision checking.
Real collisions not allow a single game object to pass through the other. For example, if a game player object encounters an enemy or a wall - it does not pass through it.
In our case it will set a slightly different behavior: the ball can pass through the hole. It will be only recorded the fact of falling into the hole and nothing else.
In other words, collision detection will work the usual way, and the results will be used a little differently - a natural phenomenon of repulsion of objects from each other will not be used.
To implement the collision check jumping balls with holes need to do the following:
In module
start.cpp
Include header files collision.h and game_object_properties.h -
change_moved_ball_TimePause(m_fTimeDelay);
hole_hit_TimePause(2.0f);
//check the ball contact with the hole
JumpedBallContactHole();
}
The implementation of other methods and their use you can look yourself in the code of module
start.cpp
Let me just note that in order to check the ball collision with the boundaries of the hole using a function call CollisionDetected, which checks whether the object boundaries intersect ball with hole object boundaries and if so - it is returned true.
If a collision is fixed - the plate for this hole (the front part of it is displayed), to simulate getting the ball in the hole. As soon as the ball moves away from the hole in the side - a collision will have to return false and plate for this hole is no longer displayed. Visually, the ball will just jump on the surface of the landscape.
Download the game finished simple game version 1.0.0 4.01.2017 (without sourse code).
Source code and other useful materials and tools you get with a paid subscription order !
Size: 51,8 Mb
To have the opportunity to create their own game on the basis of an example simple_game with unlimited possibilities of further expansion! - Subscribe to fle game engine -
Price:
13,333333333333
usd.
Subscribing to fle game engine You get an example of the game simple game with source code, and you can not just read everything that will be described below, but do yourself in your own application with the possibility of unlimited expansion. Also, you get
for the latest version Scene Editor fge 1.0.2 (on current moment) with support for more features: grid settings, scrolling, and more. In the free version, these features are not supported. more details about the distibutive of a paid subscription.