Client initial commit.
This commit is contained in:
38
client/elements/block.go
Normal file
38
client/elements/block.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package elements
|
||||
|
||||
import (
|
||||
"client/gamedata"
|
||||
"image/color"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
)
|
||||
|
||||
type Block struct {
|
||||
Sprite *ebiten.Image
|
||||
cycle int
|
||||
position gamedata.Coordinates
|
||||
}
|
||||
|
||||
func NewBlock() *Block {
|
||||
return &Block{
|
||||
Sprite: ebiten.NewImage(20, 20),
|
||||
cycle: 0,
|
||||
}
|
||||
}
|
||||
|
||||
func (b *Block) Update() {
|
||||
b.cycle++
|
||||
}
|
||||
|
||||
func (b *Block) Draw() {
|
||||
b.Sprite.Clear()
|
||||
b.Sprite.Fill(color.RGBA{R: 0xff, G: 0x00, B: 0x00, A: 0x00})
|
||||
}
|
||||
|
||||
func (b *Block) SetPosition(pos gamedata.Coordinates) {
|
||||
b.position = pos
|
||||
}
|
||||
|
||||
func (b *Block) GetPosition() gamedata.Coordinates {
|
||||
return b.position
|
||||
}
|
||||
Reference in New Issue
Block a user