mirror of
				https://github.com/coop-deluxe/sm64coopdx.git
				synced 2025-10-30 08:01:01 +00:00 
			
		
		
		
	Added custom player model example
This commit is contained in:
		
							parent
							
								
									622c9b79b1
								
							
						
					
					
						commit
						1db8dcc1d9
					
				
					 3 changed files with 23 additions and 0 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								docs/lua/examples/koopa-player-model/actors/koopa_player_geo.bin
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/lua/examples/koopa-player-model/actors/koopa_player_geo.bin
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										22
									
								
								docs/lua/examples/koopa-player-model/main.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								docs/lua/examples/koopa-player-model/main.lua
									
										
									
									
									
										Normal 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)
 | 
			
		||||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
- [Behavior with Surface Collisions](examples/behavior-surface-collisions.lua)
 | 
			
		||||
- [Custom Box Model](examples/custom-box-model)
 | 
			
		||||
- [Custom Player Model](examples/koopa-player-model)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue