feat: initialized template and wrote first gameplay code
This commit is contained in:
parent
82f2cae0f6
commit
46a958f801
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -11,9 +11,9 @@ config.log
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
engine/.github
|
engine/.github
|
||||||
project/.godot
|
project/.godot
|
||||||
build/PROJECT.pck
|
build/wave_survival.pck
|
||||||
build/PROJECT.x86_64
|
build/wave_survival.x86_64
|
||||||
build/PROJECT.exe
|
build/wave_survival.exe
|
||||||
build.zip
|
build.zip
|
||||||
|
|
||||||
# general-purpose cache folder (used by e.g clangd)
|
# general-purpose cache folder (used by e.g clangd)
|
||||||
|
|
BIN
assets/models/first_person_arms.blend
Normal file
BIN
assets/models/first_person_arms.blend
Normal file
Binary file not shown.
BIN
assets/models/weapons/rifle.blend
Normal file
BIN
assets/models/weapons/rifle.blend
Normal file
Binary file not shown.
BIN
assets/models/weapons/rifle.blend1
Normal file
BIN
assets/models/weapons/rifle.blend1
Normal file
Binary file not shown.
2
engine
2
engine
|
@ -1 +1 @@
|
||||||
Subproject commit 215acd52e82f4c575abb715e25e54558deeef998
|
Subproject commit c6d130abd9188f313e6701d01a0ddd6ea32166a0
|
2
justfile
2
justfile
|
@ -1,6 +1,6 @@
|
||||||
set export
|
set export
|
||||||
|
|
||||||
BUILD_NAME := "change_me"
|
BUILD_NAME := "wave_survival"
|
||||||
|
|
||||||
build: format
|
build: format
|
||||||
# Compiling Editor
|
# Compiling Editor
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
#include "register_types.h"
|
|
||||||
|
|
||||||
#include "core/object/class_db.h"
|
|
||||||
|
|
||||||
void initialize_PROJECT_module(ModuleInitializationLevel p_level) {
|
|
||||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void uninitialize_PROJECT_module(ModuleInitializationLevel p_level) {
|
|
||||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
#ifndef PROJECT_REGISTER_TYPES_H
|
|
||||||
#define PROJECT_REGISTER_TYPES_H
|
|
||||||
|
|
||||||
#include "modules/register_module_types.h"
|
|
||||||
|
|
||||||
void initialize_PROJECT_module(ModuleInitializationLevel p_level);
|
|
||||||
void uninitialize_PROJECT_module(ModuleInitializationLevel p_level);
|
|
||||||
|
|
||||||
#endif // !PROJECT_REGISTER_TYPES_H
|
|
|
@ -1,3 +1,4 @@
|
||||||
Import('env')
|
Import('env')
|
||||||
|
|
||||||
env.add_source_files(env.modules_sources, "*.cpp")
|
env.add_source_files(env.modules_sources, "*.cpp")
|
||||||
|
env.add_source_files(env.modules_sources, "weapons/*.cpp")
|
BIN
modules/wave_survival/__pycache__/config.cpython-313.pyc
Normal file
BIN
modules/wave_survival/__pycache__/config.cpython-313.pyc
Normal file
Binary file not shown.
|
@ -17,4 +17,11 @@
|
||||||
ADD_PROPERTY(PropertyInfo(m_type, #m_property), "set_" #m_property, \
|
ADD_PROPERTY(PropertyInfo(m_type, #m_property), "set_" #m_property, \
|
||||||
"get_" #m_property)
|
"get_" #m_property)
|
||||||
|
|
||||||
|
#define GETSET(m_value, m_block) \
|
||||||
|
{ \
|
||||||
|
auto m_value{ get_##m_value() }; \
|
||||||
|
m_block \
|
||||||
|
set_##m_value(m_value); \
|
||||||
|
}
|
||||||
|
|
||||||
#endif // !GODOT_EXTRA_MACROS_H
|
#endif // !GODOT_EXTRA_MACROS_H
|
89
modules/wave_survival/player_body.cpp
Normal file
89
modules/wave_survival/player_body.cpp
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
#include "player_body.h"
|
||||||
|
#include "macros.h"
|
||||||
|
#include "player_input.h"
|
||||||
|
|
||||||
|
PlayerBody *PlayerBody::singleton_instance{ nullptr };
|
||||||
|
|
||||||
|
void PlayerBody::_bind_methods() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerBody::ready() {
|
||||||
|
PlayerInput *input{ cast_to<PlayerInput>(get_node(NodePath("%PlayerInput"))) };
|
||||||
|
input->connect(PlayerInput::sig_movement_input, callable_mp(this, &self_type::set_movement_input));
|
||||||
|
input->connect(PlayerInput::sig_look_input, callable_mp(this, &self_type::on_look_input));
|
||||||
|
input->connect(PlayerInput::sig_jump, callable_mp(this, &self_type::on_jump_input));
|
||||||
|
input->connect(PlayerInput::sig_run, callable_mp(this, &self_type::on_run_input));
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerBody::process(double delta) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerBody::physics_process(double delta) {
|
||||||
|
GETSET(velocity, {
|
||||||
|
Vector2 input{ this->movement_input.normalized() };
|
||||||
|
if (get_is_running()) {
|
||||||
|
input.y *= this->run_speed;
|
||||||
|
input.x *= this->walk_speed;
|
||||||
|
} else {
|
||||||
|
input *= this->walk_speed;
|
||||||
|
}
|
||||||
|
velocity = velocity.move_toward(Vector3{ input.y * get_global_basis().get_column(2) + input.x * get_global_basis().get_column(0) } + Vector3{ 0.f, velocity.y, 0.f }, delta * this->acceleration);
|
||||||
|
velocity += get_gravity() * delta;
|
||||||
|
});
|
||||||
|
move_and_slide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerBody::set_movement_input(Vector2 state) {
|
||||||
|
this->movement_input = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerBody::on_look_input(Vector2 look) {
|
||||||
|
rotate_y(look.x);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerBody::on_jump_input() {
|
||||||
|
if (this->is_on_floor()) {
|
||||||
|
GETSET(velocity, {
|
||||||
|
velocity.y = this->jump_strength;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerBody::on_run_input(bool run) {
|
||||||
|
this->try_running = run;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerBody::_notification(int what) {
|
||||||
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
|
return; // don't run in editor
|
||||||
|
}
|
||||||
|
switch (what) {
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
case NOTIFICATION_ENTER_TREE:
|
||||||
|
singleton_instance = this;
|
||||||
|
return;
|
||||||
|
case NOTIFICATION_EXIT_TREE:
|
||||||
|
singleton_instance = nullptr;
|
||||||
|
return;
|
||||||
|
case NOTIFICATION_READY:
|
||||||
|
set_process(true);
|
||||||
|
set_physics_process(true);
|
||||||
|
ready();
|
||||||
|
return;
|
||||||
|
case NOTIFICATION_PROCESS:
|
||||||
|
process(get_process_delta_time());
|
||||||
|
return;
|
||||||
|
case NOTIFICATION_PHYSICS_PROCESS:
|
||||||
|
physics_process(get_physics_process_delta_time());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerBody *PlayerBody::get_singleton() {
|
||||||
|
return singleton_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PlayerBody::get_is_running() const {
|
||||||
|
return this->try_running && this->movement_input.y > 0.f;
|
||||||
|
}
|
37
modules/wave_survival/player_body.h
Normal file
37
modules/wave_survival/player_body.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#ifndef PLAYER_BODY_H
|
||||||
|
#define PLAYER_BODY_H
|
||||||
|
|
||||||
|
#include "scene/3d/physics/character_body_3d.h"
|
||||||
|
|
||||||
|
class PlayerBody : public CharacterBody3D {
|
||||||
|
GDCLASS(PlayerBody, CharacterBody3D);
|
||||||
|
static void _bind_methods();
|
||||||
|
static PlayerBody *singleton_instance;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void ready();
|
||||||
|
void process(double delta);
|
||||||
|
void physics_process(double delta);
|
||||||
|
|
||||||
|
void set_movement_input(Vector2 state);
|
||||||
|
void on_look_input(Vector2 look);
|
||||||
|
void on_jump_input();
|
||||||
|
void on_run_input(bool run);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void _notification(int what);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static PlayerBody *get_singleton();
|
||||||
|
bool get_is_running() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool try_running{ false };
|
||||||
|
float walk_speed{ 7.f };
|
||||||
|
float run_speed{ 10.f };
|
||||||
|
float acceleration{ 40.f };
|
||||||
|
float jump_strength{ 3.5f };
|
||||||
|
Vector2 movement_input{};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !PLAYER_BODY_H
|
38
modules/wave_survival/player_camera.cpp
Normal file
38
modules/wave_survival/player_camera.cpp
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#include "player_camera.h"
|
||||||
|
#include "macros.h"
|
||||||
|
#include "player_input.h"
|
||||||
|
|
||||||
|
void PlayerCamera::_bind_methods() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerCamera::on_look_input(Vector2 input) {
|
||||||
|
GETSET(rotation, {
|
||||||
|
rotation.x = CLAMP(rotation.x + input.y, -Math::PI / 2.0, Math::PI / 2.0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerCamera::update_fov() {
|
||||||
|
if (!Engine::get_singleton()->is_editor_hint() && is_ready()) {
|
||||||
|
set_fov(this->base_fov * this->fov_factor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerCamera::_notification(int what) {
|
||||||
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (what == NOTIFICATION_READY) {
|
||||||
|
PlayerInput *input{ cast_to<PlayerInput>(get_node(NodePath("%PlayerInput"))) };
|
||||||
|
input->connect(PlayerInput::sig_look_input, callable_mp(this, &self_type::on_look_input));
|
||||||
|
this->base_fov = get_fov();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerCamera::set_fov_factor(float value) {
|
||||||
|
this->fov_factor = value;
|
||||||
|
update_fov();
|
||||||
|
}
|
||||||
|
|
||||||
|
float PlayerCamera::get_fov_factor() const {
|
||||||
|
return this->fov_factor;
|
||||||
|
}
|
24
modules/wave_survival/player_camera.h
Normal file
24
modules/wave_survival/player_camera.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#ifndef PLAYER_CAMERA_H
|
||||||
|
#define PLAYER_CAMERA_H
|
||||||
|
|
||||||
|
#include "scene/3d/camera_3d.h"
|
||||||
|
|
||||||
|
class PlayerCamera : public Camera3D {
|
||||||
|
GDCLASS(PlayerCamera, Camera3D);
|
||||||
|
static void _bind_methods();
|
||||||
|
void on_look_input(Vector2 input);
|
||||||
|
void update_fov();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void _notification(int what);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void set_fov_factor(float value);
|
||||||
|
float get_fov_factor() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
float base_fov{ 60.f };
|
||||||
|
float fov_factor{ 1.0f };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !PLAYER_CAMERA_H
|
60
modules/wave_survival/player_input.cpp
Normal file
60
modules/wave_survival/player_input.cpp
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
#include "player_input.h"
|
||||||
|
|
||||||
|
String PlayerInput::sig_movement_input{ "movement_input" };
|
||||||
|
String PlayerInput::sig_look_input{ "look_input" };
|
||||||
|
String PlayerInput::sig_primary_fire{ "primary_fire" };
|
||||||
|
String PlayerInput::sig_alt_mode{ "alt_mode" };
|
||||||
|
String PlayerInput::sig_run{ "run" };
|
||||||
|
String PlayerInput::sig_jump{ "jump" };
|
||||||
|
String PlayerInput::sig_crouch{ "crouch" };
|
||||||
|
|
||||||
|
void PlayerInput::_bind_methods() {
|
||||||
|
ADD_SIGNAL(MethodInfo(sig_movement_input, PropertyInfo(Variant::VECTOR2, "axes")));
|
||||||
|
ADD_SIGNAL(MethodInfo(sig_look_input, PropertyInfo(Variant::VECTOR2, "axes")));
|
||||||
|
ADD_SIGNAL(MethodInfo(sig_primary_fire, PropertyInfo(Variant::BOOL, "is_pressed")));
|
||||||
|
ADD_SIGNAL(MethodInfo(sig_alt_mode, PropertyInfo(Variant::BOOL, "is_active")));
|
||||||
|
ADD_SIGNAL(MethodInfo(sig_run, PropertyInfo(Variant::BOOL, "is_running")));
|
||||||
|
ADD_SIGNAL(MethodInfo(sig_jump));
|
||||||
|
ADD_SIGNAL(MethodInfo(sig_crouch, PropertyInfo(Variant::BOOL, "is_crouching")));
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerInput::_notification(int what) {
|
||||||
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (what == NOTIFICATION_READY) {
|
||||||
|
set_process_unhandled_input(true);
|
||||||
|
Input::get_singleton()->set_mouse_mode(Input::MouseMode::MOUSE_MODE_CAPTURED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerInput::unhandled_input(Ref<InputEvent> const &event) {
|
||||||
|
Input *input{ Input::get_singleton() };
|
||||||
|
if (event->is_action("move_left") || event->is_action("move_right") || event->is_action("move_forward") || event->is_action("move_back")) {
|
||||||
|
Vector2 state{
|
||||||
|
input->get_axis("move_right", "move_left"),
|
||||||
|
input->get_axis("move_back", "move_forward")
|
||||||
|
};
|
||||||
|
emit_signal(sig_movement_input, state);
|
||||||
|
}
|
||||||
|
Ref<InputEventMouseMotion> mouse_motion{ event };
|
||||||
|
if (mouse_motion.is_valid()) {
|
||||||
|
Vector2 state{ -mouse_motion->get_relative() * 0.001f };
|
||||||
|
emit_signal(sig_look_input, state);
|
||||||
|
}
|
||||||
|
if (event->is_action("primary_fire")) {
|
||||||
|
bool state{ event->is_pressed() };
|
||||||
|
emit_signal(sig_primary_fire, state);
|
||||||
|
}
|
||||||
|
if (event->is_action("alt_mode")) {
|
||||||
|
bool state{ event->is_pressed() };
|
||||||
|
emit_signal(sig_alt_mode, state);
|
||||||
|
}
|
||||||
|
if (event->is_action("run")) {
|
||||||
|
bool state{ event->is_pressed() };
|
||||||
|
emit_signal(sig_run, state);
|
||||||
|
}
|
||||||
|
if (event->is_pressed() && event->is_action("jump") && input->is_action_just_pressed("jump")) {
|
||||||
|
emit_signal(sig_jump);
|
||||||
|
}
|
||||||
|
}
|
22
modules/wave_survival/player_input.h
Normal file
22
modules/wave_survival/player_input.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef PLAYER_INPUT_H
|
||||||
|
#define PLAYER_INPUT_H
|
||||||
|
|
||||||
|
#include "scene/main/node.h"
|
||||||
|
|
||||||
|
class PlayerInput : public Node {
|
||||||
|
GDCLASS(PlayerInput, Node);
|
||||||
|
static void _bind_methods();
|
||||||
|
void _notification(int what);
|
||||||
|
virtual void unhandled_input(Ref<InputEvent> const &event) override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static String sig_movement_input;
|
||||||
|
static String sig_look_input;
|
||||||
|
static String sig_primary_fire;
|
||||||
|
static String sig_alt_mode;
|
||||||
|
static String sig_run;
|
||||||
|
static String sig_jump;
|
||||||
|
static String sig_crouch;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !PLAYER_INPUT_H
|
25
modules/wave_survival/register_types.cpp
Normal file
25
modules/wave_survival/register_types.cpp
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#include "register_types.h"
|
||||||
|
|
||||||
|
#include "core/object/class_db.h"
|
||||||
|
#include "wave_survival/player_body.h"
|
||||||
|
#include "wave_survival/player_camera.h"
|
||||||
|
#include "wave_survival/player_input.h"
|
||||||
|
#include "wave_survival/weapon_base.h"
|
||||||
|
#include "wave_survival/weapons/rifle.h"
|
||||||
|
|
||||||
|
void initialize_wave_survival_module(ModuleInitializationLevel p_level) {
|
||||||
|
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GDREGISTER_CLASS(PlayerBody);
|
||||||
|
GDREGISTER_CLASS(PlayerInput);
|
||||||
|
GDREGISTER_CLASS(PlayerCamera);
|
||||||
|
GDREGISTER_RUNTIME_CLASS(WeaponBase);
|
||||||
|
GDREGISTER_CLASS(Rifle);
|
||||||
|
}
|
||||||
|
|
||||||
|
void uninitialize_wave_survival_module(ModuleInitializationLevel p_level) {
|
||||||
|
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
9
modules/wave_survival/register_types.h
Normal file
9
modules/wave_survival/register_types.h
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#ifndef wave_survival_REGISTER_TYPES_H
|
||||||
|
#define wave_survival_REGISTER_TYPES_H
|
||||||
|
|
||||||
|
#include "modules/register_module_types.h"
|
||||||
|
|
||||||
|
void initialize_wave_survival_module(ModuleInitializationLevel p_level);
|
||||||
|
void uninitialize_wave_survival_module(ModuleInitializationLevel p_level);
|
||||||
|
|
||||||
|
#endif // !wave_survival_REGISTER_TYPES_H
|
39
modules/wave_survival/weapon_base.cpp
Normal file
39
modules/wave_survival/weapon_base.cpp
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#include "weapon_base.h"
|
||||||
|
#include "macros.h"
|
||||||
|
#include "player_camera.h"
|
||||||
|
#include "scene/animation/animation_player.h"
|
||||||
|
|
||||||
|
void WeaponBase::_bind_methods() {
|
||||||
|
BIND_HPROPERTY(Variant::OBJECT, anim, PROPERTY_HINT_NODE_TYPE, AnimationPlayer::get_class_static());
|
||||||
|
}
|
||||||
|
|
||||||
|
void WeaponBase::ready() {
|
||||||
|
this->camera = cast_to<PlayerCamera>(get_node(NodePath("%PlayerCamera")));
|
||||||
|
if (this->anim) {
|
||||||
|
this->anim->play("RESET");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WeaponBase::_notification(int what) {
|
||||||
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (what) {
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
case NOTIFICATION_READY:
|
||||||
|
ready();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WeaponBase::set_anim(AnimationPlayer *anim) {
|
||||||
|
this->anim = anim;
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimationPlayer *WeaponBase::get_anim() const {
|
||||||
|
return this->anim;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerCamera *WeaponBase::get_camera() const {
|
||||||
|
return this->camera;
|
||||||
|
}
|
27
modules/wave_survival/weapon_base.h
Normal file
27
modules/wave_survival/weapon_base.h
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#ifndef WEAPON_BASE_H
|
||||||
|
#define WEAPON_BASE_H
|
||||||
|
|
||||||
|
#include "scene/3d/node_3d.h"
|
||||||
|
class AnimationPlayer;
|
||||||
|
class PlayerCamera;
|
||||||
|
|
||||||
|
class WeaponBase : public Node3D {
|
||||||
|
GDCLASS(WeaponBase, Node3D);
|
||||||
|
static void _bind_methods();
|
||||||
|
void ready();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void _notification(int what);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void set_anim(AnimationPlayer *player);
|
||||||
|
AnimationPlayer *get_anim() const;
|
||||||
|
|
||||||
|
PlayerCamera *get_camera() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
AnimationPlayer *anim{ nullptr };
|
||||||
|
PlayerCamera *camera{ nullptr };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !WEAPON_BASE_H
|
76
modules/wave_survival/weapons/rifle.cpp
Normal file
76
modules/wave_survival/weapons/rifle.cpp
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
#include "rifle.h"
|
||||||
|
#include "scene/animation/animation_player.h"
|
||||||
|
#include "wave_survival/player_body.h"
|
||||||
|
#include "wave_survival/player_input.h"
|
||||||
|
|
||||||
|
void Rifle::_bind_methods() {}
|
||||||
|
|
||||||
|
void Rifle::on_primary_fire(bool pressed) {
|
||||||
|
if (pressed && get_anim()->get_queue().size() == 0) {
|
||||||
|
if (this->request_alt_mode) {
|
||||||
|
get_anim()->queue("fire_aim");
|
||||||
|
} else if (get_anim()->get_current_animation() == "") {
|
||||||
|
get_anim()->queue("fire_hip");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Rifle::on_alt_mode(bool alt_mode) {
|
||||||
|
this->request_alt_mode = alt_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Rifle::on_animation_changed(String new_animation) {
|
||||||
|
if (new_animation == "aim") {
|
||||||
|
this->in_alt_mode = true;
|
||||||
|
get_camera()->set_fov_factor(this->ads_factor);
|
||||||
|
} else if (new_animation == "RESET") {
|
||||||
|
this->in_alt_mode = false;
|
||||||
|
get_camera()->set_fov_factor(1.f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Rifle::ready() {
|
||||||
|
get_anim()->connect("current_animation_changed", callable_mp(this, &self_type::on_animation_changed));
|
||||||
|
PlayerInput *input{ cast_to<PlayerInput>(get_node(NodePath("%PlayerInput"))) };
|
||||||
|
input->connect(PlayerInput::sig_primary_fire, callable_mp(this, &self_type::on_primary_fire));
|
||||||
|
input->connect(PlayerInput::sig_alt_mode, callable_mp(this, &self_type::on_alt_mode));
|
||||||
|
|
||||||
|
get_anim()->animation_set_next("hip_to_aim", "aim");
|
||||||
|
get_anim()->animation_set_next("fire_aim", "aim");
|
||||||
|
get_anim()->animation_set_next("aim_to_hip", "RESET");
|
||||||
|
get_anim()->animation_set_next("fire_hip", "RESET");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Rifle::process(double delta) {
|
||||||
|
String const current{ get_anim()->get_current_animation() };
|
||||||
|
float const progress{ float(CLAMP(get_anim()->get_current_animation_position() / get_anim()->get_current_animation_length(), 0.0, 1.0)) };
|
||||||
|
if (current == "hip_to_aim") {
|
||||||
|
get_camera()->set_fov_factor(Math::lerp(1.f, this->ads_factor, progress));
|
||||||
|
} else if (current == "aim_to_hip") {
|
||||||
|
get_camera()->set_fov_factor(Math::lerp(this->ads_factor, 1.f, progress));
|
||||||
|
} else if (this->request_alt_mode != this->in_alt_mode && current.is_empty()) {
|
||||||
|
get_anim()->clear_queue();
|
||||||
|
if (this->request_alt_mode) {
|
||||||
|
get_anim()->queue("hip_to_aim");
|
||||||
|
} else {
|
||||||
|
get_anim()->queue("aim_to_hip");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Rifle::_notification(int what) {
|
||||||
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (what) {
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
case NOTIFICATION_READY:
|
||||||
|
set_process(true);
|
||||||
|
ready();
|
||||||
|
return;
|
||||||
|
case NOTIFICATION_PROCESS:
|
||||||
|
process(get_process_delta_time());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
26
modules/wave_survival/weapons/rifle.h
Normal file
26
modules/wave_survival/weapons/rifle.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef WEAPONS_RIFLE_H
|
||||||
|
#define WEAPONS_RIFLE_H
|
||||||
|
|
||||||
|
#include "wave_survival/player_camera.h"
|
||||||
|
#include "wave_survival/weapon_base.h"
|
||||||
|
class PlayerBody;
|
||||||
|
|
||||||
|
class Rifle : public WeaponBase {
|
||||||
|
GDCLASS(Rifle, WeaponBase);
|
||||||
|
static void _bind_methods();
|
||||||
|
void on_primary_fire(bool down);
|
||||||
|
void on_alt_mode(bool alt_mode);
|
||||||
|
void on_animation_changed(String new_anim);
|
||||||
|
void ready();
|
||||||
|
void process(double delta);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void _notification(int what);
|
||||||
|
|
||||||
|
private:
|
||||||
|
float ads_factor{ 0.5f };
|
||||||
|
bool request_alt_mode{ false };
|
||||||
|
bool in_alt_mode{ false };
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !WEAPONS_RIFLE_H
|
10
project/assets/materials/greenish_grid.tres
Normal file
10
project/assets/materials/greenish_grid.tres
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://b075rlo1f0e4u"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://d3kycq4061wf7" path="res://assets/textures/greenish_grid.png" id="1_5nv8k"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
shading_mode = 2
|
||||||
|
diffuse_mode = 1
|
||||||
|
albedo_texture = ExtResource("1_5nv8k")
|
||||||
|
uv1_triplanar = true
|
||||||
|
uv2_triplanar = true
|
10
project/assets/materials/weapons/arms.tres
Normal file
10
project/assets/materials/weapons/arms.tres
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[gd_resource type="StandardMaterial3D" format=3 uid="uid://dgl8ygpyta7b0"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
resource_name = "arms"
|
||||||
|
albedo_color = Color(0.9063318, 0.9063318, 0.9063318, 1)
|
||||||
|
roughness = 0.5
|
||||||
|
use_z_clip_scale = true
|
||||||
|
z_clip_scale = 0.2
|
||||||
|
fov_override = 50.0
|
||||||
|
stencil_flags = 2
|
13
project/assets/materials/weapons/rifle.tres
Normal file
13
project/assets/materials/weapons/rifle.tres
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://56reb3m4e6fd"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://48j7riad4n6g" path="res://assets/models/weapons/rifle_lee_enfield.jpg" id="1_eg0kj"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
resource_name = "rifle"
|
||||||
|
cull_mode = 2
|
||||||
|
albedo_texture = ExtResource("1_eg0kj")
|
||||||
|
metallic = 0.29381442
|
||||||
|
roughness = 0.6443299
|
||||||
|
use_z_clip_scale = true
|
||||||
|
z_clip_scale = 0.2
|
||||||
|
fov_override = 50.0
|
BIN
project/assets/models/base_character.blend
Normal file
BIN
project/assets/models/base_character.blend
Normal file
Binary file not shown.
53
project/assets/models/base_character.blend.import
Normal file
53
project/assets/models/base_character.blend.import
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="scene"
|
||||||
|
importer_version=1
|
||||||
|
type="PackedScene"
|
||||||
|
uid="uid://7esw31b76x4"
|
||||||
|
path="res://.godot/imported/base_character.blend-06aab94c060939a7a7c95d6d213df49c.scn"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/models/base_character.blend"
|
||||||
|
dest_files=["res://.godot/imported/base_character.blend-06aab94c060939a7a7c95d6d213df49c.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
|
BIN
project/assets/models/base_character.blend1
Normal file
BIN
project/assets/models/base_character.blend1
Normal file
Binary file not shown.
BIN
project/assets/models/first_person_arms.blend
Normal file
BIN
project/assets/models/first_person_arms.blend
Normal file
Binary file not shown.
53
project/assets/models/first_person_arms.blend.import
Normal file
53
project/assets/models/first_person_arms.blend.import
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="scene"
|
||||||
|
importer_version=1
|
||||||
|
type="PackedScene"
|
||||||
|
uid="uid://bttc6o1afvamo"
|
||||||
|
path="res://.godot/imported/first_person_arms.blend-797129ee4081809c7ab7dac9d6b02afa.scn"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/models/first_person_arms.blend"
|
||||||
|
dest_files=["res://.godot/imported/first_person_arms.blend-797129ee4081809c7ab7dac9d6b02afa.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
|
BIN
project/assets/models/first_person_arms.blend1
Normal file
BIN
project/assets/models/first_person_arms.blend1
Normal file
Binary file not shown.
BIN
project/assets/models/first_person_arms_lee_enfield.jpg
Normal file
BIN
project/assets/models/first_person_arms_lee_enfield.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
|
@ -0,0 +1,38 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dngnx7oramvng"
|
||||||
|
path.s3tc="res://.godot/imported/first_person_arms_lee_enfield.jpg-6485b85441fdbd748e2484657f4d78a2.s3tc.ctex"
|
||||||
|
metadata={
|
||||||
|
"imported_formats": ["s3tc_bptc"],
|
||||||
|
"vram_texture": true
|
||||||
|
}
|
||||||
|
generator_parameters={
|
||||||
|
"md5": "2f63e7aacd33f2b1b77cb71dd6821df5"
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/models/first_person_arms_lee_enfield.jpg"
|
||||||
|
dest_files=["res://.godot/imported/first_person_arms_lee_enfield.jpg-6485b85441fdbd748e2484657f4d78a2.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
|
BIN
project/assets/models/weapons/rifle.blend1
Normal file
BIN
project/assets/models/weapons/rifle.blend1
Normal file
Binary file not shown.
BIN
project/assets/models/weapons/rifle.glb
Normal file
BIN
project/assets/models/weapons/rifle.glb
Normal file
Binary file not shown.
55
project/assets/models/weapons/rifle.glb.import
Normal file
55
project/assets/models/weapons/rifle.glb.import
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="scene"
|
||||||
|
importer_version=1
|
||||||
|
type="PackedScene"
|
||||||
|
uid="uid://c8jbxkm1paa8u"
|
||||||
|
path="res://.godot/imported/rifle.glb-7e791117157b5204625fa46cea3758ea.scn"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/models/weapons/rifle.glb"
|
||||||
|
dest_files=["res://.godot/imported/rifle.glb-7e791117157b5204625fa46cea3758ea.scn"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
nodes/root_type=""
|
||||||
|
nodes/root_name=""
|
||||||
|
nodes/root_script=null
|
||||||
|
nodes/apply_root_scale=true
|
||||||
|
nodes/root_scale=1.0
|
||||||
|
nodes/import_as_skeleton_bones=false
|
||||||
|
nodes/use_name_suffixes=true
|
||||||
|
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=""
|
||||||
|
materials/extract=0
|
||||||
|
materials/extract_format=0
|
||||||
|
materials/extract_path=""
|
||||||
|
_subresources={
|
||||||
|
"materials": {
|
||||||
|
"arms": {
|
||||||
|
"use_external/enabled": true,
|
||||||
|
"use_external/fallback_path": "res://assets/materials/weapons/arms.tres",
|
||||||
|
"use_external/path": "uid://dgl8ygpyta7b0"
|
||||||
|
},
|
||||||
|
"rifle": {
|
||||||
|
"use_external/enabled": true,
|
||||||
|
"use_external/fallback_path": "res://assets/materials/weapons/rifle.tres",
|
||||||
|
"use_external/path": "uid://56reb3m4e6fd"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gltf/naming_version=1
|
||||||
|
gltf/embedded_image_handling=1
|
BIN
project/assets/models/weapons/rifle_lee_enfield.jpg
Normal file
BIN
project/assets/models/weapons/rifle_lee_enfield.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
44
project/assets/models/weapons/rifle_lee_enfield.jpg.import
Normal file
44
project/assets/models/weapons/rifle_lee_enfield.jpg.import
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://48j7riad4n6g"
|
||||||
|
path.s3tc="res://.godot/imported/rifle_lee_enfield.jpg-3d7c7612e94a4e73effbe000ea16a19a.s3tc.ctex"
|
||||||
|
metadata={
|
||||||
|
"imported_formats": ["s3tc_bptc"],
|
||||||
|
"vram_texture": true
|
||||||
|
}
|
||||||
|
generator_parameters={
|
||||||
|
"md5": "089dd972f5e3dfeee508b839c59d2347"
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/models/weapons/rifle_lee_enfield.jpg"
|
||||||
|
dest_files=["res://.godot/imported/rifle_lee_enfield.jpg-3d7c7612e94a4e73effbe000ea16a19a.s3tc.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=2
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
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/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
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
|
BIN
project/assets/textures/greenish_grid.png
Normal file
BIN
project/assets/textures/greenish_grid.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
35
project/assets/textures/greenish_grid.png.import
Normal file
35
project/assets/textures/greenish_grid.png.import
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://d3kycq4061wf7"
|
||||||
|
path.s3tc="res://.godot/imported/greenish_grid.png-db458c39506fa25a40715cb6cda28623.s3tc.ctex"
|
||||||
|
metadata={
|
||||||
|
"imported_formats": ["s3tc_bptc"],
|
||||||
|
"vram_texture": true
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/textures/greenish_grid.png"
|
||||||
|
dest_files=["res://.godot/imported/greenish_grid.png-db458c39506fa25a40715cb6cda28623.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
|
|
@ -9,7 +9,7 @@ custom_features=""
|
||||||
export_filter="all_resources"
|
export_filter="all_resources"
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="../build/PROJECT.x86_64"
|
export_path="../build/wave_survival.x86_64"
|
||||||
patches=PackedStringArray()
|
patches=PackedStringArray()
|
||||||
encryption_include_filters=""
|
encryption_include_filters=""
|
||||||
encryption_exclude_filters=""
|
encryption_exclude_filters=""
|
||||||
|
@ -51,7 +51,7 @@ custom_features=""
|
||||||
export_filter="all_resources"
|
export_filter="all_resources"
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="../build/PROJECT.exe"
|
export_path="../build/wave_survival.exe"
|
||||||
patches=PackedStringArray()
|
patches=PackedStringArray()
|
||||||
encryption_include_filters=""
|
encryption_include_filters=""
|
||||||
encryption_exclude_filters=""
|
encryption_exclude_filters=""
|
||||||
|
|
207
project/maps/testmap.tscn
Normal file
207
project/maps/testmap.tscn
Normal file
|
@ -0,0 +1,207 @@
|
||||||
|
[gd_scene load_steps=6 format=3 uid="uid://dukbdx7dt2qut"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://snjgu4yp5swd" path="res://objects/player.tscn" id="1_6t4yh"]
|
||||||
|
[ext_resource type="Material" uid="uid://b075rlo1f0e4u" path="res://assets/materials/greenish_grid.tres" id="1_ng1ul"]
|
||||||
|
|
||||||
|
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_ng1ul"]
|
||||||
|
sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
|
||||||
|
ground_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
|
||||||
|
|
||||||
|
[sub_resource type="Sky" id="Sky_7ng1a"]
|
||||||
|
sky_material = SubResource("ProceduralSkyMaterial_ng1ul")
|
||||||
|
|
||||||
|
[sub_resource type="Environment" id="Environment_d7x8f"]
|
||||||
|
background_mode = 2
|
||||||
|
sky = SubResource("Sky_7ng1a")
|
||||||
|
tonemap_mode = 2
|
||||||
|
ssao_enabled = true
|
||||||
|
glow_enabled = true
|
||||||
|
|
||||||
|
[node name="Testmap" type="Node3D"]
|
||||||
|
|
||||||
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||||
|
environment = SubResource("Environment_d7x8f")
|
||||||
|
|
||||||
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||||
|
transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0)
|
||||||
|
shadow_enabled = true
|
||||||
|
|
||||||
|
[node name="CSGBox3D" type="CSGBox3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.501484, 0)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(50, 1, 50)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="PlayerBody" parent="." instance=ExtResource("1_6t4yh")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0500376, 2.38419e-07, -0.0317376)
|
||||||
|
slide_on_ceiling = false
|
||||||
|
|
||||||
|
[node name="CSGCombiner3D" type="CSGCombiner3D" parent="."]
|
||||||
|
use_collision = true
|
||||||
|
|
||||||
|
[node name="CSGBox3D2" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.948, 3.13319, -1.86438)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(10.441, 7.09393, 25.165)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D3" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.9688, 1.13, 6.77715)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(9.8421, 3.074, 7.48355)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D5" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.9688, 1.13, -1.92168)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(9.8421, 3.074, 9.25056)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D6" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.9688, 1.13, -10.4467)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(9.8421, 3.074, 7.48355)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D10" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.9688, 4.73767, 6.77715)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(9.8421, 3.074, 7.48355)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D11" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.9688, 4.73767, -1.92168)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(9.8421, 3.074, 9.25056)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D12" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.9688, 4.73767, -10.4467)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(9.8421, 3.074, 7.48355)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D4" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.01349, 0.843177, 5.73304)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(2.16355, 2.81146, 1.43037)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D19" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -12.7667, 3.00782, 8.93745)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(4.11031, 1.01367, 3.05259)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D13" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.03735, 5.15978, 8.92892)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(1.64708, 1.47165, 1.75998)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D14" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.03735, 5.15978, 5.36833)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(1.64708, 1.47165, 3.01134)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D17" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.03735, 5.15978, -4.15471)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(1.64708, 1.47165, 1.75998)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D20" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.03735, 1.63843, -12.371)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(1.64708, 1.47165, 1.75998)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D21" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.03735, 1.63843, -3.73614)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(1.64708, 1.47165, 1.75998)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D23" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.03735, 1.63843, 0.557484)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(1.64708, 1.47165, 1.75998)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D22" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.03735, 1.63843, 8.83479)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(1.64708, 1.47165, 1.75998)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D18" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.03735, 5.15978, -8.38057)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(1.64708, 1.47165, 1.75998)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D15" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.03735, 5.15978, -0.349048)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(1.64708, 1.47165, 3.46446)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D16" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.03735, 5.15978, -11.8593)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(1.64708, 1.47165, 3.46446)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D7" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.70662, 0.843177, -9.61435)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(1.20117, 2.81146, 1.43037)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D8" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -14.1813, 0.843177, -6.9353)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(1.71875, 2.81146, 1.43037)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D9" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -8.47255, 1.11953, 3.07464)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(1.43066, 2.25876, 1.43037)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D24" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -8.47255, 4.34085, 3.07464)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(1.43066, 2.25876, 1.43037)
|
||||||
|
material = ExtResource("1_ng1ul")
|
||||||
|
|
||||||
|
[node name="CSGBox3D25" type="CSGBox3D" parent="CSGCombiner3D"]
|
||||||
|
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -14.0385, 4.34085, -6.63972)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(1.43066, 2.25876, 1.43037)
|
||||||
|
material = ExtResource("1_ng1ul")
|
24
project/objects/player.tscn
Normal file
24
project/objects/player.tscn
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://snjgu4yp5swd"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://ce40pq785yoyi" path="res://objects/weapons/rifle.tscn" id="1_eqqp1"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_bxedw"]
|
||||||
|
|
||||||
|
[node name="PlayerBody" type="PlayerBody"]
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||||
|
shape = SubResource("CapsuleShape3D_bxedw")
|
||||||
|
|
||||||
|
[node name="PlayerInput" type="PlayerInput" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
|
||||||
|
[node name="PlayerCamera" type="PlayerCamera" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1.60811, 0)
|
||||||
|
fov = 60.0
|
||||||
|
|
||||||
|
[node name="Rifle" parent="PlayerCamera" instance=ExtResource("1_eqqp1")]
|
||||||
|
|
||||||
|
[editable path="PlayerCamera/Rifle"]
|
||||||
|
[editable path="PlayerCamera/Rifle/rifle"]
|
13
project/objects/weapons/rifle.tscn
Normal file
13
project/objects/weapons/rifle.tscn
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://ce40pq785yoyi"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c8jbxkm1paa8u" path="res://assets/models/weapons/rifle.glb" id="1_afgyw"]
|
||||||
|
|
||||||
|
[node name="Rifle" type="Rifle" node_paths=PackedStringArray("anim")]
|
||||||
|
anim = NodePath("rifle/AnimationPlayer")
|
||||||
|
|
||||||
|
[node name="rifle" parent="." instance=ExtResource("1_afgyw")]
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" parent="rifle" index="1"]
|
||||||
|
playback_default_blend_time = 0.1
|
||||||
|
|
||||||
|
[editable path="rifle"]
|
|
@ -10,6 +10,55 @@ config_version=5
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="PROJECT"
|
config/name="wave_survival"
|
||||||
config/features=PackedStringArray("4.4", "Forward Plus")
|
run/main_scene="uid://dukbdx7dt2qut"
|
||||||
|
config/features=PackedStringArray("4.5", "Forward Plus")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[input]
|
||||||
|
|
||||||
|
move_forward={
|
||||||
|
"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":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
move_back={
|
||||||
|
"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":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
move_left={
|
||||||
|
"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":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
move_right={
|
||||||
|
"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":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
primary_fire={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(119, 17),"global_position":Vector2(119, 46),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
alt_mode={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(124, 14),"global_position":Vector2(124, 43),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
crouch={
|
||||||
|
"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":4194326,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
run={
|
||||||
|
"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)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
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":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue