The ball will be displayed if z = 0.8999f instead z = 0.909f
For large values of z the ball is overlapped by other images. That is why it is not visible. Background with coordinates z = 0.9f, compared with a ball having a coordinate z = 0.909f, it is closer to the observer (z values smaller - closer to the observer, great - far away from the observer), and just covers it.
If you look closely at the code that was inserted according to the instructions on the page 4, you probably guess that methods
g_Splash.Anim(); //this is what you find
g_AI_Ball_Sprite.Anim(); //this is what you need to add
g_Splash.Draw(); //this is what you find
g_AI_Ball_Sprite.Draw(); //this is what you need to add
Animate and draw our ball.
Try commenting out one of them - g_AI_Ball_Sprite.Draw() или g_AI_Ball_Sprite.Anim() and recompile application.
//g_AI_Ball_Sprite.Anim(); //if you comment out this line - the ball will stop animated, ie, will not jump
If you comment out g_AI_Ball_Sprite.Draw()
//g_AI_Ball_Sprite.Draw(); //if you comment out this line - the ball is not visible at all.
Now let's take a look at the output characteristics of sprites in games.
If you read readme.txt attached to utility Coords2D, which allows you to configure the sprites and animations, you know what each of the options means.
Let's start in order.
name - is the name of the file loaded sprite;
x, y, z - coordinates of its display. Moreover, the x and y may be vector - the values of which are independent of the current screen resolution on-screen and can be set in pixels - depending on screen resolution.
Vector coordinates are defined by values from -1.0f to 1.0f and are versatile, allowing you to display sprites on any screen resolutions in approximately equal parts of it. Do not need to take any additional measures to take account of the current resolution of the screen the user running the application.
Below, we will understand how to use both of them.
xScale, yScale - scale output sprite along the x and y - value 1.0f - sprite display in natural size. Values smaller 1.0f - reduce sprite, great value - increase.
Width, Height - width and height in pixels of the sprite.
xOffset, yOffset - prior to displacement in pixels of the sprite. It makes sense if the sprite is placed within the image offset or used multisprite - Ie, an image that contains within itself several different sprites.
Save the changes and restart the application simple_game, if you were running.
The ball will be displayed in almost the center of the screen, but slightly below its.
Here, because if you remember, our animation looks like a ball -
Therefore, positioning the center of the screen sprite, we will get a slight shift down - because the ball inside the sprite is shifted down. In other words, the center of the sprite - this is the upper left corner, not the center of the ball.
Therefore, when you display sprites in the game, consider the possible shift of the center and enter the appropriate amendment.
So that turned out to be our ball exactly in center of the screen, in the code of its output in the module