Different model per player
This commit is contained in:
parent
1c42ec2802
commit
c7f7c083b1
18
main.go
18
main.go
@ -50,6 +50,8 @@ type Player struct {
|
|||||||
TargetPath []Tile
|
TargetPath []Tile
|
||||||
Speed float32
|
Speed float32
|
||||||
ActionQueue []Action // Queue for player actions
|
ActionQueue []Action // Queue for player actions
|
||||||
|
Model rl.Model
|
||||||
|
Texture rl.Texture2D
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the map with some height data
|
// Initialize the map with some height data
|
||||||
@ -325,6 +327,18 @@ func main() {
|
|||||||
defer rl.UnloadTexture(coomerTexture)
|
defer rl.UnloadTexture(coomerTexture)
|
||||||
rl.SetMaterialTexture(coomerModel.Materials, rl.MapDiffuse, coomerTexture)
|
rl.SetMaterialTexture(coomerModel.Materials, rl.MapDiffuse, coomerTexture)
|
||||||
|
|
||||||
|
models := []struct {
|
||||||
|
Model rl.Model
|
||||||
|
Texture rl.Texture2D
|
||||||
|
}{
|
||||||
|
{Model: playerModel, Texture: playerTexture},
|
||||||
|
{Model: coomerModel, Texture: coomerTexture},
|
||||||
|
}
|
||||||
|
|
||||||
|
modelIndex := int(playerID) % len(models)
|
||||||
|
player.Model = models[modelIndex].Model
|
||||||
|
player.Texture = models[modelIndex].Texture
|
||||||
|
|
||||||
rl.SetTargetFPS(60)
|
rl.SetTargetFPS(60)
|
||||||
|
|
||||||
// Music
|
// Music
|
||||||
@ -356,9 +370,9 @@ func main() {
|
|||||||
rl.ClearBackground(rl.RayWhite)
|
rl.ClearBackground(rl.RayWhite)
|
||||||
rl.BeginMode3D(camera)
|
rl.BeginMode3D(camera)
|
||||||
DrawMap(mapGrid)
|
DrawMap(mapGrid)
|
||||||
DrawPlayer(player, &playerModel, mapGrid)
|
DrawPlayer(player, &player.Model, mapGrid)
|
||||||
|
|
||||||
rl.DrawModel(coomerModel, rl.NewVector3(5*TileSize+32, 32, 5*TileSize+32), 16, rl.White)
|
// rl.DrawModel(coomerModel, rl.NewVector3(5*TileSize+32, 32, 5*TileSize+32), 16, rl.White)
|
||||||
|
|
||||||
rl.DrawFPS(10, 10)
|
rl.DrawFPS(10, 10)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user