started with switch/door pair
This commit is contained in:
parent
dc2574643c
commit
f6d5385d35
BIN
assets/sprites/door-closed.png
Normal file
BIN
assets/sprites/door-closed.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 280 B |
BIN
assets/sprites/door-open.png
Normal file
BIN
assets/sprites/door-open.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 250 B |
BIN
assets/sprites/door.ase
Normal file
BIN
assets/sprites/door.ase
Normal file
Binary file not shown.
BIN
assets/sprites/switch-closed.png
Normal file
BIN
assets/sprites/switch-closed.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 464 B |
BIN
assets/sprites/switch-open.png
Normal file
BIN
assets/sprites/switch-open.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 463 B |
BIN
assets/sprites/switch.ase
Normal file
BIN
assets/sprites/switch.ase
Normal file
Binary file not shown.
38
components/pairs.go
Normal file
38
components/pairs.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package components
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/hajimehoshi/ebiten/v2"
|
||||||
|
"github.com/mlange-42/arche/ecs"
|
||||||
|
)
|
||||||
|
|
||||||
|
// the Bond components binds two different entities together, one
|
||||||
|
// manipulates the other
|
||||||
|
type Bond struct {
|
||||||
|
ecs.Relation
|
||||||
|
}
|
||||||
|
|
||||||
|
// A door has a relation to a switch using the Bond component. The
|
||||||
|
// Switch opens or closes the door, depending on player actions. The
|
||||||
|
// door itself is merely dump and just does what being told.
|
||||||
|
|
||||||
|
type Door struct {
|
||||||
|
IsOpen bool
|
||||||
|
OpenSprite *ebiten.Image
|
||||||
|
CloseSprite *ebiten.Image
|
||||||
|
}
|
||||||
|
|
||||||
|
func (door *Door) Open() *ebiten.Image {
|
||||||
|
return door.OpenSprite
|
||||||
|
}
|
||||||
|
|
||||||
|
func (door *Door) Close() *ebiten.Image {
|
||||||
|
return door.CloseSprite
|
||||||
|
}
|
||||||
|
|
||||||
|
// the switch is being activated when the player runs over it, it can
|
||||||
|
// either use a timeout or just stay in its switching position
|
||||||
|
type Switch struct {
|
||||||
|
IsOpen bool
|
||||||
|
OpenSprite *ebiten.Image
|
||||||
|
CloseSprite *ebiten.Image
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user