#ifndef BULLET_HPP #define BULLET_HPP #include #include #include #include #include #include namespace godot { class Bullet : public Area2D { GDCLASS(Bullet, Area2D); public: float Speed = 800; // This variable Tracks which way the bullet should go. for example: (-1, 0) will make the bullet go left Vector2 AreaDirection = Vector2(0, 0); // This variable stops a crash bool Debounce = false; Ref PoofAudioClip; Ref HitAudioClip; Ref Texture; Sprite2D* Sprite; CPUParticles2D* PoofParticles; AudioStreamPlayer* PoofAudio; CPUParticles2D* HitParticles; AudioStreamPlayer* HitAudio; Bullet(); ~Bullet(); static void _bind_methods(); void _physics_process(double delta) override; // Standalone methods void BodyEntered(Node2D* body); // Gets and Sets Ref GetPoofAudio() const { return PoofAudioClip; } Ref GetHitAudio() const { return PoofAudioClip; } Ref GetTexture() const { return Texture; } void SetPoofAudio(const Ref& audio ) { PoofAudioClip = audio; PoofAudio->set_stream(PoofAudioClip); } void SetHitAudio(const Ref& audio ) { HitAudioClip = audio; HitAudio->set_stream(HitAudioClip); } void SetTexture(const Ref& texture ) { Texture = texture; Sprite->set_texture(Texture); } }; } #endif