Added custom player model example

This commit is contained in:
MysterD 2022-03-17 21:41:46 -07:00
parent 622c9b79b1
commit 1db8dcc1d9
3 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,22 @@
-- name: Custom Koopa Player Model
-- description: Press DPAD+DOWN to become a Koopa!\n(by Super Keeberghrh)
E_MODEL_KOOPA_PLAYER = smlua_model_util_get_id("koopa_player_geo")
function mario_update_local(m)
if (m.controller.buttonPressed & D_JPAD) ~= 0 then
gPlayerSyncTable[0].modelId = E_MODEL_KOOPA_PLAYER
end
end
function mario_update(m)
if m.playerIndex == 0 then
mario_update_local(m)
end
if gPlayerSyncTable[m.playerIndex].modelId ~= nil then
obj_set_model_extended(m.marioObj, gPlayerSyncTable[m.playerIndex].modelId)
end
end
hook_event(HOOK_MARIO_UPDATE, mario_update)

View file

@ -55,3 +55,4 @@ All of this is a holdover from when there were only two players. It was a reason
- [Add to Goomba Behavior](examples/behavior-add-to-goomba.lua) - [Add to Goomba Behavior](examples/behavior-add-to-goomba.lua)
- [Behavior with Surface Collisions](examples/behavior-surface-collisions.lua) - [Behavior with Surface Collisions](examples/behavior-surface-collisions.lua)
- [Custom Box Model](examples/custom-box-model) - [Custom Box Model](examples/custom-box-model)
- [Custom Player Model](examples/koopa-player-model)