added Graphics and sound Effects and more overhauls
This commit is contained in:
parent
c887a2168c
commit
b9d4288900
214 changed files with 3378 additions and 198 deletions
4
scenes/obstacle/meteor/animation_player.gd
Normal file
4
scenes/obstacle/meteor/animation_player.gd
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
extends AnimationPlayer
|
||||
|
||||
func _ready() -> void:
|
||||
play("spin")
|
||||
1
scenes/obstacle/meteor/animation_player.gd.uid
Normal file
1
scenes/obstacle/meteor/animation_player.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://mnl62nrp3ffi
|
||||
|
|
@ -1,18 +1,36 @@
|
|||
class_name Meteor extends "res://scenes/obstacle/obstacle.gd"
|
||||
|
||||
@onready var animationPlayer = $AnimationPlayer
|
||||
|
||||
@export var minSpeed: int = 100
|
||||
@export var maxSpeed: int = 1000
|
||||
@export var minScale: float = 0.5
|
||||
@export var maxScale: float = 2
|
||||
|
||||
var rotated = false
|
||||
|
||||
var speed: int = 1000
|
||||
var offset: int = 0
|
||||
var direction: int
|
||||
|
||||
func _init() -> void:
|
||||
var rng = RandomNumberGenerator.new()
|
||||
direction = rng.randi_range(0, 360)
|
||||
var newScale = rng.randf_range(minScale, maxScale)
|
||||
scale = Vector2(newScale, newScale)
|
||||
|
||||
var direction = Vector2.UP.rotated(rotation)
|
||||
direction = rng.randi_range(0, 20)
|
||||
speed = rng.randi_range(minSpeed, maxSpeed)
|
||||
rotation = direction
|
||||
#rotation = direction
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
velocity = Vector2.UP.rotated(direction).normalized() * speed
|
||||
if not rotated:
|
||||
rotated = true
|
||||
if Globals.getPlayer() != null:
|
||||
look_at(Globals.getPlayer().global_position)
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
|
||||
velocity = Vector2.RIGHT.rotated(rotation+offset).normalized() * speed
|
||||
move_and_slide()
|
||||
|
|
|
|||
|
|
@ -1,36 +1,83 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://vl8duuwwrpqm"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://vl8duuwwrpqm"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cgqo1nxq6xprm" path="res://scenes/obstacle/obstacle.tscn" id="1_skd46"]
|
||||
[ext_resource type="PackedScene" uid="uid://cgqo1nxq6xprm" path="res://scenes/obstacle/obstacle.tscn" id="1_8c34n"]
|
||||
[ext_resource type="Script" uid="uid://b82cnxsh4mn0f" path="res://scenes/obstacle/meteor/meteor.gd" id="2_8c34n"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfwyw1sr6x2np" path="res://icon.svg" id="3_jb48p"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_8c34n"]
|
||||
radius = 56.0
|
||||
[ext_resource type="Texture2D" uid="uid://drk4xkhlq00x3" path="res://assets/obstacles/meteor.png" id="3_jb48p"]
|
||||
[ext_resource type="Script" uid="uid://mnl62nrp3ffi" path="res://scenes/obstacle/meteor/animation_player.gd" id="4_pganv"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_jb48p"]
|
||||
radius = 64.0
|
||||
radius = 128.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_pganv"]
|
||||
radius = 64.0
|
||||
radius = 144.0
|
||||
|
||||
[node name="Meteor" instance=ExtResource("1_skd46")]
|
||||
modulate = Color(1, 0, 0, 1)
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_22u22"]
|
||||
radius = 128.25
|
||||
|
||||
[sub_resource type="Animation" id="Animation_22u22"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_pganv"]
|
||||
resource_name = "spin"
|
||||
length = 5.0
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = false
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 5),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, 6.28319]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_b3sfu"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_22u22"),
|
||||
&"spin": SubResource("Animation_pganv")
|
||||
}
|
||||
|
||||
[node name="Meteor" instance=ExtResource("1_8c34n")]
|
||||
script = ExtResource("2_8c34n")
|
||||
minSpeed = 100
|
||||
maxSpeed = 1000
|
||||
health = 10
|
||||
minScale = 0.5
|
||||
maxScale = 2.0
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource("CircleShape2D_8c34n")
|
||||
|
||||
[node name="CollisionShape2D" parent="DamageArea" index="0"]
|
||||
shape = SubResource("CircleShape2D_jb48p")
|
||||
|
||||
[node name="CollisionShape2D" parent="hurtArea" index="0"]
|
||||
[node name="CollisionShape2D" parent="DamageArea" index="0"]
|
||||
shape = SubResource("CircleShape2D_pganv")
|
||||
|
||||
[node name="CollisionShape2D" parent="hurtArea" index="0"]
|
||||
shape = SubResource("CircleShape2D_22u22")
|
||||
|
||||
[node name="Sprite2D" parent="." index="3"]
|
||||
position = Vector2(5.72205e-06, 5.72205e-06)
|
||||
scale = Vector2(0.666667, 0.666667)
|
||||
texture = ExtResource("3_jb48p")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="6"]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_b3sfu")
|
||||
}
|
||||
script = ExtResource("4_pganv")
|
||||
|
||||
[editable path="DamageArea"]
|
||||
[editable path="hurtArea"]
|
||||
|
|
|
|||
|
|
@ -2,22 +2,25 @@ class_name Obstacle extends CharacterBody2D
|
|||
|
||||
@onready var sprite = $Sprite2D
|
||||
@onready var lifeTimeTimer = $lifeTimeTimer
|
||||
@onready var damageArea = $DamageArea
|
||||
@onready var hit = $hit
|
||||
|
||||
@export var damage: int = 10
|
||||
@export var health: int = 1
|
||||
@export var damage: int = 100
|
||||
@export var minHealth: int = 1
|
||||
@export var maxHealth: int = 1
|
||||
@export var maxHealth: int = 100
|
||||
@export var health: int
|
||||
@export var lifeTime: int = 600
|
||||
|
||||
func _ready() -> void:
|
||||
health = maxHealth + damage + 1
|
||||
lifeTimeTimer.start(lifeTime)
|
||||
health += damage
|
||||
|
||||
func spawn(damage: int):
|
||||
pass
|
||||
|
||||
|
||||
func _on_hurt_area_hurt(amount: int) -> void:
|
||||
hit.play()
|
||||
hurt(amount)
|
||||
|
||||
func hurt(amount: int):
|
||||
|
|
@ -29,3 +32,7 @@ func hurt(amount: int):
|
|||
|
||||
func _on_life_time_timer_timeout() -> void:
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_damage_area_area_entered(area: Area2D) -> void:
|
||||
damageArea.damageHurtArea(area, damage)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://cgqo1nxq6xprm"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://cgqo1nxq6xprm"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://eqo7k2ronf8k" path="res://scenes/areas/damageArea/damageArea.tscn" id="1_1ys07"]
|
||||
[ext_resource type="Script" uid="uid://iu7hvfpevs65" path="res://scenes/obstacle/obstacle.gd" id="1_osovj"]
|
||||
[ext_resource type="PackedScene" uid="uid://cglnd1ekr5u6r" path="res://scenes/areas/hurtArea/hurtArea.tscn" id="2_osovj"]
|
||||
[ext_resource type="AudioStream" uid="uid://vjxm7ay4t2ju" path="res://assets/sound/hit2.wav" id="4_ckc2h"]
|
||||
|
||||
[node name="Obstacle" type="CharacterBody2D" groups=["obstacle"]]
|
||||
collision_layer = 2
|
||||
|
|
@ -20,6 +21,10 @@ script = ExtResource("1_osovj")
|
|||
[node name="lifeTimeTimer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
[node name="hit" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("4_ckc2h")
|
||||
|
||||
[connection signal="area_entered" from="DamageArea" to="." method="_on_damage_area_area_entered"]
|
||||
[connection signal="hurt" from="hurtArea" to="." method="_on_hurt_area_hurt"]
|
||||
[connection signal="timeout" from="lifeTimeTimer" to="." method="_on_life_time_timer_timeout"]
|
||||
|
||||
|
|
|
|||
6
scenes/obstacle/radiation/radiation.gd
Normal file
6
scenes/obstacle/radiation/radiation.gd
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
class_name Radiation extends "res://scenes/obstacle/obstacle.gd"
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
for i: Spaceship in $range.get_overlapping_bodies():
|
||||
i.applyRadiation(damage)
|
||||
1
scenes/obstacle/radiation/radiation.gd.uid
Normal file
1
scenes/obstacle/radiation/radiation.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cf6le506yx5kl
|
||||
49
scenes/obstacle/radiation/radiation.gdshader
Normal file
49
scenes/obstacle/radiation/radiation.gdshader
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
shader_type canvas_item;
|
||||
|
||||
uniform float time : hint_range(0.0, 10.0);
|
||||
|
||||
float snoise(vec3 uv, float res)
|
||||
{
|
||||
const vec3 s = vec3(1e0, 1e2, 1e3);
|
||||
uv *= res;
|
||||
|
||||
vec3 uv0 = floor(mod(uv, res)) * s;
|
||||
vec3 uv1 = floor(mod(uv + vec3(1.0), res)) * s;
|
||||
|
||||
vec3 f = fract(uv);
|
||||
f = f * f * (3.0 - 2.0 * f);
|
||||
|
||||
vec4 v = vec4(uv0.x + uv0.y + uv0.z, uv1.x + uv0.y + uv0.z,
|
||||
uv0.x + uv1.y + uv0.z, uv1.x + uv1.y + uv0.z);
|
||||
|
||||
vec4 r = fract(sin(v * 1e-1) * 1e3);
|
||||
float r0 = mix(mix(r.x, r.y, f.x), mix(r.z, r.w, f.x), f.y);
|
||||
|
||||
r = fract(sin((v + uv1.z - uv0.z) * 1e-1) * 1e3);
|
||||
float r1 = mix(mix(r.x, r.y, f.x), mix(r.z, r.w, f.x), f.y);
|
||||
|
||||
return mix(r0, r1, f.z) * 2.0 - 1.0;
|
||||
}
|
||||
|
||||
void fragment()
|
||||
{
|
||||
// Calcular las coordenadas de la pantalla usando SCREEN_PIXEL_SIZE
|
||||
vec2 screen_size = vec2(1.0 / SCREEN_PIXEL_SIZE.x, 1.0 / SCREEN_PIXEL_SIZE.y);
|
||||
vec2 fragCoord = FRAGCOORD.xy;
|
||||
|
||||
vec2 p = -0.5 + fragCoord.xy / screen_size;
|
||||
p.x *= screen_size.x / screen_size.y;
|
||||
|
||||
float color = 3.0 - (3.0 * length(2.0 * p));
|
||||
|
||||
vec3 coord = vec3(atan(p.x, p.y) / 6.2832 + 0.5, length(p) * 0.4, 0.5);
|
||||
|
||||
// if you dont want use gdscript to animate you can replace the 'time' to 'TIME'
|
||||
for (int i = 1; i <= 7; i++)
|
||||
{
|
||||
float power = pow(2.0, float(i));
|
||||
color += (1.5 / power) * snoise(coord + vec3(0.0, -time * 0.05, time * 0.01), power * 16.0);
|
||||
}
|
||||
|
||||
COLOR = vec4(color, pow(max(color, 0.0), 2.0) * 0.4, pow(max(color, 0.0), 3.0) * 0.15, 1.0);
|
||||
}
|
||||
1
scenes/obstacle/radiation/radiation.gdshader.uid
Normal file
1
scenes/obstacle/radiation/radiation.gdshader.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bqato6xoe08xd
|
||||
57
scenes/obstacle/radiation/radiation.tscn
Normal file
57
scenes/obstacle/radiation/radiation.tscn
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://dhkcgxwakdha7"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cgqo1nxq6xprm" path="res://scenes/obstacle/obstacle.tscn" id="1_0jyim"]
|
||||
[ext_resource type="Script" uid="uid://cf6le506yx5kl" path="res://scenes/obstacle/radiation/radiation.gd" id="2_7r84j"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfwyw1sr6x2np" path="res://icon.svg" id="3_o6dqs"]
|
||||
[ext_resource type="Texture2D" uid="uid://bwnpsmrwskrgh" path="res://assets/radiation.png" id="4_pc435"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_7r84j"]
|
||||
radius = 64.0
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_as1jp"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_pc435"]
|
||||
radius = 192.0
|
||||
|
||||
[node name="Radiation" instance=ExtResource("1_0jyim")]
|
||||
collision_layer = 128
|
||||
collision_mask = 44
|
||||
script = ExtResource("2_7r84j")
|
||||
damage = 1
|
||||
lifeTime = 180
|
||||
|
||||
[node name="CollisionShape2D" parent="DamageArea" index="0"]
|
||||
shape = SubResource("CircleShape2D_7r84j")
|
||||
disabled = true
|
||||
|
||||
[node name="CollisionShape2D" parent="hurtArea" index="0"]
|
||||
disabled = true
|
||||
|
||||
[node name="Sprite2D" parent="." index="3"]
|
||||
visible = false
|
||||
material = SubResource("ShaderMaterial_as1jp")
|
||||
texture = ExtResource("3_o6dqs")
|
||||
|
||||
[node name="range" type="Area2D" parent="." index="6"]
|
||||
collision_layer = 128
|
||||
collision_mask = 40
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="range" index="0"]
|
||||
shape = SubResource("CircleShape2D_pc435")
|
||||
|
||||
[node name="CPUParticles2D" type="CPUParticles2D" parent="." index="7"]
|
||||
amount = 100
|
||||
texture = ExtResource("4_pc435")
|
||||
lifetime = 1.8
|
||||
speed_scale = 0.1
|
||||
randomness = 1.0
|
||||
spread = 180.0
|
||||
gravity = Vector2(0, 0)
|
||||
initial_velocity_min = 100.0
|
||||
initial_velocity_max = 100.0
|
||||
angle_max = 720.0
|
||||
scale_amount_min = 0.8
|
||||
scale_amount_max = 1.2
|
||||
|
||||
[editable path="DamageArea"]
|
||||
[editable path="hurtArea"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue