This commit is contained in:
pennyrigate 2025-07-19 16:54:36 -04:00
commit 6a269eb236
97 changed files with 2137 additions and 0 deletions

View file

@ -0,0 +1 @@
extends CPUParticles2D

View file

@ -0,0 +1 @@
uid://nvpkqa3y8g04

View file

@ -0,0 +1,27 @@
[gd_scene load_steps=5 format=3 uid="uid://dmg28km10q5ja"]
[ext_resource type="Texture2D" uid="uid://cd68hj3p7r01q" path="res://sprites/particles/fire_particles.png" id="1_idk12"]
[ext_resource type="Script" uid="uid://nvpkqa3y8g04" path="res://objects/player/jet_particles.gd" id="2_vu77f"]
[sub_resource type="Curve" id="Curve_idk12"]
_limits = [0.0, 3.0, 0.0, 1.0]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 3), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="Gradient" id="Gradient_m4kly"]
offsets = PackedFloat32Array(0.146667, 0.526667, 0.806667, 1)
colors = PackedColorArray(0.580392, 0.768627, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0.321569, 0)
[node name="CPUParticles2D" type="CPUParticles2D" groups=["fire_particles"]]
amount = 16
texture = ExtResource("1_idk12")
lifetime = 0.24
local_coords = true
spread = 0.0
gravity = Vector2(-190, 980)
tangential_accel_max = 100.0
damping_max = 100.0
angle_min = -720.0
scale_amount_curve = SubResource("Curve_idk12")
color_ramp = SubResource("Gradient_m4kly")
script = ExtResource("2_vu77f")

View file

@ -0,0 +1,27 @@
[gd_scene load_steps=5 format=3 uid="uid://c4dkexe3l6cma"]
[ext_resource type="Texture2D" uid="uid://cd68hj3p7r01q" path="res://sprites/particles/fire_particles.png" id="1_gl2g5"]
[ext_resource type="Script" uid="uid://nvpkqa3y8g04" path="res://objects/player/jet_particles.gd" id="2_td2pe"]
[sub_resource type="Curve" id="Curve_idk12"]
_limits = [0.0, 3.0, 0.0, 1.0]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 3), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="Gradient" id="Gradient_m4kly"]
offsets = PackedFloat32Array(0.453333, 0.806667, 0.873333, 1)
colors = PackedColorArray(0.580392, 0.768627, 1, 1, 1, 0.839216, 0.215686, 1, 1, 0, 0, 1, 1, 0, 0.321569, 0)
[node name="CPUParticles2D" type="CPUParticles2D" groups=["fire_particles"]]
amount = 16
texture = ExtResource("1_gl2g5")
lifetime = 0.15
local_coords = true
spread = 0.0
gravity = Vector2(-190, 980)
tangential_accel_max = 100.0
damping_max = 100.0
angle_min = -720.0
scale_amount_curve = SubResource("Curve_idk12")
color_ramp = SubResource("Gradient_m4kly")
script = ExtResource("2_td2pe")

139
objects/player/player.gd Normal file
View file

