Skip to content

Commit 68c0b60

Browse files
committed
Fixed input
1 parent 2027efc commit 68c0b60

File tree

8 files changed

+11
-11
lines changed

8 files changed

+11
-11
lines changed

animation/cursor/example/cursor.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function init(self)
55
end
66

77
function on_input(self, action_id, action)
8-
if action_id == hash("touch") and action.pressed then -- <3>
8+
if action_id == hash("mouse_button_left") and action.pressed then -- <3>
99
self.duration = self.duration + 1 -- <4>
1010
if self.duration > 3 then -- <5>
1111
self.duration = 0

gui/get_set_font/example/get_set_font.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function init(self)
1010
end
1111

1212
function on_input(self, action_id, action)
13-
if action.pressed then
13+
if action_id == hash("touch") and action.pressed then
1414
-- get the font file currently assigned to the font with id 'default'
1515
local current_font = go.get("#gui", "fonts", { key = "default" })
1616

gui/get_set_texture/example/get_set_texture.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function init(self)
1010
end
1111

1212
function on_input(self, action_id, action)
13-
if action.pressed then
13+
if action_id == hash("mouse_button_left") and action.pressed then
1414
-- get the atlas file currently assigned to the atlas/texture with id 'ui'
1515
local current_atlas = go.get("#gui", "textures", { key = "ui" })
1616

movement/look_rotation/example/look_rotation.script

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ function update(self, dt)
5757
end
5858

5959
function on_input(self, action_id, action)
60-
-- If the action is pressed (any key or mouse button), set the next target
61-
if action.pressed then
60+
-- If the left mouse button (or touch) is pressed, set the next target
61+
if action_id == hash("mouse_button_left") and action.pressed then
6262
next_target(self)
6363
end
6464
end

particles/confetti/example/confetti.script

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ function init(self)
1111
end
1212

1313
function on_input(self, action_id, action)
14-
if action.pressed then -- <3>
14+
if action_id == hash("mouse_button_left") and action.pressed then -- <3>
1515
single_shot()
1616
end
1717
end
1818

1919
--[[
2020
1. Start playing the particle effect in component "particles" in this game object.
2121
2. Setup timer to do a single shot of confetti every 3 seconds.
22-
3. Play the effect on any key pressed.
22+
3. Play the effect when left mouse button (or touch) is pressed.
2323
--]]

particles/fireworks/example/fireworks.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function update(self, dt)
8888
end
8989

9090
function on_input(self, action_id, action)
91-
if action.pressed then
91+
if action_id == hash("mouse_button_left") and action.pressed then
9292
single_shot()
9393
end
9494
end

resource/modify_atlas/example/modify_atlas.script

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function init(self)
8181
end
8282

8383
function on_input(self, action_id, action)
84-
if action.pressed then
84+
if action_id == hash("mouse_button_left") and action.pressed then
8585
replace_atlas_image()
8686
end
8787
end

tilemap/collisions/example/collisions.script

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ end
77

88

99
function on_input(self, action_id, action)
10-
if action.pressed then
10+
if action_id == hash("mouse_button_left") and action.pressed then
1111
factory.create("#enemyfactory", vmath.vector3(action.x, action.y, 1)) -- <3>
1212
end
1313
end
@@ -24,7 +24,7 @@ end
2424
--[[
2525
1. Acquire input for the script
2626
2. Spawn 10 game objects at random positions near the top of the screen
27-
3. Spawn a game object when any key or mouse button (or touch) is pressed
27+
3. Spawn a game object when the left mouse button (or touch) is pressed
2828
4. Something collided with the tilemap if the received message was a `collision_response`
2929
5. Check if something collided with a tile belonging to the collision group "danger"
3030
6. Delete the game object that collided with the tilemap

0 commit comments

Comments
 (0)