User Tools

Site Tools


en:guides:beginners:text_and_game_over

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
en:guides:beginners:text_and_game_over [2018/02/13 20:47 (6 years ago)] – ↷ Links adapted because of a move operation iarwainen:guides:beginners:text_and_game_over [2018/06/29 05:38 (6 years ago)] – In line with init projects sausage
Line 15: Line 15:
 [ScoreObject] [ScoreObject]
 Graphic  = ScoreGraphic Graphic  = ScoreGraphic
-Position = (2020, 0)+Position = (-380-280, 0)
 </code> </code>
  
-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 ''Text'' definition. ''ScoreGraphic'' uses this instead of a texture from file. And the ''ScoreObject'' uses the graphic section as others before.
  
 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 48: Line 48:
 </code> </code>
  
-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:
  
 <code=cpp> <code=cpp>
Line 66: Line 66:
 </code> </code>
  
-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:
  
 <code=cpp> <code=cpp>
Line 88: Line 88:
 {{ tutorials:community:sausage:gameover.png?nolink |}} {{ tutorials:community:sausage:gameover.png?nolink |}}
  
-Save this into the data/object folder as "gameover.png".+Save this into the ''data/texture'' folder as "gameover.png".
  
 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  = GameOverGraphic Graphic  = GameOverGraphic
-Position = (280250, -0.1)+Position = (00, -0.1)
 </code> </code>
  
-Create a timeline track with a single command to create the GameOverObject:+Create a timeline track with a single command to create the ''GameOverObject'':
  
 <code=ini> <code=ini>
Line 108: Line 109:
 </code> </code>
  
-Then finally in the physics handler code, when the hero is destroyed, create the timeline track. After a two second delay, the GameOverObject will be created on screen:+Then finally, change the physics handler code, so that when the hero is destroyed, create the timeline track. After a two second delay, the ''GameOverObject'' will be created on screen:
  
 <code=cpp> <code=cpp>
Line 140: Line 141:
 </code> </code>
  
-And then set the variable on the  orxObject_CreateFromConfig("Scene") in the init() function:+And then set the ''scene'' variable on the  orxObject_CreateFromConfig("Scene") in the init() function:
  
 <code=cpp> <code=cpp>
en/guides/beginners/text_and_game_over.txt · Last modified: 2023/03/28 21:13 (13 months ago) by iarwain