feat: initialized template and wrote first gameplay code
This commit is contained in:
parent
82f2cae0f6
commit
46a958f801
47 changed files with 1093 additions and 33 deletions
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue