This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
guides:beginners:text_and_game_over [2017/05/29 21:50 (7 years ago)] – external edit 127.0.0.1 | en:guides:beginners:text_and_game_over [2023/03/28 21:13 (13 months ago)] (current) – iarwain | ||
---|---|---|---|
Line 15: | Line 15: | ||
[ScoreObject] | [ScoreObject] | ||
Graphic | Graphic | ||
- | Position = (20, 20, 0) | + | Position = (-380, -280, 0) |
</ | </ | ||
- | Interesting to note the special Text definition. ScoreGraphic uses this instead of a texture from file. And the ScoreObject uses the graphic section as others before. | + | Interesting to note the special |
Now, in code, add a score variable and a scoreObject at the top of the file: | Now, in code, add a score variable and a scoreObject at the top of the file: | ||
Line 42: | Line 42: | ||
orxCHAR formattedScore[6]; | orxCHAR formattedScore[6]; | ||
- | | + | |
orxObject_SetTextString(scoreObject, | orxObject_SetTextString(scoreObject, | ||
Line 48: | Line 48: | ||
</ | </ | ||
- | Add 250 points whenever a monster is hit with a bullet: | + | Add 250 points whenever a monster is hit with a bullet. Add UpdateScore() function calls to: |
< | < | ||
Line 66: | Line 66: | ||
</ | </ | ||
- | And of course, 1000 points bonus if the star is reached: | + | And of course, 1000 points bonus if the star is reached. Add the following code: |
< | < | ||
Line 86: | Line 86: | ||
A final thing for the game will be to add a game over panel when the hero dies. For this, we'll have an object that gets created using a timeline track after a two second delay. First, a game over asset: | A final thing for the game will be to add a game over panel when the hero dies. For this, we'll have an object that gets created using a timeline track after a two second delay. First, a game over asset: | ||
- | {{ tutorials:community: | + | {{ tutorials:tracks: |
- | Save this into the data/object | + | Save this into the '' |
Create a simple gameover graphic and object: | Create a simple gameover graphic and object: | ||
Line 95: | Line 95: | ||
[GameOverGraphic] | [GameOverGraphic] | ||
Texture = gameover.png | Texture = gameover.png | ||
+ | Pivot = center | ||
[GameOverObject] | [GameOverObject] | ||
Graphic | Graphic | ||
- | Position = (280, 250, -0.1) | + | Position = (0, 0, -0.1) |
</ | </ | ||
- | Create a timeline track with a single command to create the GameOverObject: | + | Create a timeline track with a single command to create the '' |
< | < | ||
Line 108: | Line 109: | ||
</ | </ | ||
- | Then finally | + | Then finally, change |
< | < | ||
Line 140: | Line 141: | ||
</ | </ | ||
- | And then set the variable on the orxObject_CreateFromConfig(" | + | And then set the '' |
< | < | ||
Line 152: | Line 153: | ||
Well friends, that's game over. If you reached the end here, great job! You've learned many of the major features of Orx. | Well friends, that's game over. If you reached the end here, great job! You've learned many of the major features of Orx. | ||
- | If you need more help, go to the [[tutorials: | + | If you need more help, go to the [[en:tutorials:main|tutorials]] section where many of these concepts are covered in greater detail. |
- | If you need quick examples, you can visit the [[examples: | + | If you need quick examples, you can visit the [[en:examples:]] section and search by subject. |
- | If you get stuck, please post it to the [[http:// | + | If you get stuck, please post it to the [[http:// |
- | {{section> | + | {{section> |