further stuff made to the thing. Also wave is being fucky

This commit is contained in:
CatAClock 2025-06-14 17:11:10 -07:00
parent 28cb5928c1
commit 2c473ad95e
6 changed files with 30 additions and 27 deletions

View file

@ -1,10 +1,9 @@
[gd_scene load_steps=11 format=3 uid="uid://bjbccem28ir8r"]
[gd_scene load_steps=10 format=3 uid="uid://bjbccem28ir8r"]
[ext_resource type="Texture2D" uid="uid://bcbjh2amre7ke" path="res://non-godot/Textures/Plane/PlaneUp.png" id="1_2h3i0"]
[ext_resource type="PackedScene" uid="uid://do4a4d3u60iy1" path="res://godot/Scenes/Bullets/bullet.tscn" id="1_edjcf"]
[ext_resource type="Texture2D" uid="uid://c5kt81t5h4vgn" path="res://non-godot/Textures/Plane/Plane.png" id="3_5g2vf"]
[ext_resource type="Texture2D" uid="uid://bff4pkabs2ecf" path="res://non-godot/Textures/Plane/PlaneDown.png" id="3_edjcf"]
[ext_resource type="AudioStream" uid="uid://do4a5aj5a0216" path="res://non-godot/Sound/Shoot.ogg" id="4_m3gyy"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_xtmdc"]
particle_flag_disable_z = true
@ -149,6 +148,7 @@ _data = {
}
[node name="Player" type="Player" groups=["Player"]]
ShotBulletLocation = Vector2(100, 100)
ShotBullet = ExtResource("1_edjcf")
PlayerUp = ExtResource("1_2h3i0")
PlayerNeutral = ExtResource("3_5g2vf")
@ -162,17 +162,6 @@ InputSpeedUp = &"SpeedUp"
scale = Vector2(0.15, 0.15)
motion_mode = 1
[node name="Gun" type="Node2D" parent="."]
position = Vector2(1, 1)
[node name="Marker2D" type="Marker2D" parent="Gun"]
position = Vector2(545.6666, 259)
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="Gun"]
stream = ExtResource("4_m3gyy")
volume_db = -20.0
max_polyphony = 2
[node name="GPUParticles2D2" type="GPUParticles2D" parent="."]
z_index = -1
position = Vector2(-544, -153.33333)

View file

