mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-21 19:45:10 +00:00
Add more Example Lua mods (#35)
This commit is contained in:
parent
622c9b79b1
commit
509db70385
4 changed files with 49 additions and 0 deletions
12
docs/lua/examples/Instant_Clip.lua
Normal file
12
docs/lua/examples/Instant_Clip.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
-- name: Instant Clip
|
||||
-- description: Press L trigger, profit!
|
||||
|
||||
function mario_update(m)
|
||||
if (m.controller.buttonDown & L_TRIG) ~= 0 then -- If L pressed
|
||||
set_mario_action(m, ACT_WALKING, 0) --set mario to walking so his vel is used
|
||||
m.forwardVel = 400 --set Velocity to clip speed
|
||||
end
|
||||
end
|
||||
|
||||
-- hooks --
|
||||
hook_event(HOOK_MARIO_UPDATE, mario_update)
|
10
docs/lua/examples/Moonjump.lua
Normal file
10
docs/lua/examples/Moonjump.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
-- name: MoonJump
|
||||
-- description: Hold the A button to Moonjump
|
||||
function mario_update(m)
|
||||
if (m.controller.buttonDown & A_BUTTON) ~= 0 then --If the A button is pressed
|
||||
m.vel.y = 25 --Set Y velocity to 25
|
||||
end
|
||||
end
|
||||
|
||||
-- hooks --
|
||||
hook_event(HOOK_MARIO_UPDATE, mario_update)
|
|
@ -48,6 +48,7 @@ All of this is a holdover from when there were only two players. It was a reason
|
|||
- [Faster Swimming](../../mods/faster-swimming.lua)
|
||||
- [Hide and Seek Gamemode](../../mods/hide-and-seek.lua)
|
||||
- [Football (soccer) Gamemode](../../mods/football.lua)
|
||||
- [Mario Run](../../mods/Mario-Run.lua)
|
||||
- [HUD Rendering](examples/hud.lua)
|
||||
- [Object Spawning](examples/spawn-stuff.lua)
|
||||
- [Custom Ball Behavior](examples/behavior-ball.lua)
|
||||
|
@ -55,3 +56,5 @@ 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)
|
||||
- [Moonjump](examples/Moonjump.lua)
|
||||
- [Instant Clip](examples/Instant_Clip.lua)
|
||||
|
|
24
mods/Mario-Run.lua
Normal file
24
mods/Mario-Run.lua
Normal file
|
@ -0,0 +1,24 @@
|
|||
-- name: Mario RUN!
|
||||
-- description: Mario Is contantly runing
|
||||
|
||||
Threshold = 50 --set Threshold to 50
|
||||
|
||||
function mario_update(m)
|
||||
--Prevent mario from ideling
|
||||
if m.action == ACT_IDLE then --If idle
|
||||
set_mario_action(m, ACT_WALKING, 0) --Make Mario walk
|
||||
end
|
||||
|
||||
--Crouching doesnt apply vel so prevent that
|
||||
if m.action == ACT_CROUCHING then --If crouching
|
||||
set_mario_action(m, ACT_WALKING, 0) --Make Mario walk
|
||||
end
|
||||
|
||||
--Speed floor
|
||||
if (m.forwardVel > 0-Threshold) and (m.forwardVel < Threshold) then --If Mario isn't moveing fast enough
|
||||
m.forwardVel = Threshold --set forwards velocity to whatevet the threashold is set to
|
||||
end
|
||||
end
|
||||
|
||||
-- hooks --
|
||||
hook_event(HOOK_MARIO_UPDATE, mario_update)
|
Loading…
Reference in a new issue