Made monsters a bit less synced.

This commit is contained in:
Sander Schobers 2021-08-13 13:09:31 +02:00
parent 0d49482036
commit 4adfdbe006

View File

@ -190,7 +190,7 @@ func (r *levelController) Handle(ctx ui.Context, e ui.Event) bool {
var jumping []geom.Point
for pos, animation := range r.IdleMonsters.Values {
for animation.Frame > 0 {
if rand.Intn(10) != 0 {
if rand.Intn(100) < 37 { // P = .37
monster, ok := r.Level.Monsters[pos]
if ok && monster != nil {
target, ok := monster.FindTarget(r.Level, pos)
@ -222,7 +222,7 @@ func (r *levelController) Play(level *tins2021.Level) {
"heart": tins2021.NewAnimations(80*time.Millisecond, defaultAnimationFrames, true, true),
"monster": tins2021.NewAnimations(80*time.Millisecond, defaultAnimationFrames, true, true),
}
r.IdleMonsters = tins2021.NewAnimations(200*time.Millisecond, 100, false, false)
r.IdleMonsters = tins2021.NewAnimations(40*time.Millisecond, 100, false, false)
r.MovingMonsters = tins2021.NewAnimations(16*time.Millisecond, 50, false, false)
for monster := range level.Monsters {
r.IdleMonsters.Frame(monster)