Compare commits

...

6 commits

Author SHA1 Message Date
Sara a0831c3146 feat: added hood 2025-06-10 23:29:24 +02:00
Sara 87cc4aebbd feat: changed controls to shift+space 2025-06-10 23:29:24 +02:00
Sara 6a5b3db577 feat: adjused scene 2025-06-10 23:29:24 +02:00
Sara 37b7b94566 feat: implemented initial checkpoint mechanic 2025-06-10 23:29:24 +02:00
Sara 4ef4212d26 feat: improved normal maps 2025-06-10 00:10:19 +02:00
Sara b9afbad80d feat: level adjustments 2025-06-09 12:18:41 +02:00
37 changed files with 1457 additions and 523 deletions

View file

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

View file

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

View file

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

253
materials/stone.ptex Normal file
View file

@ -0,0 +1,253 @@
{
"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

@ -0,0 +1,65 @@
#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

@ -0,0 +1,37 @@
#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,10 +2,12 @@
#include "core/config/engine.h"
#include "core/input/input.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/animation/animation_player.h"
#include "scene/main/viewport.h"
#include "macros.h"
char *const PlayerBody::split_step_action{const_cast<char*>("split_step")};
char *const PlayerBody::move_left_action{const_cast<char*>("move_left")};
@ -16,6 +18,8 @@ char *const PlayerBody::move_back_action{const_cast<char*>("move_back")};
void PlayerBody::_bind_methods() {
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("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, start_speed);
@ -58,6 +62,7 @@ void PlayerBody::enter_tree() {
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->set_fov(this->min_fov);
this->last_checkpoint = Checkpoint::save_new(this);
}
void PlayerBody::process(double delta) {
@ -74,6 +79,15 @@ void PlayerBody::physics_process(double delta) {
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 {
Basis const global{this->camera->get_global_basis()};
Vector3 forward{global.get_column(2)};

View file

@ -1,9 +1,11 @@
#ifndef PLAYER_BODY_H
#define PLAYER_BODY_H
#include "going/checkpoint.h"
#include "scene/3d/camera_3d.h"
#include "scene/3d/physics/character_body_3d.h"
#include "scene/animation/animation_player.h"
class PlayerStateMachine;
class PlayerBody : public CharacterBody3D {
GDCLASS(PlayerBody, CharacterBody3D);
@ -14,6 +16,8 @@ class PlayerBody : public CharacterBody3D {
void physics_process(double delta);
public:
void save_checkpoint();
void load_checkpoint();
Vector3 get_desired_direction() const;
Vector3 get_desired_velocity() const;
Vector2 get_movement_input() const;
@ -71,6 +75,8 @@ private:
float model_lean_speed{0.25f};
double game_over_speed{1.0/4.0};
bool can_jump{false};
Ref<Checkpoint> last_checkpoint{nullptr};
PlayerStateMachine *state{nullptr};
public:
static char *const split_step_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();
if(this->game_over_timer > 1.0) {
RenderingServer::get_singleton()->global_shader_parameter_set(this->game_over_param, 0.0);
SceneTree::get_singleton()->reload_current_scene();
this->get_body()->load_checkpoint();
} else {
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);
@ -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 forward{current.x, 0.f, current.z};
if(!forward.is_zero_approx()) {
this->get_body()->get_model()->look_at(this->get_body()->get_global_position() - current, up);
this->get_body()->get_model()->look_at(this->get_body()->get_global_position() - forward, up);
}
}
}
@ -100,18 +100,20 @@ void RunningState::physics_process(double delta) {
void RunningState::state_exited() {
Vector3 const velocity{this->get_body()->get_velocity()};
Vector3 const velocity_flat{velocity.x, 0.f, velocity.z};
if(!velocity_flat.is_zero_approx()) {
this->get_body()->get_model()->look_at(this->get_body()->get_global_position() - velocity_flat);
Vector3 velocity_flat{velocity.x, 0.f, velocity.z};
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->lean_modifier = 0.f;
}
PlayerState::StateID SplitStepState::get_next_state() const {
if(!this->get_body()->is_on_floor()) {
return FallingState::get_class_static();
} else if(this->get_body()->get_can_jump() && this->jump && this->timer <= 0.0) {
bool const jump_input{this->get_body()->get_can_jump() && this->jump};
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();
} else if(this->timer <= 0.0) {
return RunningState::get_class_static();
} else {
@ -169,7 +171,7 @@ void FallingState::process(double delta) {
this->game_over_timer += delta * this->get_body()->get_game_over_speed();
if(this->game_over_timer > 1.0) {
RenderingServer::get_singleton()->global_shader_parameter_set(this->game_over_param, 0.0);
SceneTree::get_singleton()->reload_current_scene();
this->get_body()->load_checkpoint();
} else {
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);

View file

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

View file

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

View file

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 MiB

After

Width:  |  Height:  |  Size: 5.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 MiB

After

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 MiB

After

Width:  |  Height:  |  Size: 5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 8.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 MiB

After

Width:  |  Height:  |  Size: 3.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 MiB

After

Width:  |  Height:  |  Size: 10 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View file

@ -0,0 +1,35 @@
[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.

After

Width:  |  Height:  |  Size: 5.7 MiB

View file

@ -0,0 +1,35 @@
[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,6 +38,20 @@ _subresources={
"use_external/enabled": true,
"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

Binary file not shown.

View file

@ -0,0 +1,53 @@
[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.

Binary file not shown.

View file

@ -0,0 +1,41 @@
[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
floor_max_angle = 0.460767
floor_snap_length = 0.35
acceleration = 10.0
acceleration = 15.0
target_speed = 25.0
jump_impulse = Vector2(0.9, 5)

View file

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

View file

@ -46,12 +46,12 @@ move_back={
}
split_step={
"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":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
jump={
"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":70,"key_label":0,"unicode":102,"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)
]
}

File diff suppressed because it is too large Load diff