mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-09-05 19:14:14 -04:00
Fixed crash on 0 animation speed entities. (#164)
This commit is contained in:
parent
78a70c2d2b
commit
da9b86c679
@ -137,6 +137,7 @@ func (v *AnimatedEntity) LoadLayer(layer string, fileProvider d2interface.FilePr
|
|||||||
|
|
||||||
// Render draws this animated entity onto the target
|
// Render draws this animated entity onto the target
|
||||||
func (v *AnimatedEntity) Render(target *ebiten.Image, offsetX, offsetY int) {
|
func (v *AnimatedEntity) Render(target *ebiten.Image, offsetX, offsetY int) {
|
||||||
|
if v.animationSpeed > 0 {
|
||||||
for v.lastFrameTime.Add(time.Millisecond * time.Duration(v.animationSpeed)).Before(time.Now()) {
|
for v.lastFrameTime.Add(time.Millisecond * time.Duration(v.animationSpeed)).Before(time.Now()) {
|
||||||
v.lastFrameTime = v.lastFrameTime.Add(time.Millisecond * time.Duration(v.animationSpeed))
|
v.lastFrameTime = v.lastFrameTime.Add(time.Millisecond * time.Duration(v.animationSpeed))
|
||||||
v.currentFrame++
|
v.currentFrame++
|
||||||
@ -144,6 +145,7 @@ func (v *AnimatedEntity) Render(target *ebiten.Image, offsetX, offsetY int) {
|
|||||||
v.currentFrame = 0
|
v.currentFrame = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for idx := 0; idx < v.Cof.NumberOfLayers; idx++ {
|
for idx := 0; idx < v.Cof.NumberOfLayers; idx++ {
|
||||||
priority := v.Cof.Priority[v.direction][v.currentFrame][idx]
|
priority := v.Cof.Priority[v.direction][v.currentFrame][idx]
|
||||||
if int(priority) >= len(DccLayerNames) {
|
if int(priority) >= len(DccLayerNames) {
|
||||||
|
Loading…
Reference in New Issue
Block a user