mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
examples/platformer: add more descrpitive comments (#2866)
This commit is contained in:
parent
b8df1217c3
commit
c80a82c501
@ -113,6 +113,7 @@ func (c *char) draw(screen *ebiten.Image) {
|
||||
}
|
||||
|
||||
op := &ebiten.DrawImageOptions{}
|
||||
// Use a smaller scale than 1 to shrink the image.
|
||||
op.GeoM.Scale(0.5, 0.5)
|
||||
op.GeoM.Translate(float64(c.x)/unit, float64(c.y)/unit)
|
||||
screen.DrawImage(s, op)
|
||||
@ -141,15 +142,15 @@ func (g *Game) Update() error {
|
||||
}
|
||||
|
||||
func (g *Game) Draw(screen *ebiten.Image) {
|
||||
// Draws Background Image
|
||||
// Draws Background Image.
|
||||
op := &ebiten.DrawImageOptions{}
|
||||
op.GeoM.Scale(0.5, 0.5)
|
||||
screen.DrawImage(backgroundImage, op)
|
||||
|
||||
// Draws the Gopher
|
||||
// Draws the Gopher.
|
||||
g.gopher.draw(screen)
|
||||
|
||||
// Show the message
|
||||
// Show the message.
|
||||
msg := fmt.Sprintf("TPS: %0.2f\nPress the space key to jump.", ebiten.ActualTPS())
|
||||
ebitenutil.DebugPrint(screen, msg)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user