Add coomer animation lol
This commit is contained in:
30
game/game.go
30
game/game.go
@ -154,26 +154,26 @@ func (g *Game) DrawPlayer(player *types.Player, model rl.Model) {
|
||||
defer player.Unlock()
|
||||
|
||||
grid := GetMapGrid()
|
||||
modelIndex := int(player.ID) % len(g.Models)
|
||||
modelAsset := g.Models[modelIndex]
|
||||
|
||||
const defaultHeight = 8.0 // Default height above tile, fine tune per model in types.ModelAsset
|
||||
playerPos := rl.Vector3{
|
||||
X: player.PosActual.X,
|
||||
Y: grid[player.PosTile.X][player.PosTile.Y].Height*types.TileHeight + 16.0,
|
||||
Y: grid[player.PosTile.X][player.PosTile.Y].Height*types.TileHeight + defaultHeight + modelAsset.YOffset,
|
||||
Z: player.PosActual.Z,
|
||||
}
|
||||
|
||||
if player.ID%int32(len(g.Models)) == 0 {
|
||||
modelAsset := g.Models[0]
|
||||
|
||||
// Check if model has animations
|
||||
if modelAsset.Animations.Idle != nil || modelAsset.Animations.Walk != nil {
|
||||
if player.IsMoving && len(modelAsset.Animations.Walk) > 0 {
|
||||
anim := modelAsset.Animations.Walk[0] // Use first walk animation
|
||||
player.AnimationFrame = player.AnimationFrame % anim.FrameCount
|
||||
rl.UpdateModelAnimation(model, anim, player.AnimationFrame)
|
||||
} else if len(modelAsset.Animations.Idle) > 0 {
|
||||
anim := modelAsset.Animations.Idle[0] // Use first idle animation
|
||||
player.AnimationFrame = player.AnimationFrame % anim.FrameCount
|
||||
rl.UpdateModelAnimation(model, anim, player.AnimationFrame)
|
||||
}
|
||||
// Check if model has animations
|
||||
if modelAsset.Animations.Idle != nil || modelAsset.Animations.Walk != nil {
|
||||
if player.IsMoving && len(modelAsset.Animations.Walk) > 0 {
|
||||
anim := modelAsset.Animations.Walk[0] // Use first walk animation
|
||||
player.AnimationFrame = player.AnimationFrame % anim.FrameCount
|
||||
rl.UpdateModelAnimation(model, anim, player.AnimationFrame)
|
||||
} else if len(modelAsset.Animations.Idle) > 0 {
|
||||
anim := modelAsset.Animations.Idle[0] // Use first idle animation
|
||||
player.AnimationFrame = player.AnimationFrame % anim.FrameCount
|
||||
rl.UpdateModelAnimation(model, anim, player.AnimationFrame)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user