forked from ManIsCat2/sm64coopdx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbehavior-surface-collisions.lua
More file actions
36 lines (29 loc) · 944 Bytes
/
behavior-surface-collisions.lua
File metadata and controls
36 lines (29 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
-- name: Custom Box with collisions
-- description: Press DPAD+down to spawn a box
function bhv_custom_box_init(obj)
obj.oFlags = OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE
obj.collisionData = gGlobalObjectCollisionData.breakable_box_seg8_collision_08012D70
obj.oCollisionDistance = 500
end
function bhv_custom_box_loop(obj)
load_object_collision_model()
end
-- hook the behavior
id_bhvCustomBox = hook_behavior(nil, OBJ_LIST_SURFACE, true, bhv_custom_box_init, bhv_custom_box_loop)
------------------------
function mario_update_local(m)
if (m.controller.buttonPressed & D_JPAD) ~= 0 then
-- spawn breakable box
spawn_non_sync_object(
id_bhvCustomBox,
E_MODEL_BREAKABLE_BOX,
m.pos.x, m.pos.y, m.pos.z,
nil)
end
end
function mario_update(m)
if m.playerIndex == 0 then
mario_update_local(m)
end
end
hook_event(HOOK_MARIO_UPDATE, mario_update)