26 lines
666 B
Go
26 lines
666 B
Go
|
|
package handlers
|
||
|
|
|
||
|
|
import (
|
||
|
|
"openquell/components"
|
||
|
|
. "openquell/config"
|
||
|
|
)
|
||
|
|
|
||
|
|
// type Collider struct {
|
||
|
|
// CollisionHandler func(*Position, *Position, *Velocity) bool
|
||
|
|
// EdgeHandler func(*Position, *Position, *Velocity) bool
|
||
|
|
// PassoverHandler func(*Position, *Velocity) bool
|
||
|
|
// PassoverFinishedHandler func(*Position, *Velocity) bool
|
||
|
|
// }
|
||
|
|
|
||
|
|
func HandleCollectibleCollision(pos, newpos *components.Position, velocity *components.Velocity) bool {
|
||
|
|
pos.Set(newpos)
|
||
|
|
velocity.Change(Stop)
|
||
|
|
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
func HandleCollectibleEdgeBump(pos, newpos *components.Position, velocity *components.Velocity) bool {
|
||
|
|
pos.Set(newpos)
|
||
|
|
return true
|
||
|
|
}
|