@ -0,0 +1,139 @@
extends CharacterBody2D
const WALK_ACCEL = 50.0
const WALK_TOPSPEED = 160.0
const FLY_ACCEL = 50.0
const FLY_TOPSPEED = 200.0
const GRAVITY = 15.0
const FAST_FALL_VELOCITY = 500.0
var downward_velocity = 0.0
var max_downward_velocity = 1200.0
var fast_fall_max_downward_velocity = 1500.0
var fuel = 100.0
const jetpack_velocity = 10.0
var score = 0
var aim_direction = 1
const BULLET = preload("res://weapons/spreadshot/spread_shot.tscn")
const GRAZE_PARTICLES = preload("res://sprites/Player/graze_particles.tscn")
func _physics_process(delta: float) -> void:
var axis = Input.get_axis("ui_left","ui_right")
if axis != 0: aim_direction = axis
#region ground movement
if axis != 0:
if velocity.y < 0:
move(FLY_ACCEL,FLY_TOPSPEED)
else:
move(WALK_ACCEL,WALK_TOPSPEED)
if is_on_floor():
%Sprite.play("walk")
else:
%Sprite.play("fly")
else:
velocity.x = move_toward(velocity.x, 0, WALK_ACCEL)
%Sprite.play("idle")
#endregion
#region gun
if Input.is_action_just_pressed("shoot"):
%ShootSound.play()
var bullet = BULLET.instantiate()
bullet.global_position = global_position
get_parent().add_child(bullet)
#endregion
#region jetpack flight
if Input.is_action_pressed("fly"):
if fuel > 0.0:
%Sprite.play("fly")
fuel -= 40.0 * delta
downward_velocity = 0.0
if %JetpackSound.is_playing() == false: %JetpackSound.play()
if %JetpackSound.pitch_scale < 1.25:
%JetpackSound.pitch_scale += 0.4 * delta
velocity.y -= jetpack_velocity
emit_fire(true)
else:
emit_fire(false)
else:
if %JetpackSound.pitch_scale > 0.4:
%JetpackSound.pitch_scale -= 0.1 * delta
emit_fire(false)
#endregion
if is_on_floor():
downward_velocity = 0.0
GlobalFunctions.append_score()
fuel = 100.0
silence_jetpack(delta)
else:
if Input.is_action_pressed("fast_fall"):
silence_jetpack(delta)
else:
%JetpackSound.volume_db = 0.0
if Input.is_action_pressed("fast_fall"):
downward_velocity += FAST_FALL_VELOCITY
downward_velocity = clamp(downward_velocity,0.0,fast_fall_max_downward_velocity)
velocity.y = clamp(velocity.y,velocity.y,fast_fall_max_downward_velocity)
else:
downward_velocity += GRAVITY
downward_velocity = clamp(downward_velocity,0.0,max_downward_velocity)
velocity.y = clamp(velocity.y,velocity.y,max_downward_velocity)
fuel -= 1 * delta
#jetpack pitch
velocity.y += downward_velocity * delta
move_and_slide()
#if event.is_action_pressed()
#endregion
func move(acceleration,topspeed):
var axis = Input.get_axis("ui_left","ui_right")
velocity.x += (axis * acceleration)
%Sprite.scale.x = axis
velocity.x = clamp(velocity.x,-topspeed,topspeed)
func silence_jetpack(delta):
%JetpackSound.pitch_scale = 1.0
%JetpackSound.volume_db -= 50 * delta
func emit_fire(emit:bool=true,lifetime:float=0.24):
get_tree().get_nodes_in_group("fire_particles")[0].emitting = emit
get_tree().get_nodes_in_group("fire_particles")[0].lifetime = lifetime
get_tree().get_nodes_in_group("fire_particles")[1].emitting = emit
get_tree().get_nodes_in_group("fire_particles")[1].lifetime = lifetime
func _on_area_2d_body_entered(body: Node2D) -> void:
if body.is_in_group("death"):
get_tree().reload_current_scene()
func _on_area_2d_area_entered(area: Area2D) -> void:
#if area.is_in_group("death") or area.is_in_group("hurt"):
#get_tree().reload_current_scene()
pass
func _on_hurtbox_area_entered(area: Area2D) -> void:
get_tree().reload_current_scene()
func _on_graze_hitbox_area_entered(area: Area2D) -> void:
if area.is_in_group("enemy_bullet"):
if area.get_parent().grazed == false:
GlobalFunctions.queue_score(0)
var graze_particle = GRAZE_PARTICLES.instantiate()
graze_particle.global_position = global_position
get_parent().add_child(graze_particle)
area.get_parent().grazed = true

View file

@ -0,0 +1 @@
uid://cgo3kf4b37lx7

137
objects/player/player.tscn Normal file
View file

