asdfghjk
This commit is contained in:
parent
ef3732c53c
commit
a1aeb71512
12
game/game.go
12
game/game.go
@ -149,7 +149,7 @@ func (g *Game) DrawMap() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *Game) DrawPlayer(player *types.Player, model rl.Model) {
|
func (g *Game) DrawPlayer(player *types.Player) {
|
||||||
player.Lock()
|
player.Lock()
|
||||||
defer player.Unlock()
|
defer player.Unlock()
|
||||||
|
|
||||||
@ -169,15 +169,15 @@ func (g *Game) DrawPlayer(player *types.Player, model rl.Model) {
|
|||||||
if player.IsMoving && len(modelAsset.Animations.Walk) > 0 {
|
if player.IsMoving && len(modelAsset.Animations.Walk) > 0 {
|
||||||
anim := modelAsset.Animations.Walk[0] // Use first walk animation
|
anim := modelAsset.Animations.Walk[0] // Use first walk animation
|
||||||
player.AnimationFrame = player.AnimationFrame % anim.FrameCount
|
player.AnimationFrame = player.AnimationFrame % anim.FrameCount
|
||||||
rl.UpdateModelAnimation(model, anim, player.AnimationFrame)
|
rl.UpdateModelAnimation(player.Model, anim, player.AnimationFrame)
|
||||||
} else if len(modelAsset.Animations.Idle) > 0 {
|
} else if len(modelAsset.Animations.Idle) > 0 {
|
||||||
anim := modelAsset.Animations.Idle[0] // Use first idle animation
|
anim := modelAsset.Animations.Idle[0] // Use first idle animation
|
||||||
player.AnimationFrame = player.AnimationFrame % anim.FrameCount
|
player.AnimationFrame = player.AnimationFrame % anim.FrameCount
|
||||||
rl.UpdateModelAnimation(model, anim, player.AnimationFrame)
|
rl.UpdateModelAnimation(player.Model, anim, player.AnimationFrame)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rl.DrawModel(model, playerPos, 16, rl.White)
|
rl.DrawModel(player.Model, playerPos, 16, rl.White)
|
||||||
|
|
||||||
// Draw floating messages and path indicators
|
// Draw floating messages and path indicators
|
||||||
if player.FloatingMessage != nil {
|
if player.FloatingMessage != nil {
|
||||||
@ -221,12 +221,12 @@ func (g *Game) Render() {
|
|||||||
|
|
||||||
rl.BeginMode3D(g.Camera)
|
rl.BeginMode3D(g.Camera)
|
||||||
g.DrawMap()
|
g.DrawMap()
|
||||||
g.DrawPlayer(g.Player, g.Player.Model)
|
g.DrawPlayer(g.Player)
|
||||||
for _, other := range g.OtherPlayers {
|
for _, other := range g.OtherPlayers {
|
||||||
if other.Model.Meshes == nil {
|
if other.Model.Meshes == nil {
|
||||||
g.AssignModelToPlayer(other)
|
g.AssignModelToPlayer(other)
|
||||||
}
|
}
|
||||||
g.DrawPlayer(other, other.Model)
|
g.DrawPlayer(other)
|
||||||
}
|
}
|
||||||
rl.EndMode3D()
|
rl.EndMode3D()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user