added frames only concerning sprite

This commit is contained in:
Jalen Winslow 2018-01-23 05:52:53 -07:00
parent 452bd9cdc3
commit 297e33d89e

13
main.go
View File

@ -52,13 +52,14 @@ func run() {
bg := pixel.NewSprite(background, background.Bounds()) bg := pixel.NewSprite(background, background.Bounds())
//batch := pixel.NewBatch(&pixel.TrianglesData{}, spritesheet) //batch := pixel.NewBatch(&pixel.TrianglesData{}, spritesheet)
/*
When creating the sprite, you need to know big each frame is inside the spritesheet. /* setting-character-sprite
If you use aseprite or some other pixel art program, you can find the number of pixels
within each frame. For our sprite sheet, each frame is 96 px wide and 96 px high. So basically changed it around so the 12 frames of the character with yellow hair
we increment it by 96 for both x and y so that it can get the position of the frame are added to spritesFrames.
at the bottom right corner.
*/ */
var spritesFrames []pixel.Rect var spritesFrames []pixel.Rect
var frameWidth, frameHeight float64 = 96, 96 var frameWidth, frameHeight float64 = 96, 96
for y := spritesheet.Bounds().Min.Y; y < frameHeight*4; y += 96 { for y := spritesheet.Bounds().Min.Y; y < frameHeight*4; y += 96 {