Skip to content

Commit

Permalink
Merge pull request #27 from notbadgun/blockbuster
Browse files Browse the repository at this point in the history
Blockbuster
  • Loading branch information
aglitchman authored Sep 20, 2023
2 parents 48573f3 + 34a3ab1 commit 5ae94dd
Show file tree
Hide file tree
Showing 8 changed files with 6,059 additions and 1 deletion.
18 changes: 18 additions & 0 deletions examples/main.collection
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,24 @@ embedded_instances {
" w: 1.0\n"
" }\n"
"}\n"
"embedded_components {\n"
" id: \"blocksbuster\"\n"
" type: \"collectionproxy\"\n"
" data: \"collection: \\\"/examples/scenes/blocksbuster/blocksbuster.collection\\\"\\n"
"exclude: false\\n"
"\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
Expand Down
2 changes: 1 addition & 1 deletion examples/main.script
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local main = require("examples.main")
go.property("scene1", hash("playground"))
go.property("scene2", hash("basic_3d"))
go.property("scene3", hash("shadows"))
go.property("scene4", hash(""))
go.property("scene4", hash("blocksbuster"))
go.property("scene5", hash(""))

go.property("acquire_input_focus", true)
Expand Down
291 changes: 291 additions & 0 deletions examples/scenes/blocksbuster/blocksbuster.collection
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
name: "shadows"
instances {
id: "main_camera"
prototype: "/scene3d/camera/camera3d.go"
position {
x: -0.269
y: 10.570332
z: 10.883265
}
rotation {
x: -0.40577975
y: 0.0
z: 0.0
w: 0.9139709
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
instances {
id: "light_directional"
prototype: "/scene3d/camera/light_directional.go"
position {
x: 3.01
y: 2.42
z: 0.85
}
rotation {
x: -0.43348113
y: 0.42721757
z: 0.24543284
w: 0.75454754
}
component_properties {
id: "light_directional"
properties {
id: "ambient_light_intensity"
value: "0.9"
type: PROPERTY_TYPE_NUMBER
}
properties {
id: "directional_light_intensity"
value: "0.35"
type: PROPERTY_TYPE_NUMBER
}
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
instances {
id: "buildings_floor_10x10"
prototype: "/scene3d/prefabs/buildings/buildings_floor_10x10.go"
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
instances {
id: "blob_shadows"
prototype: "/scene3d/fx/blob_shadows.go"
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
instances {
id: "buster"
prototype: "/examples/scenes/blocksbuster/buster.go"
position {
x: 0.0
y: 0.05
z: 3.5
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 2.0
y: 0.1
z: 2.0
}
}
collection_instances {
id: "debug_ui"
collection: "/scene3d/debug/photo_mode/debug_ui.collection"
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
collection_instances {
id: "castle1"
collection: "/examples/scenes/blocksbuster/castle.collection"
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
collection_instances {
id: "tower4"
collection: "/examples/scenes/blocksbuster/tower.collection"
position {
x: -3.0
y: 0.0
z: 3.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
collection_instances {
id: "tower1"
collection: "/examples/scenes/blocksbuster/tower.collection"
position {
x: 3.0
y: 0.0
z: 3.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
collection_instances {
id: "tower2"
collection: "/examples/scenes/blocksbuster/tower.collection"
position {
x: -3.0
y: 0.0
z: -3.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
collection_instances {
id: "tower3"
collection: "/examples/scenes/blocksbuster/tower.collection"
position {
x: 3.0
y: 0.0
z: -3.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
scale_along_z: 1
embedded_instances {
id: "main"
data: "components {\n"
" id: \"blocksbuster_main\"\n"
" component: \"/examples/scenes/blocksbuster/blocksbuster_main.script\"\n"
" position {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" }\n"
" rotation {\n"
" x: 0.0\n"
" y: 0.0\n"
" z: 0.0\n"
" w: 1.0\n"
" }\n"
"}\n"
""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
embedded_instances {
id: "objects"
children: "buster"
data: ""
position {
x: 0.0
y: 0.0
z: 0.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale3 {
x: 1.0
y: 1.0
z: 1.0
}
}
35 changes: 35 additions & 0 deletions examples/scenes/blocksbuster/blocksbuster_main.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
local render3d = require("scene3d.render.render3d")

go.property("acquire_input_focus", true)

function init(self)
print("shadows_main: init()")

if self.acquire_input_focus then
msg.post(".", hash("acquire_input_focus"))
end
end

function final(self)
end

function update(self, dt)
render3d.debug_log("[WASD] Move buster, Game: Blocksbuster! (Voodoo)")
end

function on_message(self, message_id, message, sender)
end

function on_input(self, action_id, action)
local buster_id = msg.url("/buster")

if action_id == hash("key_a") and not action.released then
go.set_position(go.get_position(buster_id) - vmath.vector3(0.04, 0, 0), buster_id)
elseif action_id == hash("key_d") and not action.released then
go.set_position(go.get_position(buster_id) + vmath.vector3(0.04, 0, 0), buster_id)
elseif action_id == hash("key_w") and not action.released then
go.set_position(go.get_position(buster_id) - vmath.vector3(0, 0, 0.04), buster_id)
elseif action_id == hash("key_s") and not action.released then
go.set_position(go.get_position(buster_id) + vmath.vector3(0, 0, 0.04), buster_id)
end
end
Loading

0 comments on commit 5ae94dd

Please sign in to comment.