Skip to content

Commit cb95c7e

Browse files
Site changes [skip-ci]
1 parent b06c3f0 commit cb95c7e

File tree

1,251 files changed

+9717
-3360
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,251 files changed

+9717
-3360
lines changed

_data/examplesindex.json

Lines changed: 473 additions & 464 deletions
Large diffs are not rendered by default.

_includes/examples/animation/easing/controller_script.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ function on_message(self, message_id, message, sender)
5252
end
5353

5454
function on_input(self, action_id, action)
55-
if action_id == hash("left") and action.pressed then
55+
if action_id == hash("key_left") and action.pressed then
5656
change_easing_demo(self, PREVIOUS)
57-
elseif action_id == hash("right") and action.pressed then
57+
elseif action_id == hash("key_right") and action.pressed then
5858
change_easing_demo(self, NEXT)
5959
end
6060
end

_includes/examples/collection/timestep/game_script.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ function init(self)
1010
end
1111

1212
function on_input(self, action_id, action)
13-
if action_id == hash("left") then
13+
if action_id == hash("key_left") then
1414
msg.post("timestep:/controller", "change_speed", { amount = -0.01 })
15-
elseif action_id == hash("right") then
15+
elseif action_id == hash("key_right") then
1616
msg.post("timestep:/controller", "change_speed", { amount = 0.01 })
17-
elseif action_id == hash("action") and action.pressed then
17+
elseif action_id == hash("key_space") and action.pressed then
1818
-- flip self.to between 0 and 3 each time
1919
self.to = 3 - (self.to or 0)
2020
msg.post("timestep:/controller", "animate_speed", { to = self.to })

_includes/examples/factory/bullets/player_script.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ end
55

66
function on_input(self, action_id, action)
77
-- mouse or spacebar
8-
if (action_id == hash("touch") or action_id == hash("action")) and action.pressed then
8+
if (action_id == hash("touch") or action_id == hash("key_space")) and action.pressed then
99
-- position bullet somewhat offset from the player position
1010
local pos = go.get_position()
1111
pos.y = pos.y + 50

_includes/examples/factory/dynamic/dynamic_script.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ end
2424

2525
function on_input(self, action_id, action)
2626
-- mouse or spacebar
27-
if (action_id == hash("touch") or action_id == hash("action")) and action.pressed then
27+
if (action_id == hash("touch") or action_id == hash("key_space")) and action.pressed then
2828
-- next bullet prototype, wrap around to the first
2929
self.bullet_index = self.bullet_index + 1
3030
if self.bullet_index > #self.bullets then

_includes/examples/material/noise/noise_fp.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
varying mediump vec2 var_texcoord0;
2-
uniform lowp vec4 time;
1+
#version 140
2+
3+
in mediump vec2 var_texcoord0;
4+
5+
uniform fs_uniforms
6+
{
7+
mediump vec4 time;
8+
};
9+
10+
out mediump vec4 out_fragColor;
311

412
// noise shader from https://www.shadertoy.com/view/XXBcDz
513

@@ -42,6 +50,6 @@ float fbm( vec2 p )
4250
void main()
4351
{
4452
float n = fbm(var_texcoord0.xy);
45-
gl_FragColor = vec4(n, n, n, 1.0);
53+
out_fragColor = vec4(n, n, n, 1.0);
4654
}
4755

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
1+
#version 140
12

2-
// Positions can be world or local space, since world and normal
3-
// matrices are identity for world vertex space materials.
4-
// If world vertex space is selected, you can remove the
5-
// normal matrix multiplication for optimal performance.
3+
in highp vec4 position;
4+
in mediump vec2 texcoord0;
5+
in mediump vec3 normal;
66

7-
attribute highp vec4 position;
8-
attribute mediump vec2 texcoord0;
9-
attribute mediump vec3 normal;
10-
11-
uniform mediump mat4 mtx_worldview;
12-
uniform mediump mat4 mtx_view;
13-
uniform mediump mat4 mtx_proj;
14-
uniform mediump mat4 mtx_normal;
7+
uniform vp_uniforms
8+
{
9+
mediump mat4 mtx_worldview;
10+
mediump mat4 mtx_proj;
11+
};
1512

16-
varying highp vec4 var_position;
17-
varying mediump vec3 var_normal;
18-
varying mediump vec2 var_texcoord0;
13+
out highp vec4 var_position;
14+
out mediump vec2 var_texcoord0;
1915

