5#include "godot_cpp/classes/camera3d.hpp"
6#include "godot_cpp/classes/packed_scene.hpp"
7#include "utils/player.hpp"
8#include <godot_cpp/classes/input_event.hpp>
9#include <godot_cpp/classes/rigid_body3d.hpp>
10#include <godot_cpp/classes/collision_shape3d.hpp>
24 virtual void _ready()
override;
26 virtual void _process(
double delta_time)
override;
39 virtual Node *
to_node()
override;
42 void on_steer(Ref<InputEvent> event,
float value);
44 void on_brake(Ref<InputEvent> event,
float value);
Subclass Sandbox for car physics. Uses _integrate_forces and local_velocity to abstract the behaviour...
Definition car_physics.hpp:13
Sandboxed subclass of CarPhysics.
Definition car_player.hpp:18
void set_beacon_scene(Ref< PackedScene > scene)
The object representing the beacon pickup.
Definition car_player.cpp:115
float const camera_fullspeed_fov
The FOV of the camera when the car is traveling at max_speed.
Definition car_player.hpp:107
void on_accelerate(Ref< InputEvent > event, float value)
Input callback for the accelerate key.
Definition car_player.cpp:62
void damage()
Take 1 damage.
Definition car_player.cpp:66
float const max_speed
Target speed when accelerate is pressed.
Definition car_player.hpp:97
void on_brake(Ref< InputEvent > event, float value)
Input callback for the brake key.
Definition car_player.cpp:58
Ref< PackedScene > get_turret_scene() const
The object representing the turret pickup.
Definition car_player.cpp:111
int health
Amount of hits the player's car can still take.
Definition car_player.hpp:76
virtual void setup_player_input(PlayerInput *input) override
Initialize player input callbacks.
Definition car_player.cpp:41
float const camera_stopped_fov
FOV of the camera when the car is not moving.
Definition car_player.hpp:109
float const steering_factor
Amount of steering to apply based on input.
Definition car_player.hpp:99
GDCLASS(CarPlayer, CarPhysics)
float const powerup_duration
Duration of a powerup after it is picked up.
Definition car_player.hpp:101
void activate_powerup(Ref< PackedScene > scene)
Destroy all children and activate a new powerup.
Definition car_player.cpp:88
Ref< PackedScene > shield
The ramming shield powerup scene.
Definition car_player.hpp:94
double end_of_powerup
The time at which the current powerup will be deactivated.
Definition car_player.hpp:78
void on_steer(Ref< InputEvent > event, float value)
Input callback for the steering axis.
Definition car_player.cpp:54
float const camera_height
Height the camera should be at relative to the pivot.
Definition car_player.hpp:105
Ref< PackedScene > beacon
The hacking beacon powerup scene.
Definition car_player.hpp:92
void activate_turret()
Destroy all powerups and spawn a turret.
Definition car_player.cpp:96
virtual Node * to_node() override
Convert to node.
Definition car_player.cpp:52
Camera3D * camera
The camera.
Definition car_player.hpp:87
Ref< PackedScene > get_beacon_scene() const
The object representing the beacon pickup.
Definition car_player.cpp:119
void activate_beacon()
Destroy all powerups and spawn a beacon.
Definition car_player.cpp:100
virtual void _process(double delta_time) override
Update powerup and grace period timers. As well as the camera position.
Definition car_player.cpp:25
float grace_timer_end
The time at which the current grace period will end.
Definition car_player.hpp:82
float const camera_distance
Distance from the pivot the camera should be at.
Definition car_player.hpp:103
static void _bind_methods()
Register editor properties and damage function.
Definition car_player.cpp:12
float const grace_time
Amount of time the player should be invincible after being hit.
Definition car_player.hpp:113
void activate_shield()
Destroy all powerups and spawn a shield.
Definition car_player.cpp:101
virtual void spawn_at_position(Transform3D const &transform) override
Place player at initial position Called from the GameRoot3D of the godot-cpp-utils library.
Definition car_player.cpp:47
Ref< PackedScene > turret
The roof turret powerup scene.
Definition car_player.hpp:90
virtual void _ready() override
Get the required child nodes.
Definition car_player.cpp:20
void set_turret_scene(Ref< PackedScene > scene)
The object representing the turret pickup.
Definition car_player.cpp:107
void destroy_all_powerups()
Destroy all children of roof_slot.
Definition car_player.cpp:78
Ref< PackedScene > get_shield_scene() const
The object representing the shield pickup.
Definition car_player.cpp:127
Node3D * roof_slot
The parent of any pickup models.
Definition car_player.hpp:85
void set_shield_scene(Ref< PackedScene > scene)
The object representing the shield pickup.
Definition car_player.cpp:123
float const fov_lerp_delta
Speed in degrees-per-second that the camera FOV can change at.
Definition car_player.hpp:111
bool takes_damage
If false, the car will be invincible.
Definition car_player.hpp:80
float const grace_time_flash
Interval at which the car's model should flash while invincible after being hit.
Definition car_player.hpp:115
Definition beacon_powerup.cpp:6