Golint
This commit is contained in:
parent
10f04b58be
commit
468b700d5d
14 changed files with 130 additions and 124 deletions
|
@ -18,19 +18,19 @@ const (
|
|||
spriteSize = 48
|
||||
)
|
||||
|
||||
// Floppy
|
||||
// Floppy type
|
||||
type Floppy struct {
|
||||
Position raylib.Vector2
|
||||
}
|
||||
|
||||
// Pipe
|
||||
// Pipe type
|
||||
type Pipe struct {
|
||||
Rec raylib.Rectangle
|
||||
Color raylib.Color
|
||||
Active bool
|
||||
}
|
||||
|
||||
// Game
|
||||
// Game type
|
||||
type Game struct {
|
||||
ScreenWidth int32
|
||||
ScreenHeight int32
|
||||
|
@ -60,7 +60,7 @@ type Game struct {
|
|||
PipesSpeedX int32
|
||||
}
|
||||
|
||||
// New Game
|
||||
// NewGame - Start new game
|
||||
func NewGame() (g Game) {
|
||||
g.Init()
|
||||
return
|
||||
|
@ -119,7 +119,7 @@ func run(app unsafe.Pointer) {
|
|||
os.Exit(0)
|
||||
}
|
||||
|
||||
// Initialize game
|
||||
// Init - Initialize game
|
||||
func (g *Game) Init() {
|
||||
// Window resolution
|
||||
g.ScreenWidth = 504
|
||||
|
@ -173,7 +173,7 @@ func (g *Game) Init() {
|
|||
g.Pause = false
|
||||
}
|
||||
|
||||
// Load resources
|
||||
// Load - Load resources
|
||||
func (g *Game) Load() {
|
||||
g.FxFlap = raylib.LoadSound("sounds/flap.wav")
|
||||
g.FxSlap = raylib.LoadSound("sounds/slap.wav")
|
||||
|
@ -182,7 +182,7 @@ func (g *Game) Load() {
|
|||
g.Texture = raylib.LoadTexture("images/sprite.png")
|
||||
}
|
||||
|
||||
// Unload resources
|
||||
// Unload - Unload resources
|
||||
func (g *Game) Unload() {
|
||||
raylib.UnloadSound(g.FxFlap)
|
||||
raylib.UnloadSound(g.FxSlap)
|
||||
|
@ -191,7 +191,7 @@ func (g *Game) Unload() {
|
|||
raylib.UnloadTexture(g.Texture)
|
||||
}
|
||||
|
||||
// Update game
|
||||
// Update - Update game
|
||||
func (g *Game) Update() {
|
||||
if raylib.WindowShouldClose() {
|
||||
g.WindowShouldClose = true
|
||||
|
@ -304,7 +304,7 @@ func (g *Game) Update() {
|
|||
}
|
||||
}
|
||||
|
||||
// Draw game
|
||||
// Draw - Draw game
|
||||
func (g *Game) Draw() {
|
||||
raylib.BeginDrawing()
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ const (
|
|||
squareSize = 31
|
||||
)
|
||||
|
||||
// Snake type
|
||||
type Snake struct {
|
||||
Position raylib.Vector2
|
||||
Size raylib.Vector2
|
||||
|
@ -16,6 +17,7 @@ type Snake struct {
|
|||
Color raylib.Color
|
||||
}
|
||||
|
||||
// Food type
|
||||
type Food struct {
|
||||
Position raylib.Vector2
|
||||
Size raylib.Vector2
|
||||
|
@ -23,6 +25,7 @@ type Food struct {
|
|||
Color raylib.Color
|
||||
}
|
||||
|
||||
// Game type
|
||||
type Game struct {
|
||||
ScreenWidth int32
|
||||
ScreenHeight int32
|
||||
|
@ -56,7 +59,7 @@ func main() {
|
|||
raylib.CloseWindow()
|
||||
}
|
||||
|
||||
// Initialize game
|
||||
// Init - Initialize game
|
||||
func (g *Game) Init() {
|
||||
g.ScreenWidth = 800
|
||||
g.ScreenHeight = 450
|
||||
|
@ -97,7 +100,7 @@ func (g *Game) Init() {
|
|||
g.Fruit.Active = false
|
||||
}
|
||||
|
||||
// Update game
|
||||
// Update - Update game
|
||||
func (g *Game) Update() {
|
||||
if !g.GameOver {
|
||||
if raylib.IsKeyPressed('P') {
|
||||
|
@ -192,7 +195,7 @@ func (g *Game) Update() {
|
|||
}
|
||||
}
|
||||
|
||||
// Draw game
|
||||
// Draw - Draw game
|
||||
func (g *Game) Draw() {
|
||||
raylib.BeginDrawing()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue