mirror of
https://codeberg.org/Melon-Bread/Comets.gd.git
synced 2024-11-24 21:18:21 -05:00
Compare commits
No commits in common. "130fc73076532b3824f21fad5cb5c81efceaad88" and "15ab4d720edcc677c4c66d7c232c0f4c1b7e5229" have entirely different histories.
130fc73076
...
15ab4d720e
@ -1,5 +1,3 @@
|
||||
# Comets.gd
|
||||
|
||||
This is just a little Androids-like clone I made to get more familiar with the Godot game engine over the course of a few days. Nothing crazy or special, but it is important to finish and release games!
|
||||
|
||||
You can find screenshots, builds, & more info [here!](https://melon-bread.itch.io/cometsdotgd)
|
||||
My take on a simple Astroids-like game. Really just me playing around in Godot
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 563 B |
@ -1,34 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b8swdgkngg7a3"
|
||||
path="res://.godot/imported/comet2.png-5c168a7393426970d7715a9f51cb4f6a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/img/comet2.png"
|
||||
dest_files=["res://.godot/imported/comet2.png-5c168a7393426970d7715a9f51cb4f6a.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
Binary file not shown.
Before Width: | Height: | Size: 588 B |
@ -1,34 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dk2lcceleqyal"
|
||||
path="res://.godot/imported/comet3.png-524767f527dbc8f654c976b7aa94ad66.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/img/comet3.png"
|
||||
dest_files=["res://.godot/imported/comet3.png-524767f527dbc8f654c976b7aa94ad66.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
Binary file not shown.
Before Width: | Height: | Size: 506 B |
@ -1,34 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://by4nqr5c4t6i"
|
||||
path="res://.godot/imported/comet4.png-02d5c45d52e8bd739a883c09308a279d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/img/comet4.png"
|
||||
dest_files=["res://.godot/imported/comet4.png-02d5c45d52e8bd739a883c09308a279d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
@ -1,8 +1,8 @@
|
||||
[gd_scene load_steps=13 format=3 uid="uid://bsonrs8vhtly8"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://54mfrkbp1kcg" path="res://assets/img/comet.png" id="1_6q67h"]
|
||||
[ext_resource type="Script" path="res://scripts/comet.gd" id="1_33qxe"]
|
||||
[ext_resource type="Shader" path="res://assets/shaders/PixelExplosion.gdshader" id="2_2l5nu"]
|
||||
[ext_resource type="Texture2D" uid="uid://b8swdgkngg7a3" path="res://assets/img/comet2.png" id="3_7qdji"]
|
||||
[ext_resource type="AudioStream" uid="uid://eb71wdy8dy4x" path="res://assets/sfx/explosion.wav" id="3_awuk4"]
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_wa814"]
|
||||
@ -114,11 +114,10 @@ script = ExtResource("1_33qxe")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
material = SubResource("ShaderMaterial_6s6e6")
|
||||
texture = ExtResource("3_7qdji")
|
||||
texture = ExtResource("1_6q67h")
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||
position = Vector2(0, -1.5)
|
||||
polygon = PackedVector2Array(17, -29.5, 30, -19.5, 31, 2.5, 32, 28.5, 18, 33.5, -25, 32.5, -29, 25.5, -31, -18.5, -22, -26.5)
|
||||
polygon = PackedVector2Array(19, -27, 22, -25, 25, -24, 27, -21, 31, -17, 32, -3, 32, 27, 27, 30, -8, 29, -17, 28, -25, 26, -32, 22, -32, 18, -23, 8, -20, 7, -21, 2, -29, -17, -29, -26, -27, -29, -25, -32, -14, -32, 0, -30)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
|
@ -1,11 +1,10 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://bdarunpk3c2eh"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://bdarunpk3c2eh"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/game.gd" id="1_6727i"]
|
||||
[ext_resource type="PackedScene" uid="uid://cbo47ftx0vcro" path="res://scenes/ship.tscn" id="1_esyqo"]
|
||||
[ext_resource type="FontFile" uid="uid://bkcxbtx1vcj8w" path="res://assets/fonts/Color Basic.otf" id="2_gwtm0"]
|
||||
[ext_resource type="PackedScene" uid="uid://0yktrbyp6cr3" path="res://scenes/game_over_screen.tscn" id="3_yy075"]
|
||||
[ext_resource type="PackedScene" uid="uid://cemhlom425afn" path="res://scenes/stars.tscn" id="4_064lo"]
|
||||
[ext_resource type="PackedScene" uid="uid://e647ck5fxo17" path="res://scenes/invader_spawner.tscn" id="5_itvtr"]
|
||||
|
||||
[node name="Game" type="Node2D"]
|
||||
script = ExtResource("1_6727i")
|
||||
@ -59,11 +58,8 @@ color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Stars" parent="Background" instance=ExtResource("4_064lo")]
|
||||
|
||||
[node name="InvaderSpawner" parent="." instance=ExtResource("5_itvtr")]
|
||||
|
||||
[node name="Ship" parent="." instance=ExtResource("1_esyqo")]
|
||||
z_index = 1
|
||||
position = Vector2(622, 309)
|
||||
|
||||
[connection signal="shot" from="InvaderSpawner" to="." method="_on_invader_spawner_shot"]
|
||||
[connection signal="crashed" from="Ship" to="." method="game_over"]
|
||||
|
@ -35,33 +35,6 @@ shader_parameter/strength = 1.0
|
||||
shader_parameter/noise_tex_normal = SubResource("NoiseTexture2D_vfidg")
|
||||
shader_parameter/noise_tex = SubResource("NoiseTexture2D_ca84o")
|
||||
|
||||
[sub_resource type="Animation" id="Animation_cojig"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("CrashSound:playing")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D:material:shader_parameter/progress")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [null]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_l62j8"]
|
||||
resource_name = "crash"
|
||||
length = 0.4
|
||||
@ -107,6 +80,33 @@ tracks/2/keys = {
|
||||
"values": [null, 0.33, 0.66, 1.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_cojig"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("CrashSound:playing")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D:material:shader_parameter/progress")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [null]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_1dk2o"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_cojig"),
|
||||
|
@ -1,14 +0,0 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://e647ck5fxo17"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/invader_spawner.gd" id="1_y3j7g"]
|
||||
|
||||
[node name="InvaderSpawner" type="Node2D"]
|
||||
script = ExtResource("1_y3j7g")
|
||||
|
||||
[node name="SpawnTimer" type="Timer" parent="."]
|
||||
wait_time = 30.0
|
||||
autostart = true
|
||||
|
||||
[node name="Invaders" type="Node" parent="."]
|
||||
|
||||
[connection signal="timeout" from="SpawnTimer" to="." method="_on_spawn_timer_timeout"]
|
@ -2,21 +2,15 @@ extends Area2D
|
||||
|
||||
@export var speed := 1400.00
|
||||
var direction := Vector2.UP
|
||||
var life_span = 0.5
|
||||
var screen_wrap = true
|
||||
|
||||
func _ready() -> void:
|
||||
$LifeTimer.wait_time = life_span
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
# Movement
|
||||
position += direction.rotated(rotation) * speed * delta
|
||||
|
||||
# Screenwrap
|
||||
if screen_wrap:
|
||||
var viewport_size := get_viewport_rect().size
|
||||
position.x = wrap(position.x, 0, viewport_size.x)
|
||||
position.y = wrap(position.y, 0,viewport_size.y)
|
||||
var viewport_size := get_viewport_rect().size
|
||||
position.x = wrap(position.x, 0, viewport_size.x)
|
||||
position.y = wrap(position.y, 0,viewport_size.y)
|
||||
|
||||
func _on_life_timer_timeout() -> void:
|
||||
queue_free()
|
||||
|
@ -1,5 +1,6 @@
|
||||
extends Area2D
|
||||
|
||||
# TODO: Have like 1 in 4 different sprites (and maybe shapes) the comet can be
|
||||
|
||||
signal exploded (new_size: SIZE, current_position: Vector2)
|
||||
|
||||
@ -13,13 +14,6 @@ var size_data = {
|
||||
SIZE.LARGE : {"Scale": 2.5, "Speed-Multi": 0.5}
|
||||
}
|
||||
|
||||
var texture_options = [
|
||||
"res://assets/img/comet.png",
|
||||
"res://assets/img/comet2.png",
|
||||
"res://assets/img/comet3.png",
|
||||
"res://assets/img/comet4.png"
|
||||
]
|
||||
|
||||
var movement_speed : int
|
||||
var movement_speed_min : int = 50
|
||||
var movement_speed_max : int = 250
|
||||
@ -29,9 +23,6 @@ var rotation_speed : int
|
||||
var rotaion_direction : int
|
||||
|
||||
func _ready() -> void:
|
||||
$Sprite2D.texture = load(texture_options.pick_random())
|
||||
|
||||
|
||||
movement_speed = randi_range(movement_speed_min, movement_speed_max)
|
||||
movement_speed *= size_data[current_size]["Speed-Multi"]
|
||||
|
||||
|
@ -38,14 +38,10 @@ func game_over() -> void:
|
||||
if score > high_score:
|
||||
save_score()
|
||||
|
||||
func _on_invader_spawner_shot() -> void:
|
||||
# This is not the most modular way to do this.
|
||||
score += 500
|
||||
|
||||
func increase_score(comet_size : int) -> void:
|
||||
# We add one since comet_size starts count at 0
|
||||
comet_size += 1
|
||||
score += int(points_per_comet / comet_size)
|
||||
score += points_per_comet / comet_size
|
||||
|
||||
func update_ui()-> void:
|
||||
# Label strings must be all caps for font to render proper
|
||||
@ -63,3 +59,5 @@ func load_score() -> int:
|
||||
return file.get_var(score)
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@ func _ready() -> void:
|
||||
movement_direction.x = -1
|
||||
else:
|
||||
movement_direction.x = 1
|
||||
random_position.y = randf_range(32, viewport_size.y + 32)
|
||||
random_position.y = randi_range(32, viewport_size.y + 32)
|
||||
position = random_position
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ func _process(delta: float) -> void:
|
||||
|
||||
if can_shoot:
|
||||
# FIXME: Proper shoot angle and not able to sudoku
|
||||
shoot($GunMarker.global_position, randf_range(90.0, 92.0))
|
||||
shoot($GunMarker.global_position, randf_range(90.0, 100.0))
|
||||
|
||||
# "Die", if off screen
|
||||
if position.x > viewport_size.x or position.x < 0:
|
||||
@ -54,8 +54,6 @@ func shoot(pos : Vector2, rot : float) -> void:
|
||||
var bullet := BULLET.instantiate()
|
||||
bullet.position = pos
|
||||
bullet.rotation = rot
|
||||
bullet.life_span = 0.3
|
||||
bullet.screen_wrap = false
|
||||
$Projectiles.add_child(bullet)
|
||||
$ShootSound.play()
|
||||
can_shoot = false
|
||||
|
@ -1,26 +0,0 @@
|
||||
extends Node2D
|
||||
|
||||
signal shot
|
||||
|
||||
const INVADER = preload("res://scenes/invader.tscn")
|
||||
|
||||
var can_spawn = false
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if can_spawn:
|
||||
spawn_invader()
|
||||
$SpawnTimer.wait_time = randi_range(20, 40)
|
||||
|
||||
|
||||
func _on_spawn_timer_timeout() -> void:
|
||||
can_spawn = true
|
||||
|
||||
func spawn_invader() -> void:
|
||||
var invader := INVADER.instantiate()
|
||||
invader.shot.connect(player_shot)
|
||||
$Invaders.add_child(invader)
|
||||
can_spawn = false
|
||||
$SpawnTimer.start()
|
||||
|
||||
func player_shot() -> void:
|
||||
shot.emit()
|
Loading…
Reference in New Issue
Block a user