added inventory & active object
This commit is contained in:
1 parent
e1b491be73
commit
b3fda88784
16 files changed
+793
-98
No files matched your search
@@ -10,7 +10,8 @@
|
||||
"positionX": 0.0,
|
||||
"positionY": 0.0,
|
||||
"positionZ": 0.0,
|
||||
"scale": 1.0
|
||||
"scale": 1.0,
|
||||
"interactive": false
|
||||
},
|
||||
{
|
||||
"name": "inai",
|
||||
@@ -22,7 +23,8 @@
|
||||
"positionX": 2.5,
|
||||
"positionY": 1.4,
|
||||
"positionZ": -9.9,
|
||||
"scale": 1.0
|
||||
"scale": 1.0,
|
||||
"interactive": false
|
||||
},
|
||||
{
|
||||
"name": "bench",
|
||||
@@ -34,7 +36,29 @@
|
||||
"positionX": -2.1,
|
||||
"positionY": 0.5,
|
||||
"positionZ": -7.9,
|
||||
"scale": 3.0
|
||||
"scale": 3.0,
|
||||
"interactive": false
|
||||
},
|
||||
{
|
||||
"name": "medik",
|
||||
"texturePath": "resources/fire2.png",
|
||||
"meshPath": "resources/w/firebox.txt",
|
||||
"rotationX": 0.0,
|
||||
"rotationY": -1.5707963267948966,
|
||||
"rotationZ": 0.0,
|
||||
"positionX": 0.0,
|
||||
"positionY": 0.0,
|
||||
"positionZ": 4.0,
|
||||
"scale": 1.0,
|
||||
"interactive": true,
|
||||
"item": {
|
||||
"id": "health_potion",
|
||||
"name": "Health Potion",
|
||||
"description": "Restores 50 HP",
|
||||
"icon": "resources/fire2.png",
|
||||
"radius": 2.0
|
||||
},
|
||||
"activateFunction" : "on_health_pickup"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"root": {
|
||||
"type": "FrameLayout",
|
||||
"name": "inventory_root",
|
||||
"width": "match_parent",
|
||||
"height": "match_parent",
|
||||
"children": [
|
||||
{
|
||||
"type": "TextButton",
|
||||
"name": "inventory_button",
|
||||
"x": 50.0,
|
||||
"y": 50.0,
|
||||
"width": 150.0,
|
||||
"height": 60.0,
|
||||
"text": "Inventory",
|
||||
"fontSize": 24,
|
||||
"fontPath": "resources/fonts/DroidSans.ttf",
|
||||
"textCentered": true,
|
||||
"color": [1.0, 1.0, 1.0, 1.0],
|
||||
"textures": {
|
||||
"normal": "resources/connecting.png",
|
||||
"hover": "resources/connecting.png",
|
||||
"pressed": "resources/connecting.png"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "FrameLayout",
|
||||
"name": "inventory_items_panel",
|
||||
"x": 100.0,
|
||||
"y": 150.0,
|
||||
"width": 500.0,
|
||||
"height": 600.0,
|
||||
"children": [
|
||||
{
|
||||
"type": "TextView",
|
||||
"name": "inventory_items_text",
|
||||
"x": 100.0,
|
||||
"y": 30.0,
|
||||
"width": 460.0,
|
||||
"height": 450.0,
|
||||
"text": "Inventory (Empty)",
|
||||
"fontSize": 18,
|
||||
"fontPath": "resources/fonts/DroidSans.ttf",
|
||||
"centered": false,
|
||||
"color": [1.0, 1.0, 1.0, 1.0]
|
||||
},
|
||||
{
|
||||
"type": "TextButton",
|
||||
"name": "close_inventory_button",
|
||||
"x": 200.0,
|
||||
"y": 20.0,
|
||||
"width": 40.0,
|
||||
"height": 40.0,
|
||||
"text": "X",
|
||||
"fontSize": 20,
|
||||
"fontPath": "resources/fonts/DroidSans.ttf",
|
||||
"textCentered": true,
|
||||
"color": [1.0, 1.0, 1.0, 1.0],
|
||||
"textures": {
|
||||
"normal": "resources/spark.png"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+25
-2
@@ -1,5 +1,6 @@
|
||||
-- Chain of waypoints for NPC 0.
|
||||
-- Each on_arrived callback issues the next walk command.
|
||||
-- ============================================
|
||||
-- NPC PATROL WAYPOINTS
|
||||
-- ============================================
|
||||
|
||||
local function step3()
|
||||
game_api.npc_walk_to(0, 0.0, 0.0, -30.0, step1)
|
||||
@@ -14,3 +15,25 @@ function step1()
|
||||
end
|
||||
|
||||
step1()
|
||||
|
||||
-- ============================================
|
||||
-- ITEM PICKUP HANDLER
|
||||
-- ============================================
|
||||
|
||||
function on_health_pickup()
|
||||
game_api.pickup_item("health_potion")
|
||||
|
||||
end
|
||||
|
||||
function on_item_pickup(object_name)
|
||||
print("========================================")
|
||||
print("on_item_pickup CALLBACK CALLED!")
|
||||
print("Player picked up item from: " .. tostring(object_name))
|
||||
print("========================================")
|
||||
|
||||
game_api.pickup_item(object_name)
|
||||
|
||||
--game_api.show_inventory()
|
||||
end
|
||||
|
||||
print("Lua script loaded successfully!")
|
||||
Reference in new issue
Block a user