2016
void main()
2117
{
22-
vec4 p = mtx_worldview * vec4(position.xyz, 1.0);
18+
highp vec4 p = mtx_worldview * vec4(position.xyz, 1.0);
2319
var_texcoord0 = texcoord0;
20+
2421
gl_Position = mtx_proj * p;
2522
}
2623

_includes/examples/material/screenspace/orbit_camera_script.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ function on_input(self, action_id, action)
4141
if action_id == hash("touch") and not action.pressed then
4242
self.yaw = self.yaw - action.dx * self.rotation_speed
4343
self.pitch = self.pitch + action.dy * self.rotation_speed
44-
elseif action_id == hash("wheel_up") then
44+
elseif action_id == hash("mouse_wheel_up") then
4545
self.zoom_offset = self.zoom_offset - self.zoom * self.zoom_speed
46-
elseif action_id == hash("wheel_down") then
46+
elseif action_id == hash("mouse_wheel_down") then
4747
self.zoom_offset = self.zoom_offset + self.zoom * self.zoom_speed
4848
end
4949
end

_includes/examples/material/unlit/orbit_camera_script.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ function on_input(self, action_id, action)
4141
if action_id == hash("touch") and not action.pressed then
4242
self.yaw = self.yaw - action.dx * self.rotation_speed
4343
self.pitch = self.pitch + action.dy * self.rotation_speed
44-
elseif action_id == hash("wheel_up") then
44+
elseif action_id == hash("mouse_wheel_up") then
4545
self.zoom_offset = self.zoom_offset - self.zoom * self.zoom_speed
46-
elseif action_id == hash("wheel_down") then
46+
elseif action_id == hash("mouse_wheel_down") then
4747
self.zoom_offset = self.zoom_offset + self.zoom * self.zoom_speed
4848
end
4949
end

_includes/examples/model/character/orbit_camera_script.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ function on_input(self, action_id, action)
4141
if action_id == hash("touch") and not action.pressed then
4242
self.yaw = self.yaw - action.dx * self.rotation_speed
4343
self.pitch = self.pitch + action.dy * self.rotation_speed
44-
elseif action_id == hash("wheel_up") then
44+
elseif action_id == hash("mouse_wheel_up") then
4545
self.zoom_offset = self.zoom_offset - self.zoom * self.zoom_speed
46-
elseif action_id == hash("wheel_down") then
46+
elseif action_id == hash("mouse_wheel_down") then
4747
self.zoom_offset = self.zoom_offset + self.zoom * self.zoom_speed
4848
end
4949
end

_includes/examples/model/character/player_script.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ function init(self)
2020
end
2121

2222
function on_input(self, action_id, action)
23-
if action_id == hash("idle") then
23+
if action_id == hash("key_1") then
2424
model.play_anim("#model", "Idle", go.PLAYBACK_LOOP_FORWARD)
25-
elseif action_id == hash("walk") then
25+
elseif action_id == hash("key_2") then
2626
model.play_anim("#model", "Walking_A", go.PLAYBACK_LOOP_FORWARD)
27-
elseif action_id == hash("attack") then
27+
elseif action_id == hash("key_3") then
2828
model.play_anim("#model", "1H_Melee_Attack_Chop", go.PLAYBACK_LOOP_FORWARD)
29-
elseif action_id == hash("block") then
29+
elseif action_id == hash("key_4") then
3030
model.play_anim("#model", "Block", go.PLAYBACK_LOOP_FORWARD)
31-
elseif action_id == hash("cheer") then
31+
elseif action_id == hash("key_5") then
3232
model.play_anim("#model", "Cheer", go.PLAYBACK_LOOP_FORWARD)
3333
end
3434
end

