From 139ed78464aee4d0cf4d03f27c0d42eb61a9b33b Mon Sep 17 00:00:00 2001 From: Logen Kain Date: Mon, 22 Jan 2018 22:43:17 -0700 Subject: [PATCH] Add descriptions to functions --- main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.go b/main.go index 324bfa8..79c47cc 100644 --- a/main.go +++ b/main.go @@ -48,6 +48,7 @@ func windowCollision(player *Player, win pixelgl.Window, dt float64) { } +/* Decides what to do with input */ func checkKeys(player *Player, win pixelgl.Window, dt float64) { if win.Pressed(pixelgl.KeyLeft) { @@ -83,9 +84,13 @@ func checkKeys(player *Player, win pixelgl.Window, dt float64) { } if win.Pressed(pixelgl.KeyDown) { + playerDrag(player) + playerDrag(player) + playerDrag(player) } } +/* Applies drag to the player */ func playerDrag(player *Player) { if player.yV > 0 { player.yV -= player.drag @@ -117,6 +122,7 @@ func playerDrag(player *Player) { //return player } +/* Load an image into pixel */ func loadSprite(path string) (pixel.Picture, error) { file, err := os.Open(path) if err != nil { @@ -130,6 +136,7 @@ func loadSprite(path string) (pixel.Picture, error) { return pixel.PictureDataFromImage(img), nil } +/* Apply speed adjustments that have been calculated */ func playerAdjustSpeed(player *Player, dt float64) { player.x += player.xV * dt player.y += player.yV * dt @@ -149,6 +156,7 @@ func playerAdjustSpeed(player *Player, dt float64) { } } +/* Read a sprite sheet from a pixel.Picture */ func createSpriteSheet(SpriteSheetImg pixel.Picture, spriteSizeX, spriteSizeY float64) []pixel.Rect {