@ -43,9 +43,12 @@ namespace godot {
ClassDB::bind_method(D_METHOD("GetFireRate"), &Player::GetFireRate);
ClassDB::bind_method(D_METHOD("SetFireRate", "FireRate"), &Player::SetFireRate);
ClassDB::add_property("Player", PropertyInfo(Variant::FLOAT, "ShotFireRate"), "SetFireRate", "GetFireRate");
ClassDB::bind_method(D_METHOD("GetBullet"), &Player::GetBullet);
ClassDB::bind_method(D_METHOD("SetBullet", "Bullet"), &Player::SetBullet);
ClassDB::add_property("Player", PropertyInfo(Variant::OBJECT, "ShotBullet"), "SetBullet", "GetBullet");
ClassDB::bind_method(D_METHOD("GetBulletLocation"), &Player::GetBulletLocation);
ClassDB::bind_method(D_METHOD("SetBulletLocation", "BulletLocation"), &Player::SetBulletLocation);
ClassDB::add_property("Player", PropertyInfo(Variant::VECTOR2, "ShotBulletLocation"), "SetBulletLocation", "GetBulletLocation");
ClassDB::bind_method(D_METHOD("GetBulletTexture"), &Player::GetBulletTexture);
ClassDB::bind_method(D_METHOD("SetBulletTexture", "BulletTexture"), &Player::SetBulletTexture);
ClassDB::add_property("Player", PropertyInfo(Variant::OBJECT, "ShotBulletTexture"), "SetBulletTexture", "GetBulletTexture");
// Textures
ClassDB::bind_method(D_METHOD("GetPlayerUp"), &Player::GetPlayerUp);
@ -119,7 +122,8 @@ namespace godot {
// Shooting.
if (Input::get_singleton()->get_action_raw_strength(Shoot) != 0) {
Node* bullet = Bullet->instantiate();
Bullet* bullet = memnew(Bullet);
bullet->set_position(BulletLocation + get_position());
get_parent()->add_child(bullet);
FireRateTimer = 0;
}
@ -146,8 +150,11 @@ namespace godot {
float Player::GetFireRate() const {
return FireRate;
}
Ref<PackedScene> Player::GetBullet() const {
return Bullet;
Vector2 Player::GetBulletLocation() const {
return BulletLocation;
}
Ref<CompressedTexture2D> Player::GetBulletTexture() const {
return BulletTexture;
}
Ref<CompressedTexture2D> Player::GetPlayerUp() const {
return PlayerUp;
@ -189,8 +196,11 @@ namespace godot {
void Player::SetFireRate(const float fireRate) {
FireRate = fireRate;
}
void Player::SetBullet(const Ref<PackedScene>& bullet) {
Bullet = bullet;
void Player::SetBulletLocation(const Vector2 bulletLocation) {
BulletLocation = bulletLocation;
}
void Player::SetBulletTexture(const Ref<CompressedTexture2D>& bulletTexture) {
BulletTexture = bulletTexture;
}
void Player::SetPlayerUp(const Ref<CompressedTexture2D>& playerUp) {
PlayerUp = playerUp;

View file

@ -8,7 +8,8 @@
#include <godot_cpp/classes/rectangle_shape2d.hpp>
#include <godot_cpp/classes/compressed_texture2d.hpp>
#include <godot_cpp/classes/sprite2d.hpp>
#include <godot_cpp/classes/packed_scene.hpp>
#include "Bullet.hpp"
namespace godot {
class Player : public CharacterBody2D {
@ -24,7 +25,8 @@ namespace godot {
bool PlayerControl = true;
// Killing
Ref<PackedScene> Bullet;
Ref<CompressedTexture2D> BulletTexture;
Vector2 BulletLocation = Vector2(0, 0);
double FireRate = 0.04;
double FireRateTimer = 0;
@ -60,7 +62,8 @@ namespace godot {
int GetSpeed() const;
float GetInvulnerabilityTime() const;
float GetFireRate() const;
Ref<PackedScene> GetBullet() const;
Vector2 GetBulletLocation() const;
Ref<CompressedTexture2D> GetBulletTexture() const;
Ref<CompressedTexture2D> GetPlayerUp() const;
Ref<CompressedTexture2D> GetPlayerNeutral() const;
Ref<CompressedTexture2D> GetPlayerDown() const;
@ -75,7 +78,8 @@ namespace godot {
void SetSpeed(const int speed);
void SetInvulnerabilityTime(const float invulnerabilityTime);
void SetFireRate(const float fireRate);
void SetBullet(const Ref<PackedScene>& bullet);
void SetBulletLocation(const Vector2 bulletLocation);
void SetBulletTexture(const Ref<CompressedTexture2D>& bulletTexture);
void SetPlayerUp(const Ref<CompressedTexture2D>& playerUp);
void SetPlayerNeutral(const Ref<CompressedTexture2D>& playerNeutral);
void SetPlayerDown(const Ref<CompressedTexture2D>& playerDown);

View file

@ -18,7 +18,7 @@ void InitializeModule(ModuleInitializationLevel p_level) {
GDREGISTER_CLASS(Player);
GDREGISTER_CLASS(Bullet);
GDREGISTER_CLASS(Wave);
//GDREGISTER_CLASS(Wave);
GDREGISTER_CLASS(Enemy);
}

View file

@ -2,7 +2,7 @@
#include <godot_cpp/godot.hpp>
static const char *_doc_data_hash = "5307739025143130596";
static const char *_doc_data_hash = "8574192405191457953";
static const int _doc_data_uncompressed_size = 0;
static const int _doc_data_compressed_size = 8;
static const unsigned char _doc_data_compressed[] = {