_includes/examples/model/cubemap/cubemap_script.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ function on_input(self, action_id, action)
2626
if action_id == hash("touch") then
2727
self.yaw = self.yaw - action.dx * ROTATION_SPEED
2828
self.pitch = self.pitch + action.dy * ROTATION_SPEED
29-
elseif action_id == hash("wheel_up") then
29+
elseif action_id == hash("mouse_wheel_up") then
3030
self.zoom_offset = self.zoom_offset - ZOOM_SPEED
31-
elseif action_id == hash("wheel_down") then
31+
elseif action_id == hash("mouse_wheel_down") then
3232
self.zoom_offset = self.zoom_offset + ZOOM_SPEED
3333
end
3434
end
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
-- This script controls the movement of track parts to create an infinite scrolling effect
2+
-- i.e. we don't move the car, we move the track.
3+
4+
function init(self)
5+
local count = 6 -- Total number of track parts
6+
local part_size = 4 -- Size of each track part
7+
8+
self.current_z = 0 -- Current z position of the track
9+
self.loop_at_z = part_size * (count - 2) -- Point at which to loop the track
10+
11+
self.speed = 5 -- Movement speed of the track
12+
end
13+
14+
function update(self, dt)
15+
-- Move the track forward based on speed and delta time
16+
self.current_z = self.current_z + self.speed * dt
17+
18+
-- Loop the track position when it reaches the loop point
19+
if self.current_z > self.loop_at_z then
20+
self.current_z = self.current_z - self.loop_at_z
21+
end
22+
23+
-- Update the position of the track game object
24+
go.set("/track", "position.z", self.current_z)
25+
end

_includes/examples/movement/look_rotation/orbit_camera_script.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ function on_input(self, action_id, action)
4141
if action_id == hash("touch") and not action.pressed then
4242
self.yaw = self.yaw - action.dx * self.rotation_speed
4343
self.pitch = self.pitch + action.dy * self.rotation_speed
44-
elseif action_id == hash("wheel_up") then
44+
elseif action_id == hash("mouse_wheel_up") then
4545
self.zoom_offset = self.zoom_offset - self.zoom * self.zoom_speed
46-
elseif action_id == hash("wheel_down") then
46+
elseif action_id == hash("mouse_wheel_down") then
4747
self.zoom_offset = self.zoom_offset + self.zoom * self.zoom_speed
4848
end
4949
end

_includes/examples/movement/move_forward/move_forward_script.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ end
5252

5353
function on_input(self, action_id, action)
5454
-- update direction of movement based on currently pressed keys
55-
if action_id == hash("up") then
55+
if action_id == hash("key_up") then
5656
self.input.y = 1
57-
elseif action_id == hash("down") then
57+
elseif action_id == hash("key_down") then
5858
self.input.y = -1
59-
elseif action_id == hash("left") then
59+
elseif action_id == hash("key_left") then
6060
self.input.x = 1
61-
elseif action_id == hash("right") then
61+
elseif action_id == hash("key_right") then
6262
self.input.x = -1
6363
end
6464
end

_includes/examples/movement/movement_speed/movement_speed_script.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ end
4242

4343
function on_input(self, action_id, action)
4444
-- update direction of movement based on currently pressed keys
45-
if action_id == hash("up") then
45+
if action_id == hash("key_up") then
4646
self.input.y = 1
47-
elseif action_id == hash("down") then
47+
elseif action_id == hash("key_down") then
4848
self.input.y = -1
49-
elseif action_id == hash("left") then
49+
elseif action_id == hash("key_left") then
5050
self.input.x = -1
51-
elseif action_id == hash("right") then
51+
elseif action_id == hash("key_right") then
5252
self.input.x = 1
5353
end
5454
end

_includes/examples/physics/knockback/player_script.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ end
55

66
function on_input(self, action_id, action)
77
-- mouse or spacebar
8-
if (action_id == hash("touch") or action_id == hash("action")) and action.pressed then
8+
if (action_id == hash("touch") or action_id == hash("key_space")) and action.pressed then
99
-- position bullet somewhat offset from the player position
1010
local pos = go.get_position()
1111
pos.y = pos.y + 50

_includes/examples/render/orbit_camera/orbit_camera_script.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ function on_input(self, action_id, action)
4141
if action_id == hash("touch") and not action.pressed then
4242
self.yaw = self.yaw - action.dx * self.rotation_speed
4343
self.pitch = self.pitch + action.dy * self.rotation_speed
44-
elseif action_id == hash("wheel_up") then
44+
elseif action_id == hash("mouse_wheel_up") then
4545
self.zoom_offset = self.zoom_offset - self.zoom * self.zoom_speed
46-
elseif action_id == hash("wheel_down") then
46+
elseif action_id == hash("mouse_wheel_down") then
4747
self.zoom_offset = self.zoom_offset + self.zoom * self.zoom_speed
4848
end
4949
end
Binary file not shown.

0 commit comments

Comments
 (0)