Collision update.
This commit is contained in:
@@ -11,6 +11,7 @@ type Block struct {
|
||||
Sprite *ebiten.Image
|
||||
cycle int
|
||||
position gamedata.Coordinates
|
||||
hit bool
|
||||
}
|
||||
|
||||
func NewBlock() *Block {
|
||||
@@ -26,7 +27,11 @@ func (b *Block) Update() {
|
||||
|
||||
func (b *Block) Draw() {
|
||||
b.Sprite.Clear()
|
||||
b.Sprite.Fill(color.RGBA{R: 0xff, G: 0x00, B: 0x00, A: 0x00})
|
||||
if !b.hit {
|
||||
b.Sprite.Fill(color.RGBA{R: 0xff, G: 0x00, B: 0x00, A: 0x00})
|
||||
} else {
|
||||
b.Sprite.Fill(color.RGBA{R: 0x00, G: 0xff, B: 0x00, A: 0xff})
|
||||
}
|
||||
}
|
||||
|
||||
func (b *Block) SetPosition(pos gamedata.Coordinates) {
|
||||
@@ -36,3 +41,11 @@ func (b *Block) SetPosition(pos gamedata.Coordinates) {
|
||||
func (b *Block) GetPosition() gamedata.Coordinates {
|
||||
return b.position
|
||||
}
|
||||
|
||||
func (b *Block) SetHit(hit bool) {
|
||||
b.hit = hit
|
||||
}
|
||||
|
||||
func (b *Block) GetHit() bool {
|
||||
return b.hit
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user