This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
en:guides:beginners:text_and_game_over [2024/11/12 18:12 (5 months ago)] – Removing forum sausage | en:guides:beginners:text_and_game_over [2024/11/19 04:21 (4 months ago)] (current) – Highlights sausage | ||
---|---|---|---|
Line 16: | Line 16: | ||
Graphic | Graphic | ||
Position = (-380, -280, 0) | Position = (-380, -280, 0) | ||
+ | Scale = 2 | ||
</ | </ | ||
Line 22: | Line 23: | ||
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: | ||
- | < | + | < |
orxOBJECT *hero; | orxOBJECT *hero; | ||
orxOBJECT *herosGun; | orxOBJECT *herosGun; | ||
Line 31: | Line 32: | ||
Next, create a score object and assign it to the scoreObject variable in the Init() function: | Next, create a score object and assign it to the scoreObject variable in the Init() function: | ||
- | < | + | < |
+ | hero = orxObject_CreateFromConfig(" | ||
+ | herosGun = (orxOBJECT*)orxObject_GetChild(hero); | ||
scoreObject = orxObject_CreateFromConfig(" | scoreObject = orxObject_CreateFromConfig(" | ||
</ | </ | ||
Line 50: | Line 53: | ||
Add 250 points whenever a monster is hit with a bullet. Add UpdateScore() function calls to: | Add 250 points whenever a monster is hit with a bullet. Add UpdateScore() function calls to: | ||
- | < | + | < |
if (orxString_Compare(senderObjectName, | if (orxString_Compare(senderObjectName, | ||
CreateExplosionAtObject(pstRecipientObject, | CreateExplosionAtObject(pstRecipientObject, | ||
Line 68: | Line 71: | ||
And of course, 1000 points bonus if the star is reached. Add the following code: | And of course, 1000 points bonus if the star is reached. Add the following code: | ||
- | < | + | < |
if (orxString_Compare(senderObjectName, | if (orxString_Compare(senderObjectName, | ||
orxObject_SetLifeTime(pstSenderObject, | orxObject_SetLifeTime(pstSenderObject, | ||
Line 88: | Line 91: | ||
{{ tutorials: | {{ tutorials: | ||
- | Save this into the '' | + | Save this into the '' |
Create a simple gameover graphic and object: | Create a simple gameover graphic and object: | ||
Line 111: | Line 114: | ||
Then finally, change the physics handler code, so that when the hero is destroyed, create the timeline track. After a two second delay, the '' | Then finally, change the physics handler code, so that when the hero is destroyed, create the timeline track. After a two second delay, the '' | ||
- | < | + | < |
if (orxString_Compare(recipientObjectName, | if (orxString_Compare(recipientObjectName, | ||
orxString_Compare(senderObjectName, | orxString_Compare(senderObjectName, | ||
Line 131: | Line 134: | ||
</ | </ | ||
- | Because we never had a reference to the scene before in order to add the PopUpGameOverTrack, | + | Because we never had a reference to the '' |
- | < | + | < |
orxOBJECT *hero; | orxOBJECT *hero; | ||
orxOBJECT *herosGun; | orxOBJECT *herosGun; | ||
Line 141: | Line 144: | ||
</ | </ | ||
- | And then set the '' | + | And then set the '' |
- | < | + | < |
+ | scoreObject = orxObject_CreateFromConfig(" | ||
+ | orxObject_Enable(herosGun, | ||
scene = orxObject_CreateFromConfig(" | scene = orxObject_CreateFromConfig(" | ||
</ | </ |