Skip to content

Commit 3e47f99

Browse files
committed
Add some templates
1 parent 92f4167 commit 3e47f99

File tree

3 files changed

+139
-0
lines changed

3 files changed

+139
-0
lines changed

templates/layouts/menu_layout.json

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"buttons": {
3+
"play": {
4+
"x": 110,
5+
"y": 15,
6+
"width": 200,
7+
"height": 28,
8+
"text": "menu.play",
9+
"icon": [224, 128, 16, 16],
10+
"bigIcon": false
11+
},
12+
"multiplayer": {
13+
"x": 110,
14+
"y": 45,
15+
"width": 200,
16+
"height": 28,
17+
"text": "menu.multiplayer",
18+
"icon": [224, 128, 16, 16],
19+
"bigIcon": false
20+
},
21+
"options": {
22+
"x": 110,
23+
"y": 75,
24+
"width": 200,
25+
"height": 28,
26+
"text": "menu.options",
27+
"icon": [224, 144, 16, 16],
28+
"bigIcon": false
29+
},
30+
"skins": {
31+
"x": 110,
32+
"y": 105,
33+
"width": 200,
34+
"height": 28,
35+
"text": "menu.skins",
36+
"icon": [224, 176, 16, 16],
37+
"bigIcon": false
38+
},
39+
"achievements": {
40+
"x": 110,
41+
"y": 135,
42+
"width": 200,
43+
"height": 28,
44+
"text": "gui.achievements",
45+
"icon": [224, 160, 16, 16],
46+
"bigIcon": false
47+
},
48+
"manual": {
49+
"x": 110,
50+
"y": 165,
51+
"width": 200,
52+
"height": 28,
53+
"text": "menu.manual",
54+
"icon": [240, 128, 16, 16],
55+
"bigIcon": false
56+
},
57+
"store": {
58+
"x": 110,
59+
"y": 195,
60+
"width": 200,
61+
"height": 28,
62+
"text": "menu.store",
63+
"icon": [240, 144, 16, 16],
64+
"bigIcon": false
65+
}
66+
},
67+
"character": {
68+
"x": 5,
69+
"y": 5
70+
}
71+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
local keycodes = Game.Gamepad.KeyCodes
2+
3+
-- This will be executed only when key A is pressed
4+
Game.Event.OnKeyPressed:Connect(function ()
5+
if Game.Gamepad.isPressed(keycodes.A) then
6+
Game.Debug.message("Pressed key A")
7+
end
8+
end)
9+
10+
-- This will be executed only when key A is released
11+
Game.Event.OnKeyReleased:Connect(function ()
12+
if Game.Gamepad.isPressed(keycodes.A) then
13+
Game.Debug.message("Released key A")
14+
end
15+
end)
16+
17+
-- This will be executed while key B is down
18+
Game.Event.OnKeyDown:Connect(function ()
19+
if Game.Gamepad.isPressed(keycodes.B) then
20+
Game.Debug.message("Key B is down")
21+
end
22+
end)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
local Gamepad = Game.Gamepad
2+
local localPlayer = Game.LocalPlayer
3+
4+
-- Tells what item is holding the player in hand
5+
Game.Event.OnKeyPressed:Connect(function ()
6+
if Gamepad.isDown(Gamepad.KeyCodes.DPADDOWN) then
7+
local handSlot = localPlayer.Inventory.Slots["hand"]
8+
if handSlot ~= nil then -- handSlot will be nil when player isn't loaded
9+
local itemName = handSlot.ItemName
10+
Game.Debug.message("Player is holding item: "..itemName)
11+
end
12+
end
13+
end)
14+
15+
-- Tells what item is in slot 1 of the inventory
16+
Game.Event.OnKeyPressed:Connect(function ()
17+
if Gamepad.isDown(Gamepad.KeyCodes.DPADDOWN) then
18+
local slot = localPlayer.Inventory.Slots[1] -- Slots 1 to 36
19+
if slot ~= nil then -- slot will be nil when player isn't loaded
20+
local itemName = slot.ItemName
21+
Game.Debug.message("Player has item in slot 1: "..itemName)
22+
end
23+
end
24+
end)
25+
26+
-- Tells how many items are in slot 1
27+
Game.Event.OnKeyPressed:Connect(function ()
28+
if Gamepad.isDown(Gamepad.KeyCodes.DPADDOWN) then
29+
local slot = localPlayer.Inventory.Slots[1] -- Slots 1 to 36
30+
if slot ~= nil then -- slot will be nil when player isn't loaded
31+
local itemCount = slot.ItemCount
32+
Game.Debug.message("Player has in slot 1 "..itemCount.." items")
33+
end
34+
end
35+
end)
36+
37+
-- Tells the variation of the item in slot 1
38+
Game.Event.OnKeyPressed:Connect(function ()
39+
if Gamepad.isDown(Gamepad.KeyCodes.DPADDOWN) then
40+
local slot = localPlayer.Inventory.Slots[1] -- Slots 1 to 36
41+
if slot ~= nil then -- slot will be nil when player isn't loaded
42+
local itemData = slot.ItemData
43+
Game.Debug.message("Player has in slot 1 "..itemData.." item variation")
44+
end
45+
end
46+
end)

0 commit comments

Comments
 (0)