Compare commits

..

No commits in common. "a0831c3146bcb3ea7c299918cd326915de7b3363" and "88e6017903db14cf2d152955021fe897c4d4d298" have entirely different histories.

37 changed files with 460 additions and 1394 deletions

View file

@ -72,35 +72,17 @@
"to": "splatter_color_4", "to": "splatter_color_4",
"to_port": 0 "to_port": 0
}, },
{
"from": "normal_map2",
"from_port": 0,
"to": "Material",
"to_port": 4
},
{ {
"from": "splatter_color_4", "from": "splatter_color_4",
"from_port": 0, "from_port": 0,
"to": "math",
"to_port": 1
},
{
"from": "math",
"from_port": 0,
"to": "normal_map2", "to": "normal_map2",
"to_port": 0 "to_port": 0
}, },
{ {
"from": "fbm2", "from": "normal_map2",
"from_port": 0, "from_port": 0,
"to": "math_2", "to": "Material",
"to_port": 0 "to_port": 4
},
{
"from": "math_2",
"from_port": 0,
"to": "math",
"to_port": 0
} }
], ],
"label": "Graph", "label": "Graph",
@ -136,7 +118,7 @@
"flags_transparent": true, "flags_transparent": true,
"metallic": 0.5, "metallic": 0.5,
"normal": 1, "normal": 1,
"roughness": 0.99, "roughness": 1,
"size": 11, "size": 11,
"sss": 1 "sss": 1
}, },
@ -146,8 +128,8 @@
{ {
"name": "splatter_color", "name": "splatter_color",
"node_position": { "node_position": {
"x": -1112.913086, "x": -791.793091,
"y": 327.805267 "y": 317.725281
}, },
"parameters": { "parameters": {
"count": 91, "count": 91,
@ -314,8 +296,8 @@
"longdesc": "", "longdesc": "",
"name": "graph", "name": "graph",
"node_position": { "node_position": {
"x": -1867.556885, "x": -1546.436768,
"y": 294.590454 "y": 284.510437
}, },
"nodes": [ "nodes": [
{ {
@ -791,16 +773,16 @@
{ {
"name": "splatter_color_2", "name": "splatter_color_2",
"node_position": { "node_position": {
"x": -1661.106567, "x": -1339.98645,
"y": 316.359406 "y": 306.279388
}, },
"parameters": { "parameters": {
"count": 25, "count": 100,
"opacity": 0, "opacity": 0,
"rotate": 180, "rotate": 180,
"scale": 0, "scale": 0,
"scale_x": 0.1, "scale_x": 0.05,
"scale_y": 0.1, "scale_y": 0.05,
"select_inputs": 0, "select_inputs": 0,
"variations": false "variations": false
}, },
@ -811,8 +793,8 @@
{ {
"name": "buffer_2", "name": "buffer_2",
"node_position": { "node_position": {
"x": -1364.888794, "x": -1043.768799,
"y": 323.171173 "y": 313.091156
}, },
"parameters": { "parameters": {
"size": 11 "size": 11
@ -824,8 +806,8 @@
{ {
"name": "shape_2", "name": "shape_2",
"node_position": { "node_position": {
"x": -1906.898926, "x": -1585.778931,
"y": 418.425751 "y": 408.345734
}, },
"parameters": { "parameters": {
"edge": 0, "edge": 0,
@ -848,17 +830,17 @@
"points": [ "points": [
{ {
"a": 1, "a": 1,
"b": 0.131104, "b": 0.031738,
"g": 0.164148, "g": 0.104694,
"pos": 0, "pos": 0,
"r": 0.1875 "r": 0.15625
}, },
{ {
"a": 1, "a": 1,
"b": 0.153458, "b": 0.038681,
"g": 0.221731, "g": 0.114346,
"pos": 1, "pos": 1,
"r": 0.347656 "r": 0.253906
} }
], ],
"type": "Gradient" "type": "Gradient"
@ -870,34 +852,34 @@
{ {
"name": "fbm2", "name": "fbm2",
"node_position": { "node_position": {
"x": -1106.343384, "x": -1060.343384,
"y": 60.759666 "y": 59.759666
}, },
"parameters": { "parameters": {
"folds": 0, "folds": 0,
"iterations": 5, "iterations": 5,
"noise": 0, "noise": 0,
"offset": 0, "offset": 0,
"persistence": 0.8, "persistence": 0.5,
"scale_x": 56, "scale_x": 10,
"scale_y": 56 "scale_y": 10
}, },
"seed_int": 2835422720, "seed_int": 1560802304,
"type": "fbm2" "type": "fbm2"
}, },
{ {
"name": "splatter_color_3", "name": "splatter_color_3",
"node_position": { "node_position": {
"x": -1664.393433, "x": -1343.273438,
"y": 570.252563 "y": 560.172607
}, },
"parameters": { "parameters": {
"count": 25, "count": 100,
"opacity": 0, "opacity": 0,
"rotate": 180, "rotate": 180,
"scale": 0, "scale": 0,
"scale_x": 0.1, "scale_x": 0.05,
"scale_y": 0.1, "scale_y": 0.05,
"select_inputs": 0, "select_inputs": 0,
"variations": false "variations": false
}, },
@ -908,8 +890,8 @@
{ {
"name": "splatter_color_4", "name": "splatter_color_4",
"node_position": { "node_position": {
"x": -1107.382324, "x": -786.262329,
"y": 587.544556 "y": 577.464539
}, },
"parameters": { "parameters": {
"count": 91, "count": 91,
@ -928,8 +910,8 @@
{ {
"name": "buffer_3", "name": "buffer_3",
"node_position": { "node_position": {
"x": -1362.791992, "x": -1041.671997,
"y": 579.741028 "y": 569.661011
}, },
"parameters": { "parameters": {
"size": 11 "size": 11
@ -941,47 +923,17 @@
{ {
"name": "normal_map2", "name": "normal_map2",
"node_position": { "node_position": {
"x": -413.839508, "x": -492.839508,
"y": 359.223999 "y": 579.223999
}, },
"parameters": { "parameters": {
"buffer": 1, "buffer": 1,
"param2": 0, "param2": 0,
"size": 11, "size": 11,
"strength": 0.99 "strength": 0.04
}, },
"seed_int": 0, "seed_int": 0,
"type": "normal_map2" "type": "normal_map2"
},
{
"name": "math",
"node_position": {
"x": -626.700562,
"y": 374.685303
},
"parameters": {
"clamp": false,
"default_in1": 0,
"default_in2": 0,
"op": 0
},
"seed_int": 0,
"type": "math"
},
{
"name": "math_2",
"node_position": {
"x": -863.68103,
"y": 361.024048
},
"parameters": {
"clamp": false,
"default_in1": 0,
"default_in2": 0.89,
"op": 2
},
"seed_int": 0,
"type": "math"
} }
], ],
"parameters": { "parameters": {

View file

@ -72,35 +72,17 @@
"to": "splatter_color_4", "to": "splatter_color_4",
"to_port": 0 "to_port": 0
}, },
{
"from": "normal_map2",
"from_port": 0,
"to": "Material",
"to_port": 4
},
{ {
"from": "splatter_color_4", "from": "splatter_color_4",
"from_port": 0, "from_port": 0,
"to": "math",
"to_port": 1
},
{
"from": "math",
"from_port": 0,
"to": "normal_map2", "to": "normal_map2",
"to_port": 0 "to_port": 0
}, },
{ {
"from": "fbm2", "from": "normal_map2",
"from_port": 0, "from_port": 0,
"to": "math_2", "to": "Material",
"to_port": 0 "to_port": 4
},
{
"from": "math_2",
"from_port": 0,
"to": "math",
"to_port": 0
} }
], ],
"label": "Graph", "label": "Graph",
@ -119,8 +101,8 @@
}, },
"name": "Material", "name": "Material",
"node_position": { "node_position": {
"x": -386.841217, "x": -198.423416,
"y": 292.341339 "y": 226.924652
}, },
"parameters": { "parameters": {
"albedo_color": { "albedo_color": {
@ -146,8 +128,8 @@
{ {
"name": "splatter_color", "name": "splatter_color",
"node_position": { "node_position": {
"x": -1425.793091, "x": -791.793091,
"y": 318.725281 "y": 317.725281
}, },
"parameters": { "parameters": {
"count": 91, "count": 91,
@ -314,8 +296,8 @@
"longdesc": "", "longdesc": "",
"name": "graph", "name": "graph",
"node_position": { "node_position": {
"x": -2180.436768, "x": -1546.436768,
"y": 285.510437 "y": 284.510437
}, },
"nodes": [ "nodes": [
{ {
@ -778,8 +760,8 @@
"generic_size": 1, "generic_size": 1,
"name": "blend2_2", "name": "blend2_2",
"node_position": { "node_position": {
"x": -948.806091, "x": -489.832764,
"y": 292.396759 "y": 229.591202
}, },
"parameters": { "parameters": {
"amount1": 1, "amount1": 1,
@ -791,8 +773,8 @@
{ {
"name": "splatter_color_2", "name": "splatter_color_2",
"node_position": { "node_position": {
"x": -1973.98645, "x": -1339.98645,
"y": 307.279388 "y": 306.279388
}, },
"parameters": { "parameters": {
"count": 10, "count": 10,
@ -811,8 +793,8 @@
{ {
"name": "buffer_2", "name": "buffer_2",
"node_position": { "node_position": {
"x": -1677.768799, "x": -1043.768799,
"y": 314.091156 "y": 313.091156
}, },
"parameters": { "parameters": {
"size": 11 "size": 11
@ -824,8 +806,8 @@
{ {
"name": "shape_2", "name": "shape_2",
"node_position": { "node_position": {
"x": -2219.778809, "x": -1585.778931,
"y": 409.345734 "y": 408.345734
}, },
"parameters": { "parameters": {
"edge": 0, "edge": 0,
@ -839,8 +821,8 @@
{ {
"name": "colorize", "name": "colorize",
"node_position": { "node_position": {
"x": -1161.668335, "x": -747.389404,
"y": 71.621239 "y": 224.760132
}, },
"parameters": { "parameters": {
"gradient": { "gradient": {
@ -855,10 +837,10 @@
}, },
{ {
"a": 1, "a": 1,
"b": 0.031906, "b": 0.069809,
"g": 0.199219, "g": 0.292969,
"pos": 1, "pos": 1,
"r": 0.115562 "r": 0.181389
} }
], ],
"type": "Gradient" "type": "Gradient"
@ -870,17 +852,17 @@
{ {
"name": "fbm2", "name": "fbm2",
"node_position": { "node_position": {
"x": -1420.343384, "x": -1094.343384,
"y": 75.759666 "y": 44.759666
}, },
"parameters": { "parameters": {
"folds": 0, "folds": 0,
"iterations": 4, "iterations": 5,
"noise": 0, "noise": 0,
"offset": 0, "offset": 0,
"persistence": 1, "persistence": 1,
"scale_x": 100, "scale_x": 30,
"scale_y": 100 "scale_y": 30
}, },
"seed_int": 1560802304, "seed_int": 1560802304,
"type": "fbm2" "type": "fbm2"
@ -888,8 +870,8 @@
{ {
"name": "splatter_color_3", "name": "splatter_color_3",
"node_position": { "node_position": {
"x": -1977.273438, "x": -1343.273438,
"y": 561.172607 "y": 560.172607
}, },
"parameters": { "parameters": {
"count": 10, "count": 10,
@ -908,8 +890,8 @@
{ {
"name": "splatter_color_4", "name": "splatter_color_4",
"node_position": { "node_position": {
"x": -1420.262329, "x": -786.262329,
"y": 578.464539 "y": 577.464539
}, },
"parameters": { "parameters": {
"count": 91, "count": 91,
@ -928,8 +910,8 @@
{ {
"name": "buffer_3", "name": "buffer_3",
"node_position": { "node_position": {
"x": -1675.671997, "x": -1041.671997,
"y": 570.661011 "y": 569.661011
}, },
"parameters": { "parameters": {
"size": 11 "size": 11
@ -941,8 +923,8 @@
{ {
"name": "normal_map2", "name": "normal_map2",
"node_position": { "node_position": {
"x": -600.17395, "x": -492.839508,
"y": 524.835083 "y": 579.223999
}, },
"parameters": { "parameters": {
"buffer": 1, "buffer": 1,
@ -952,36 +934,6 @@
}, },
"seed_int": 0, "seed_int": 0,
"type": "normal_map2" "type": "normal_map2"
},
{
"name": "math",
"node_position": {
"x": -880.893921,
"y": 525.385376
},
"parameters": {
"clamp": false,
"default_in1": 0,
"default_in2": 0,
"op": 0
},
"seed_int": 0,
"type": "math"
},
{
"name": "math_2",
"node_position": {
"x": -1123.893921,
"y": 467.385376
},
"parameters": {
"clamp": false,
"default_in1": 0,
"default_in2": 0,
"op": 0
},
"seed_int": 0,
"type": "math"
} }
], ],
"parameters": { "parameters": {

View file

@ -37,28 +37,10 @@
"to_port": 0 "to_port": 0
}, },
{ {
"from": "fbm2_2", "from": "blend2",
"from_port": 0,
"to": "math",
"to_port": 0
},
{
"from": "math",
"from_port": 0, "from_port": 0,
"to": "normal_map2", "to": "normal_map2",
"to_port": 0 "to_port": 0
},
{
"from": "colorize_2",
"from_port": 0,
"to": "decompose",
"to_port": 0
},
{
"from": "decompose",
"from_port": 3,
"to": "math",
"to_port": 1
} }
], ],
"label": "Graph", "label": "Graph",
@ -70,9 +52,9 @@
}, },
"nodes": [ "nodes": [
{ {
"export_last_target": "Blender", "export_last_target": "Godot/Godot 4 Standard",
"export_paths": { "export_paths": {
"Blender": "/home/sara/Documents/gd-projects/going/project/materials/forest_path", "Blender": "/home/sara/Documents/gd-projects/going/project/materials/leaves",
"Godot/Godot 4 Standard": "/home/sara/Documents/gd-projects/going/project/materials/forest_background" "Godot/Godot 4 Standard": "/home/sara/Documents/gd-projects/going/project/materials/forest_background"
}, },
"name": "Material", "name": "Material",
@ -104,14 +86,14 @@
{ {
"name": "normal_map2", "name": "normal_map2",
"node_position": { "node_position": {
"x": -1.449733, "x": -26.293844,
"y": 389.164001 "y": 770.812927
}, },
"parameters": { "parameters": {
"buffer": 1, "buffer": 1,
"param2": 0, "param2": 0,
"size": 11, "size": 11,
"strength": 1 "strength": 0.04
}, },
"seed_int": 0, "seed_int": 0,
"type": "normal_map2" "type": "normal_map2"
@ -119,14 +101,14 @@
{ {
"name": "voronoi2", "name": "voronoi2",
"node_position": { "node_position": {
"x": -920.193176, "x": -1831.151123,
"y": 453.709656 "y": 801.731445
}, },
"parameters": { "parameters": {
"intensity": 1, "intensity": 1,
"randomness": 0.85, "randomness": 0.85,
"scale_x": 10, "scale_x": 20,
"scale_y": 10, "scale_y": 20,
"stretch_x": 1, "stretch_x": 1,
"stretch_y": 1 "stretch_y": 1
}, },
@ -136,8 +118,8 @@
{ {
"name": "colorize_2", "name": "colorize_2",
"node_position": { "node_position": {
"x": -478.693665, "x": -1529.762695,
"y": 303.052216 "y": 784.490662
}, },
"parameters": { "parameters": {
"gradient": { "gradient": {
@ -174,8 +156,8 @@
{ {
"name": "fbm2_2", "name": "fbm2_2",
"node_position": { "node_position": {
"x": -913.745178, "x": -1852.425293,
"y": 232.883148 "y": 567.349365
}, },
"parameters": { "parameters": {
"folds": 0, "folds": 0,
@ -192,8 +174,8 @@
{ {
"name": "colorize_3", "name": "colorize_3",
"node_position": { "node_position": {
"x": -479.851654, "x": -1512.30957,
"y": 232.562012 "y": 564.000488
}, },
"parameters": { "parameters": {
"gradient": { "gradient": {
@ -231,8 +213,8 @@
"generic_size": 2, "generic_size": 2,
"name": "blend2", "name": "blend2",
"node_position": { "node_position": {
"x": -80.948402, "x": -898.559509,
"y": 210.959229 "y": 193.264801
}, },
"parameters": { "parameters": {
"amount1": 1, "amount1": 1,
@ -242,33 +224,6 @@
}, },
"seed_int": 0, "seed_int": 0,
"type": "blend2" "type": "blend2"
},
{
"name": "math",
"node_position": {
"x": -257.925568,
"y": 386.996735
},
"parameters": {
"clamp": false,
"default_in1": 0,
"default_in2": 0,
"op": 14
},
"seed_int": 0,
"type": "math"
},
{
"name": "decompose",
"node_position": {
"x": -509.314453,
"y": 458.830078
},
"parameters": {
},
"seed_int": 0,
"type": "decompose"
} }
], ],
"parameters": { "parameters": {

View file

@ -1,253 +0,0 @@
{
"connections": [
{
"from": "voronoi2",
"from_port": 1,
"to": "math",
"to_port": 0
},
{
"from": "voronoi2_2",
"from_port": 1,
"to": "math",
"to_port": 1
},
{
"from": "math",
"from_port": 0,
"to": "math_2",
"to_port": 0
},
{
"from": "math_2",
"from_port": 0,
"to": "math_3",
"to_port": 0
},
{
"from": "math_3",
"from_port": 0,
"to": "colorize",
"to_port": 0
},
{
"from": "fbm2",
"from_port": 0,
"to": "math_3",
"to_port": 1
},
{
"from": "colorize",
"from_port": 0,
"to": "Material",
"to_port": 0
},
{
"from": "math_3",
"from_port": 0,
"to": "normal_map2",
"to_port": 0
},
{
"from": "normal_map2",
"from_port": 0,
"to": "Material",
"to_port": 4
}
],
"label": "Graph",
"longdesc": "",
"name": "@@457",
"node_position": {
"x": 0,
"y": 0
},
"nodes": [
{
"export_paths": {
},
"name": "Material",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"albedo_color": {
"a": 1,
"b": 1,
"g": 1,
"r": 1,
"type": "Color"
},
"ao": 1,
"depth_scale": 0.5,
"emission_energy": 1,
"flags_transparent": true,
"metallic": 0.18,
"normal": 1,
"roughness": 0.75,
"size": 11,
"sss": 1
},
"seed_int": 0,
"type": "material"
},
{
"name": "voronoi2",
"node_position": {
"x": -1558.648071,
"y": 43.027004
},
"parameters": {
"intensity": 1,
"randomness": 0.85,
"scale_x": 5,
"scale_y": 5,
"stretch_x": 1,
"stretch_y": 1
},
"seed_int": 3400064256,
"type": "voronoi2"
},
{
"name": "voronoi2_2",
"node_position": {
"x": -1545.386719,
"y": 266.722321
},
"parameters": {
"intensity": 1,
"randomness": 0.85,
"scale_x": 8,
"scale_y": 8,
"stretch_x": 1,
"stretch_y": 1
},
"seed_int": 805130240,
"type": "voronoi2"
},
{
"name": "math",
"node_position": {
"x": -1213.068115,
"y": 39.681469
},
"parameters": {
"clamp": false,
"default_in1": 0,
"default_in2": 0,
"op": 2
},
"seed_int": 0,
"type": "math"
},
{
"name": "math_2",
"node_position": {
"x": -899.603638,
"y": 8.817272
},
"parameters": {
"clamp": true,
"default_in1": 0,
"default_in2": 6.23,
"op": 2
},
"seed_int": 0,
"type": "math"
},
{
"name": "colorize",
"node_position": {
"x": -367.710571,
"y": -1.664642
},
"parameters": {
"gradient": {
"interpolation": 1,
"points": [
{
"a": 1,
"b": 0.355469,
"g": 0.382843,
"pos": 0,
"r": 0.40625
},
{
"a": 1,
"b": 0.254562,
"g": 0.277418,
"pos": 0.725558,
"r": 0.324219
},
{
"a": 1,
"b": 0.265625,
"g": 0.265625,
"pos": 1,
"r": 0.265625
}
],
"type": "Gradient"
}
},
"seed_int": 0,
"type": "colorize"
},
{
"name": "fbm2",
"node_position": {
"x": -916.424316,
"y": 197.811035
},
"parameters": {
"folds": 0,
"iterations": 5,
"noise": 0,
"offset": 0,
"persistence": 0.68,
"scale_x": 12,
"scale_y": 10
},
"seed_int": 3145071360,
"type": "fbm2"
},
{
"name": "math_3",
"node_position": {
"x": -631.64917,
"y": -25.611832
},
"parameters": {
"clamp": false,
"default_in1": 0,
"default_in2": 0,
"op": 0
},
"seed_int": 0,
"type": "math"
},
{
"name": "normal_map2",
"node_position": {
"x": -344.217163,
"y": 215.993896
},
"parameters": {
"buffer": 1,
"param2": 0,
"size": 11,
"strength": 1
},
"seed_int": 0,
"type": "normal_map2"
}
],
"parameters": {
},
"seed_int": 0,
"shortdesc": "",
"type": "graph"
}

View file

@ -1,65 +0,0 @@
#include "checkpoint.h"
#include "core/config/engine.h"
#include "going/player_body.h"
#include "macros.h"
void Checkpoint::_bind_methods() {
BIND_PROPERTY(Variant::VECTOR3, location);
BIND_PROPERTY(Variant::BOOL, can_jump);
BIND_PROPERTY(Variant::BOOL, can_bash);
}
void Checkpoint::set_location(Transform3D location) {
this->location = location;
}
Transform3D Checkpoint::get_location() const {
return this->location;
}
void Checkpoint::set_can_jump(bool can_jump) {
this->can_jump = can_jump;
}
bool Checkpoint::get_can_jump() const {
return this->can_jump;
}
void Checkpoint::set_can_bash(bool can_bash) {
this->can_bash = can_bash;
}
bool Checkpoint::get_can_bash() const {
return this->can_bash;
}
void Checkpoint::load(PlayerBody *body) const {
body->set_global_transform(this->location);
body->set_can_jump(this->can_jump);
// body->set_can_bash(this->can_bash);
}
void Checkpoint::save(PlayerBody *body) {
this->set_location(body->get_global_transform_interpolated());
this->set_can_jump(body->get_can_jump());
// self->set_can_bash(body->get_can_bash());
}
Ref<Checkpoint> Checkpoint::save_new(PlayerBody *body) {
Ref<Checkpoint> self{memnew(Checkpoint)};
self->save(body);
return self;
}
void CheckpointArea::_notification(int what) {
if(!Engine::get_singleton()->is_editor_hint() && what == NOTIFICATION_READY) {
this->connect(this->body_entered, callable_mp(this, &self_type::on_body_entered));
}
}
void CheckpointArea::on_body_entered(Node3D *body) {
if(PlayerBody *player{Object::cast_to<PlayerBody>(body)}) {
player->save_checkpoint();
}
}

View file

@ -1,37 +0,0 @@
#ifndef CHECKPOINT_H
#define CHECKPOINT_H
#include "core/io/resource.h"
#include "core/math/transform_3d.h"
#include "scene/3d/node_3d.h"
#include "scene/3d/physics/area_3d.h"
class PlayerBody;
class Checkpoint : public Resource {
GDCLASS(Checkpoint, Resource);
static void _bind_methods();
public:
void set_location(Transform3D location);
Transform3D get_location() const;
void set_can_jump(bool can_jump);
bool get_can_jump() const;
void set_can_bash(bool can_bash);
bool get_can_bash() const;
void load(PlayerBody *body) const;
void save(PlayerBody *body);
static Ref<Checkpoint> save_new(PlayerBody *body);
private:
Transform3D location{};
bool can_jump{false}, can_bash{false};
};
class CheckpointArea : public Area3D {
GDCLASS(CheckpointArea, Area3D);
static void _bind_methods() {}
void _notification(int what);
void on_body_entered(Node3D *body);
StringName body_entered{"body_entered"};
};
#endif // !CHECKPOINT_H

View file

@ -2,12 +2,10 @@
#include "core/config/engine.h" #include "core/config/engine.h"
#include "core/input/input.h" #include "core/input/input.h"
#include "core/math/math_funcs.h" #include "core/math/math_funcs.h"
#include "core/object/class_db.h"
#include "macros.h"
#include "player_states.h"
#include "scene/3d/camera_3d.h" #include "scene/3d/camera_3d.h"
#include "scene/animation/animation_player.h" #include "scene/animation/animation_player.h"
#include "scene/main/viewport.h" #include "scene/main/viewport.h"
#include "macros.h"
char *const PlayerBody::split_step_action{const_cast<char*>("split_step")}; char *const PlayerBody::split_step_action{const_cast<char*>("split_step")};
char *const PlayerBody::move_left_action{const_cast<char*>("move_left")}; char *const PlayerBody::move_left_action{const_cast<char*>("move_left")};
@ -18,8 +16,6 @@ char *const PlayerBody::move_back_action{const_cast<char*>("move_back")};
void PlayerBody::_bind_methods() { void PlayerBody::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_desired_velocity"), &self_type::get_desired_velocity); ClassDB::bind_method(D_METHOD("get_desired_velocity"), &self_type::get_desired_velocity);
ClassDB::bind_method(D_METHOD("get_desired_direction"), &self_type::get_desired_direction); ClassDB::bind_method(D_METHOD("get_desired_direction"), &self_type::get_desired_direction);
ClassDB::bind_method(D_METHOD("save_checkpoint"), &self_type::save_checkpoint);
ClassDB::bind_method(D_METHOD("load_checkpoint"), &self_type::load_checkpoint);
BIND_PROPERTY(Variant::FLOAT, stopping_deceleration); BIND_PROPERTY(Variant::FLOAT, stopping_deceleration);
BIND_PROPERTY(Variant::FLOAT, start_speed); BIND_PROPERTY(Variant::FLOAT, start_speed);
@ -62,7 +58,6 @@ void PlayerBody::enter_tree() {
this->anim = Object::cast_to<AnimationPlayer>(this->get_node(NodePath("character/AnimationPlayer"))); this->anim = Object::cast_to<AnimationPlayer>(this->get_node(NodePath("character/AnimationPlayer")));
this->camera = Object::cast_to<Camera3D>(this->get_node(NodePath("Camera3D"))); this->camera = Object::cast_to<Camera3D>(this->get_node(NodePath("Camera3D")));
this->camera->set_fov(this->min_fov); this->camera->set_fov(this->min_fov);
this->last_checkpoint = Checkpoint::save_new(this);
} }
void PlayerBody::process(double delta) { void PlayerBody::process(double delta) {
@ -79,15 +74,6 @@ void PlayerBody::physics_process(double delta) {
this->move_and_slide(); this->move_and_slide();
} }
void PlayerBody::save_checkpoint() {
this->last_checkpoint->save(this);
}
void PlayerBody::load_checkpoint() {
this->last_checkpoint->load(this);
this->state->force_state<FallingState>();
}
Vector3 PlayerBody::get_desired_direction() const { Vector3 PlayerBody::get_desired_direction() const {
Basis const global{this->camera->get_global_basis()}; Basis const global{this->camera->get_global_basis()};
Vector3 forward{global.get_column(2)}; Vector3 forward{global.get_column(2)};

View file

@ -1,11 +1,9 @@
#ifndef PLAYER_BODY_H #ifndef PLAYER_BODY_H
#define PLAYER_BODY_H #define PLAYER_BODY_H
#include "going/checkpoint.h"
#include "scene/3d/camera_3d.h" #include "scene/3d/camera_3d.h"
#include "scene/3d/physics/character_body_3d.h" #include "scene/3d/physics/character_body_3d.h"
#include "scene/animation/animation_player.h" #include "scene/animation/animation_player.h"
class PlayerStateMachine;
class PlayerBody : public CharacterBody3D { class PlayerBody : public CharacterBody3D {
GDCLASS(PlayerBody, CharacterBody3D); GDCLASS(PlayerBody, CharacterBody3D);
@ -16,8 +14,6 @@ class PlayerBody : public CharacterBody3D {
void physics_process(double delta); void physics_process(double delta);
public: public:
void save_checkpoint();
void load_checkpoint();
Vector3 get_desired_direction() const; Vector3 get_desired_direction() const;
Vector3 get_desired_velocity() const; Vector3 get_desired_velocity() const;
Vector2 get_movement_input() const; Vector2 get_movement_input() const;
@ -75,8 +71,6 @@ private:
float model_lean_speed{0.25f}; float model_lean_speed{0.25f};
double game_over_speed{1.0/4.0}; double game_over_speed{1.0/4.0};
bool can_jump{false}; bool can_jump{false};
Ref<Checkpoint> last_checkpoint{nullptr};
PlayerStateMachine *state{nullptr};
public: public:
static char *const split_step_action; static char *const split_step_action;
static char *const move_left_action; static char *const move_left_action;

View file

@ -30,7 +30,7 @@ void StandingState::process(double delta) {
this->game_over_timer += delta * this->get_body()->get_game_over_speed(); this->game_over_timer += delta * this->get_body()->get_game_over_speed();
if(this->game_over_timer > 1.0) { if(this->game_over_timer > 1.0) {
RenderingServer::get_singleton()->global_shader_parameter_set(this->game_over_param, 0.0); RenderingServer::get_singleton()->global_shader_parameter_set(this->game_over_param, 0.0);
this->get_body()->load_checkpoint(); SceneTree::get_singleton()->reload_current_scene();
} else { } else {
RenderingServer::get_singleton()->global_shader_parameter_set(this->game_over_param, float(this->game_over_timer)); RenderingServer::get_singleton()->global_shader_parameter_set(this->game_over_param, float(this->game_over_timer));
this->game_over_timer = MIN(this->game_over_timer, 1.f); this->game_over_timer = MIN(this->game_over_timer, 1.f);
@ -78,7 +78,7 @@ void RunningState::process_lean(double delta) {
Vector3 const up{Vector3{0.0, 1.0, 0.0} + Vector3{cross.x, 0.f, cross.y} * this->lean_modifier}; Vector3 const up{Vector3{0.0, 1.0, 0.0} + Vector3{cross.x, 0.f, cross.y} * this->lean_modifier};
Vector3 const forward{current.x, 0.f, current.z}; Vector3 const forward{current.x, 0.f, current.z};
if(!forward.is_zero_approx()) { if(!forward.is_zero_approx()) {
this->get_body()->get_model()->look_at(this->get_body()->get_global_position() - forward, up); this->get_body()->get_model()->look_at(this->get_body()->get_global_position() - current, up);
} }
} }
} }
@ -100,20 +100,18 @@ void RunningState::physics_process(double delta) {
void RunningState::state_exited() { void RunningState::state_exited() {
Vector3 const velocity{this->get_body()->get_velocity()}; Vector3 const velocity{this->get_body()->get_velocity()};
Vector3 velocity_flat{velocity.x, 0.f, velocity.z}; Vector3 const velocity_flat{velocity.x, 0.f, velocity.z};
if(velocity_flat.is_zero_approx()) { if(!velocity_flat.is_zero_approx()) {
velocity_flat = this->get_body()->get_model()->get_global_basis().get_column(2);
}
this->get_body()->get_model()->look_at(this->get_body()->get_global_position() - velocity_flat); this->get_body()->get_model()->look_at(this->get_body()->get_global_position() - velocity_flat);
}
this->lean_modifier = 0.f; this->lean_modifier = 0.f;
} }
PlayerState::StateID SplitStepState::get_next_state() const { PlayerState::StateID SplitStepState::get_next_state() const {
bool const jump_input{this->get_body()->get_can_jump() && this->jump}; if(!this->get_body()->is_on_floor()) {
if(jump_input && (this->timer <= 0.0 || !this->get_body()->is_on_floor())) {
return JumpingState::get_class_static();
} else if(!this->get_body()->is_on_floor()) {
return FallingState::get_class_static(); return FallingState::get_class_static();
} else if(this->get_body()->get_can_jump() && this->jump && this->timer <= 0.0) {
return JumpingState::get_class_static();
} else if(this->timer <= 0.0) { } else if(this->timer <= 0.0) {
return RunningState::get_class_static(); return RunningState::get_class_static();
} else { } else {
@ -171,7 +169,7 @@ void FallingState::process(double delta) {
this->game_over_timer += delta * this->get_body()->get_game_over_speed(); this->game_over_timer += delta * this->get_body()->get_game_over_speed();
if(this->game_over_timer > 1.0) { if(this->game_over_timer > 1.0) {
RenderingServer::get_singleton()->global_shader_parameter_set(this->game_over_param, 0.0); RenderingServer::get_singleton()->global_shader_parameter_set(this->game_over_param, 0.0);
this->get_body()->load_checkpoint(); SceneTree::get_singleton()->reload_current_scene();
} else { } else {
RenderingServer::get_singleton()->global_shader_parameter_set(this->game_over_param, float(this->game_over_timer)); RenderingServer::get_singleton()->global_shader_parameter_set(this->game_over_param, float(this->game_over_timer));
this->game_over_timer = MIN(this->game_over_timer, 1.f); this->game_over_timer = MIN(this->game_over_timer, 1.f);

View file

@ -92,10 +92,7 @@ class PlayerStateMachine : public Node {
void try_transition(); void try_transition();
template <class TState> template <class TState>
void add_state(); void add_state();
public:
template <class TState>
void force_state();
private:
PlayerBody *body{nullptr}; PlayerBody *body{nullptr};
PlayerState *current_state{nullptr}; PlayerState *current_state{nullptr};
HashMap<PlayerState::StateID, PlayerState*> states; HashMap<PlayerState::StateID, PlayerState*> states;
@ -103,7 +100,7 @@ private:
template <class TState> template <class TState>
void PlayerStateMachine::add_state() { void PlayerStateMachine::add_state() {
PlayerState *state{memnew(TState)}; PlayerState *state{new TState()};
state->body = this->body; state->body = this->body;
this->states.insert(TState::get_class_static(), state); this->states.insert(TState::get_class_static(), state);
if(this->current_state == nullptr) { if(this->current_state == nullptr) {
@ -112,9 +109,4 @@ void PlayerStateMachine::add_state() {
} }
} }
template <class TState>
void PlayerStateMachine::force_state() {
this->states[TState::get_class_static()];
}
#endif // !PLAYER_STATES_H #endif // !PLAYER_STATES_H

View file

@ -1,7 +1,6 @@
#include "register_types.h" #include "register_types.h"
#include "core/object/class_db.h" #include "core/object/class_db.h"
#include "going/checkpoint.h"
#include "going/game_ui.h" #include "going/game_ui.h"
#include "going/player_body.h" #include "going/player_body.h"
#include "going/player_states.h" #include "going/player_states.h"
@ -19,8 +18,6 @@ void initialize_going_module(ModuleInitializationLevel p_level) {
ClassDB::register_class<JumpingState>(); ClassDB::register_class<JumpingState>();
ClassDB::register_class<PlayerStateMachine>(); ClassDB::register_class<PlayerStateMachine>();
ClassDB::register_class<GameUI>(); ClassDB::register_class<GameUI>();
ClassDB::register_class<Checkpoint>();
ClassDB::register_class<CheckpointArea>();
} }
void uninitialize_going_module(ModuleInitializationLevel p_level) { void uninitialize_going_module(ModuleInitializationLevel p_level) {

View file

@ -5,7 +5,7 @@
albedo_color = Color(1, 1, 1, 1) albedo_color = Color(1, 1, 1, 1)
albedo_texture = ExtResource( 1 ) albedo_texture = ExtResource( 1 )
metallic = 0.5 metallic = 0.5
roughness = 0.99 roughness = 1
normal_enabled = true normal_enabled = true
normal_scale = 1 normal_scale = 1
normal_texture = ExtResource( 3 ) normal_texture = ExtResource( 3 )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 MiB

After

Width:  |  Height:  |  Size: 5.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 MiB

After

Width:  |  Height:  |  Size: 8.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 MiB

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 MiB

After

Width:  |  Height:  |  Size: 4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 MiB

After

Width:  |  Height:  |  Size: 3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

View file

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://fj0r2x60obxu"
path.s3tc="res://.godot/imported/rock_albedo.png-3db7a3d807031a181dd8b984567e86c6.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://materials/rock_albedo.png"
dest_files=["res://.godot/imported/rock_albedo.png-3db7a3d807031a181dd8b984567e86c6.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 MiB

View file

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b3libaaq2jrrh"
path.s3tc="res://.godot/imported/rock_normal.png-0e8750e3e66835c61e06f50b7544661c.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://materials/rock_normal.png"
dest_files=["res://.godot/imported/rock_normal.png-0e8750e3e66835c61e06f50b7544661c.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=1
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=1
roughness/src_normal="res://materials/rock_normal.png"
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

View file

@ -38,20 +38,6 @@ _subresources={
"use_external/enabled": true, "use_external/enabled": true,
"use_external/path": "res://models/props/materials/grass.tres" "use_external/path": "res://models/props/materials/grass.tres"
} }
},
"nodes": {
"PATH:Plane": {
"mesh_instance/cast_shadow": 0,
"mesh_instance/visibility_range_end": 100.0
},
"PATH:Plane_001": {
"mesh_instance/cast_shadow": 0,
"mesh_instance/visibility_range_end": 100.0
},
"PATH:Plane_002": {
"mesh_instance/cast_shadow": 0,
"mesh_instance/visibility_range_end": 100.0
}
} }
} }
blender/nodes/visible=0 blender/nodes/visible=0

View file

@ -1,53 +0,0 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://boouyu1o7q48k"
path="res://.godot/imported/great_tree.blend-4d4334317b12750304824412241654b4.scn"
[deps]
source_file="res://models/props/great_tree.blend"
dest_files=["res://.godot/imported/great_tree.blend-4d4334317b12750304824412241654b4.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/colors=false
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/export_geometry_nodes_instances=false
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,41 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://bjln17owwexi"]
[ext_resource type="PackedScene" uid="uid://cdyr4yad84cp2" path="res://models/pickups/twirly.blend" id="1_60et7"]
[sub_resource type="GDScript" id="GDScript_a2vvy"]
script/source = "extends Area3D
func _on_body_entered(body: Node3D) -> void:
if body.is_class(\"PlayerBody\"):
body.set_can_jump(true)
queue_free()
GameUI.get_singleton().display_message(\"Jump by pressing F during a split-step\")
func _physics_process(delta):
$twirly.rotate_y(delta * 2.0)
"
[sub_resource type="SphereShape3D" id="SphereShape3D_a2vvy"]
radius = 1.61546
[node name="JumpPickup" type="Area3D"]
script = SubResource("GDScript_a2vvy")
[node name="twirly" parent="." instance=ExtResource("1_60et7")]
[node name="OmniLight3D" type="OmniLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.503185, 0)
light_color = Color(0.880355, 0.555272, 0, 1)
light_energy = 8.133
omni_range = 3.15575
[node name="OmniLight3D2" type="OmniLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.00915, 0)
light_color = Color(0.880355, 0.555272, 0, 1)
light_energy = 8.133
omni_range = 3.15575
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_a2vvy")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View file

@ -31,7 +31,7 @@ collision_mask = 3
wall_min_slide_angle = 0.785398 wall_min_slide_angle = 0.785398
floor_max_angle = 0.460767 floor_max_angle = 0.460767
floor_snap_length = 0.35 floor_snap_length = 0.35
acceleration = 15.0 acceleration = 10.0
target_speed = 25.0 target_speed = 25.0
jump_impulse = Vector2(0.9, 5) jump_impulse = Vector2(0.9, 5)

View file

@ -15,7 +15,6 @@ specular_mode = 1
albedo_texture = ExtResource("2_t4bw2") albedo_texture = ExtResource("2_t4bw2")
disable_receive_shadows = true disable_receive_shadows = true
billboard_mode = 2 billboard_mode = 2
billboard_keep_scale = true
[sub_resource type="SphereMesh" id="SphereMesh_t4bw2"] [sub_resource type="SphereMesh" id="SphereMesh_t4bw2"]
radius = 10.024 radius = 10.024

View file

@ -46,12 +46,12 @@ move_back={
} }
split_step={ split_step={
"deadzone": 0.2, "deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
] ]
} }
jump={ jump={
"deadzone": 0.2, "deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"key_label":0,"unicode":102,"location":0,"echo":false,"script":null)
] ]
} }

File diff suppressed because it is too large Load diff