mirror of
https://codeberg.org/Melon-Bread/Comets.gd.git
synced 2024-11-24 21:18:21 -05:00
Comet spins randomly
This commit is contained in:
parent
307921801d
commit
41dc281b66
BIN
assets/_RAW_/comet.pxo
Normal file
BIN
assets/_RAW_/comet.pxo
Normal file
Binary file not shown.
BIN
assets/img/comet.png
Normal file
BIN
assets/img/comet.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 491 B |
34
assets/img/comet.png.import
Normal file
34
assets/img/comet.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://54mfrkbp1kcg"
|
||||
path="res://.godot/imported/comet.png-dae93592e3bed3dc4301ca1bc441e685.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/img/comet.png"
|
||||
dest_files=["res://.godot/imported/comet.png-dae93592e3bed3dc4301ca1bc441e685.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
|
14
scenes/comet.gd
Normal file
14
scenes/comet.gd
Normal file
@ -0,0 +1,14 @@
|
||||
extends Area2D
|
||||
|
||||
@export var movement_speed := 600
|
||||
|
||||
var rotation_speed : int
|
||||
var rotaion_direction : int
|
||||
|
||||
func _ready() -> void:
|
||||
rotaion_direction = randi_range(-1, 1)
|
||||
rotation_speed = randi_range(50, 250)
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
rotate(deg_to_rad(rotaion_direction * rotation_speed * delta))
|
||||
|
@ -1,3 +1,13 @@
|
||||
[gd_scene format=3 uid="uid://bsonrs8vhtly8"]
|
||||
[gd_scene load_steps=3 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://scenes/comet.gd" id="1_33qxe"]
|
||||
|
||||
[node name="Comet" type="Area2D"]
|
||||
script = ExtResource("1_33qxe")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("1_6q67h")
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||
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)
|
||||
|
@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://bdarunpk3c2eh"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bdarunpk3c2eh"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cbo47ftx0vcro" path="res://scenes/ship.tscn" id="1_esyqo"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsonrs8vhtly8" path="res://scenes/comet.tscn" id="2_b37uv"]
|
||||
|
||||
[node name="Game" type="Node2D"]
|
||||
|
||||
@ -19,3 +20,6 @@ color = Color(0, 0, 0, 1)
|
||||
[node name="Ship" parent="." instance=ExtResource("1_esyqo")]
|
||||
z_index = 1
|
||||
position = Vector2(622, 309)
|
||||
|
||||
[node name="Comet" parent="." instance=ExtResource("2_b37uv")]
|
||||
position = Vector2(276, 249)
|
||||
|
@ -38,7 +38,7 @@ func fire_gun(pos : Vector2, rot : float) -> void:
|
||||
bullet.position = pos
|
||||
bullet.rotation = rot
|
||||
$Projectiles.add_child(bullet)
|
||||
$ShootSound.play()
|
||||
$ShootSounds.play()
|
||||
can_shoot = false
|
||||
$ShotCooldown.start()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user