@ -0,0 +1,137 @@
[gd_scene load_steps=15 format=3 uid="uid://e2tevu6gn5si"]
[ext_resource type="Script" uid="uid://cgo3kf4b37lx7" path="res://objects/player/player.gd" id="1_4flbx"]
[ext_resource type="AudioStream" uid="uid://bhy8i7yg863n3" path="res://audio/sfx/jetpack.ogg" id="2_g7ett"]
[ext_resource type="Texture2D" uid="uid://bt2xuy2ihej2q" path="res://sprites/Player/clegg_fly.png" id="2_xkryw"]
[ext_resource type="AudioStream" uid="uid://ct82ub5u2uoly" path="res://audio/sfx/se_g2.ogg" id="3_ssrue"]
[ext_resource type="Texture2D" uid="uid://bi6gfgt0b0voa" path="res://sprites/Player/clegg.png" id="4_m4kly"]
[ext_resource type="Texture2D" uid="uid://bce74ak1by42t" path="res://sprites/Player/clegg_walk1.png" id="4_xgwla"]
[ext_resource type="Texture2D" uid="uid://bvb5neqj421p" path="res://sprites/Player/clegg_walk2.png" id="5_bi5m7"]
[ext_resource type="AudioStream" uid="uid://bv6v7v5dtvoii" path="res://audio/sfx/graze.wav" id="6_ow0dq"]
[ext_resource type="PackedScene" uid="uid://dmg28km10q5ja" path="res://objects/player/jet_particles.tscn" id="9_xgwla"]
[sub_resource type="SpriteFrames" id="SpriteFrames_xgwla"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("2_xkryw")
}],
"loop": true,
"name": &"fly",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("4_m4kly")
}],
"loop": true,
"name": &"idle",
"speed": 15.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("4_m4kly")
}],
"loop": true,
"name": &"new_animation",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("4_xgwla")
}, {
"duration": 1.0,
"texture": ExtResource("4_m4kly")
}, {
"duration": 1.0,
"texture": ExtResource("5_bi5m7")
}],
"loop": true,
"name": &"walk",
"speed": 15.0
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_sh265"]
size = Vector2(28, 34.375)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cqmt1"]
size = Vector2(27.5, 34)
[sub_resource type="CircleShape2D" id="CircleShape2D_xkryw"]
radius = 17.0
[sub_resource type="CircleShape2D" id="CircleShape2D_xgwla"]
radius = 2.06155
[node name="Player" type="CharacterBody2D" groups=["player", "player_hitbox"]]
collision_mask = 2
script = ExtResource("1_4flbx")
[node name="ColorRect" type="ColorRect" parent="."]
visible = false
offset_left = -8.0
offset_top = -16.0
offset_right = 8.0
offset_bottom = 16.0
[node name="Sprite" type="AnimatedSprite2D" parent="."]
unique_name_in_owner = true
sprite_frames = SubResource("SpriteFrames_xgwla")
animation = &"fly"
[node name="CPUParticles2D" parent="Sprite" instance=ExtResource("9_xgwla")]
position = Vector2(-6, 17)
scale = Vector2(0.5, 0.5)
[node name="CPUParticles2D2" parent="Sprite" instance=ExtResource("9_xgwla")]
position = Vector2(2.5, 17)
scale = Vector2(0.5, 0.5)
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -0.1875)
shape = SubResource("RectangleShape2D_sh265")
[node name="Collectionbox" type="Area2D" parent="." groups=["player_hitbox"]]
collision_mask = 7
[node name="CollisionShape2D" type="CollisionShape2D" parent="Collectionbox"]
position = Vector2(0.25, 0)
shape = SubResource("RectangleShape2D_cqmt1")
[node name="JetpackSound" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("2_g7ett")
bus = &"Jetpack"
[node name="GrazeSound" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("6_ow0dq")
[node name="ShootSound" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("3_ssrue")
volume_db = 6.559
bus = &"SFX"
[node name="GrazeHitbox" type="Area2D" parent="."]
position = Vector2(-3, -4)
collision_mask = 8
[node name="CollisionShape2D" type="CollisionShape2D" parent="GrazeHitbox"]
position = Vector2(3, 4)
shape = SubResource("CircleShape2D_xkryw")
debug_color = Color(0.797602, 0.0486606, 1, 0.42)
[node name="Hurtbox" type="Area2D" parent="."]
position = Vector2(-1, -10)
collision_mask = 8
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox"]
position = Vector2(2, 11.5)
shape = SubResource("CircleShape2D_xgwla")
debug_color = Color(1, 0, 0.0917967, 0.42)
[connection signal="area_entered" from="Collectionbox" to="." method="_on_area_2d_area_entered"]
[connection signal="body_entered" from="Collectionbox" to="." method="_on_area_2d_body_entered"]
[connection signal="area_entered" from="GrazeHitbox" to="." method="_on_graze_hitbox_area_entered"]
[connection signal="area_entered" from="Hurtbox" to="." method="_on_hurtbox_area_entered"]

View file

@ -0,0 +1,29 @@
extends Node2D
var direction = 1
@export var speed = Vector2.ZERO
@export var range = 1.0
@export var infinite_range = true
func _ready() -> void:
var player = get_tree().get_nodes_in_group("player")[0]
direction = player.aim_direction
if infinite_range == true: %RangeTimer.paused = true
func _physics_process(delta: float) -> void:
position.x += (speed.x * direction) * delta
position.y += (speed.y) * delta
func _on_area_2d_area_entered(area: Area2D) -> void:
if area.is_in_group("enemy_hitbox"):
GlobalFunctions.queue_score(10)
area.get_parent().queue_free()
queue_free()
func _on_area_2d_body_entered(body: Node2D) -> void:
queue_free()
func _on_range_timer_timeout() -> void:
queue_free()

View file

@ -0,0 +1 @@
uid://cbmi6g10hnfve

View file

@ -0,0 +1,31 @@
[gd_scene load_steps=3 format=3 uid="uid://cqqqblpc3j4hn"]
[ext_resource type="Script" uid="uid://cbmi6g10hnfve" path="res://objects/player/player_bullet/player_bullet.gd" id="1_lj6op"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_lj6op"]
size = Vector2(8, 8)
[node name="PlayerBullet" type="Node2D"]
script = ExtResource("1_lj6op")
speed = Vector2(1000, 0)
[node name="ColorRect" type="ColorRect" parent="."]
offset_left = -4.0
offset_top = -4.0
offset_right = 4.0
offset_bottom = 4.0
[node name="Area2D" type="Area2D" parent="."]
collision_layer = 16
collision_mask = 14
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("RectangleShape2D_lj6op")
[node name="RangeTimer" type="Timer" parent="."]
unique_name_in_owner = true
autostart = true
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
[connection signal="timeout" from="RangeTimer" to="." method="_on_range_timer_timeout"]