first Prototype
This commit is contained in:
parent
89503407e7
commit
c887a2168c
78 changed files with 2494 additions and 2 deletions
4
.editorconfig
Normal file
4
.editorconfig
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Normalize EOL for all files that Git considers text files.
|
||||
* text=auto eol=lf
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -1,6 +1,7 @@
|
|||
# ---> Godot
|
||||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
/android/
|
||||
|
||||
|
||||
# Godot-specific ignores
|
||||
.import/
|
||||
|
|
@ -14,4 +15,3 @@ export_presets.cfg
|
|||
.mono/
|
||||
data_*/
|
||||
mono_crash.*.json
|
||||
|
||||
|
|
|
|||
BIN
assets/Spash Screen.png
Normal file
BIN
assets/Spash Screen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 507 KiB |
34
assets/Spash Screen.png.import
Normal file
34
assets/Spash Screen.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dwjegx0mvirsg"
|
||||
path="res://.godot/imported/Spash Screen.png-e4bf3d868c64976d7faedf235e897dc7.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Spash Screen.png"
|
||||
dest_files=["res://.godot/imported/Spash Screen.png-e4bf3d868c64976d7faedf235e897dc7.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
icon.svg
Normal file
1
icon.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>
|
||||
|
After Width: | Height: | Size: 994 B |
37
icon.svg.import
Normal file
37
icon.svg.import
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cfwyw1sr6x2np"
|
||||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://icon.svg"
|
||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
BIN
plugins/godot-git-plugin-v3.2.0.zip
Normal file
BIN
plugins/godot-git-plugin-v3.2.0.zip
Normal file
Binary file not shown.
21
plugins/godot-git-plugin/LICENSE
Normal file
21
plugins/godot-git-plugin/LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2016-2023 The Godot Engine community
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
1346
plugins/godot-git-plugin/THIRDPARTY.md
Normal file
1346
plugins/godot-git-plugin/THIRDPARTY.md
Normal file
File diff suppressed because it is too large
Load diff
10
plugins/godot-git-plugin/git_plugin.gdextension
Normal file
10
plugins/godot-git-plugin/git_plugin.gdextension
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[configuration]
|
||||
|
||||
entry_symbol = "git_plugin_init"
|
||||
compatibility_minimum = "4.2.0"
|
||||
|
||||
[libraries]
|
||||
|
||||
linux.editor.x86_64 = "linux/libgit_plugin.linux.editor.x86_64.so"
|
||||
macos.editor = "macos/libgit_plugin.macos.editor.universal.dylib"
|
||||
windows.editor.x86_64 = "windows/libgit_plugin.windows.editor.x86_64.dll"
|
||||
1
plugins/godot-git-plugin/git_plugin.gdextension.uid
Normal file
1
plugins/godot-git-plugin/git_plugin.gdextension.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cgqo1wjqsp41e
|
||||
BIN
plugins/godot-git-plugin/linux/libgit_plugin.linux.editor.x86_64.so
Executable file
BIN
plugins/godot-git-plugin/linux/libgit_plugin.linux.editor.x86_64.so
Executable file
Binary file not shown.
BIN
plugins/godot-git-plugin/macos/libgit_plugin.macos.editor.universal.dylib
Executable file
BIN
plugins/godot-git-plugin/macos/libgit_plugin.macos.editor.universal.dylib
Executable file
Binary file not shown.
Binary file not shown.
166
project.godot
Normal file
166
project.godot
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
|
||||
[application]
|
||||
|
||||
config/name="GMTK Game Jam 2025"
|
||||
config/tags=PackedStringArray("gamedev")
|
||||
run/main_scene="uid://cfculwiy7mtdc"
|
||||
config/features=PackedStringArray("4.4", "GL Compatibility")
|
||||
boot_splash/image="uid://dwjegx0mvirsg"
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[autoload]
|
||||
|
||||
Globals="*res://scenes/globals/globals.gd"
|
||||
|
||||
[editor]
|
||||
|
||||
version_control/plugin_name="GitPlugin"
|
||||
version_control/autoload_on_startup=true
|
||||
|
||||
[file_customization]
|
||||
|
||||
folder_colors={
|
||||
"res://assets/": "red",
|
||||
"res://scenes/": "green"
|
||||
}
|
||||
|
||||
[global_group]
|
||||
|
||||
timeGhost="timeGhost"
|
||||
spaceShip="spaceship"
|
||||
player="player"
|
||||
weapon="Weapon"
|
||||
bulletPool="bulletPool"
|
||||
damageArea="damageArea"
|
||||
healthArea="healthArea"
|
||||
bullet="bullet"
|
||||
obstacle="obstacle"
|
||||
enemy="enemy"
|
||||
|
||||
[input]
|
||||
|
||||
moveForward={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":11,"pressure":0.0,"pressed":true,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
moveRight={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":14,"pressure":0.0,"pressed":true,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
moveBackward={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":12,"pressure":0.0,"pressed":true,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
moveLeft={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":13,"pressure":0.0,"pressed":true,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
|
||||
]
|
||||
}
|
||||
attack={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(188, 26),"global_position":Vector2(197, 74),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":5,"axis_value":1.0,"script":null)
|
||||
]
|
||||
}
|
||||
dash={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(40, 22),"global_position":Vector2(49, 70),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
2d_render/layer_1="map"
|
||||
3d_render/layer_1="map"
|
||||
2d_render/layer_2="obstacle"
|
||||
3d_render/layer_2="obstacle"
|
||||
2d_render/layer_3="spaceship"
|
||||
3d_render/layer_3="spaceship"
|
||||
2d_render/layer_4="player"
|
||||
3d_render/layer_4="player"
|
||||
2d_render/layer_5="timeghost"
|
||||
3d_render/layer_5="timeghost"
|
||||
2d_render/layer_6="enemy"
|
||||
3d_render/layer_6="enemy"
|
||||
2d_render/layer_7="visionArea"
|
||||
3d_render/layer_7="visionArea"
|
||||
2d_render/layer_19="hurtArea"
|
||||
3d_render/layer_19="hurtArea"
|
||||
2d_render/layer_20="damageArea"
|
||||
3d_render/layer_20="damageArea"
|
||||
2d_physics/layer_1="map"
|
||||
2d_navigation/layer_1="map"
|
||||
3d_physics/layer_1="map"
|
||||
3d_navigation/layer_1="map"
|
||||
2d_physics/layer_2="obstacle"
|
||||
2d_navigation/layer_2="obstacles"
|
||||
3d_physics/layer_2="obstacle"
|
||||
3d_navigation/layer_2="obstacle"
|
||||
2d_physics/layer_3="spaceship"
|
||||
2d_navigation/layer_3="spaceship"
|
||||
3d_physics/layer_3="spaceship"
|
||||
3d_navigation/layer_3="spaceship"
|
||||
2d_physics/layer_4="player"
|
||||
2d_navigation/layer_4="player"
|
||||
3d_physics/layer_4="player"
|
||||
3d_navigation/layer_4="player"
|
||||
2d_physics/layer_5="timeghost"
|
||||
2d_navigation/layer_5="timeghost"
|
||||
3d_physics/layer_5="timeghost"
|
||||
3d_navigation/layer_5="timeghost"
|
||||
2d_physics/layer_6="enemy"
|
||||
2d_navigation/layer_6="enemy"
|
||||
3d_physics/layer_6="enemy"
|
||||
3d_navigation/layer_6="enemy"
|
||||
2d_physics/layer_7="visionArea"
|
||||
2d_navigation/layer_7="visionArea"
|
||||
3d_physics/layer_7="visionArea"
|
||||
3d_navigation/layer_7="visionArea"
|
||||
2d_physics/layer_31="hurtArea"
|
||||
2d_navigation/layer_31="hurtArea"
|
||||
3d_physics/layer_31="hurtArea"
|
||||
3d_navigation/layer_31="hurtArea"
|
||||
2d_physics/layer_32="damageArea"
|
||||
2d_navigation/layer_32="damageArea"
|
||||
3d_physics/layer_32="damageArea"
|
||||
3d_navigation/layer_32="damageArea"
|
||||
avoidance/layer_1="map"
|
||||
avoidance/layer_2="obstacle"
|
||||
avoidance/layer_3="spaceship"
|
||||
avoidance/layer_4="player"
|
||||
avoidance/layer_5="timeghost"
|
||||
avoidance/layer_6="enemy"
|
||||
avoidance/layer_7="visionArea"
|
||||
avoidance/layer_31="hurtArea"
|
||||
avoidance/layer_32="damageArea"
|
||||
|
||||
[rendering]
|
||||
|
||||
renderer/rendering_method="gl_compatibility"
|
||||
renderer/rendering_method.mobile="gl_compatibility"
|
||||
textures/vram_compression/import_etc2_astc=true
|
||||
8
scenes/areas/damageArea/damageArea.gd
Normal file
8
scenes/areas/damageArea/damageArea.gd
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
extends Area2D
|
||||
|
||||
@export var damage: int
|
||||
|
||||
|
||||
func _on_area_entered(area: Area2D) -> void:
|
||||
if area.is_in_group("healthArea"):
|
||||
area.hurt.emit(damage)
|
||||
1
scenes/areas/damageArea/damageArea.gd.uid
Normal file
1
scenes/areas/damageArea/damageArea.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c2hs5p7vtiy0n
|
||||
12
scenes/areas/damageArea/damageArea.tscn
Normal file
12
scenes/areas/damageArea/damageArea.tscn
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://eqo7k2ronf8k"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c2hs5p7vtiy0n" path="res://scenes/areas/damageArea/damageArea.gd" id="1_jlldj"]
|
||||
|
||||
[node name="DamageArea" type="Area2D" groups=["damageArea"]]
|
||||
collision_layer = 2147483648
|
||||
collision_mask = 1073741824
|
||||
script = ExtResource("1_jlldj")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||
12
scenes/areas/hurtArea/hurtArea.tscn
Normal file
12
scenes/areas/hurtArea/hurtArea.tscn
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://cglnd1ekr5u6r"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://1a30h315e73b" path="res://scenes/areas/hurtArea/hurt_area.gd" id="1_c51ym"]
|
||||
|
||||
[node name="hurtArea" type="Area2D" groups=["healthArea"]]
|
||||
collision_layer = 1073741824
|
||||
collision_mask = 2147483648
|
||||
script = ExtResource("1_c51ym")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||
8
scenes/areas/hurtArea/hurt_area.gd
Normal file
8
scenes/areas/hurtArea/hurt_area.gd
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
extends Area2D
|
||||
|
||||
signal hurt(amount: int)
|
||||
|
||||
#
|
||||
#func _on_area_entered(area: Area2D) -> void:
|
||||
#print(area.name)
|
||||
#
|
||||
1
scenes/areas/hurtArea/hurt_area.gd.uid
Normal file
1
scenes/areas/hurtArea/hurt_area.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://1a30h315e73b
|
||||
40
scenes/bullet/bullet.gd
Normal file
40
scenes/bullet/bullet.gd
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
class_name Bullet extends CharacterBody2D
|
||||
|
||||
@onready var damageArea = $DamageArea
|
||||
@onready var rangeTimer = $rangeTimer
|
||||
|
||||
var speed = 10 * 10000
|
||||
|
||||
var damage: int = 1
|
||||
var penetration: int = 1
|
||||
var penetratedCount: int = 0
|
||||
var range: float = 1.0
|
||||
|
||||
func _ready() -> void:
|
||||
damageArea.damage = damage
|
||||
rangeTimer.start(range)
|
||||
|
||||
func spawn(_positon: Vector2, _rotation: float, _damage: int, _range: float = 8.0, _penetration: int = 1, _speed: int = 10) -> void:
|
||||
global_position = _positon
|
||||
rotation = _rotation
|
||||
damage = _damage
|
||||
$DamageArea.damage = _damage
|
||||
penetration = _penetration
|
||||
range = _range
|
||||
speed = _speed * 10000
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
velocity = Vector2.UP.rotated(rotation) * speed * delta
|
||||
move_and_slide()
|
||||
|
||||
func _on_damage_area_area_entered(area: Area2D) -> void:
|
||||
penetratedCount += 1
|
||||
checkPenetration()
|
||||
|
||||
func checkPenetration():
|
||||
if penetration <= penetratedCount:
|
||||
queue_free()
|
||||
|
||||
func _on_range_timer_timeout() -> void:
|
||||
queue_free()
|
||||
1
scenes/bullet/bullet.gd.uid
Normal file
1
scenes/bullet/bullet.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://w5vknsebe1yd
|
||||
30
scenes/bullet/bullet.tscn
Normal file
30
scenes/bullet/bullet.tscn
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://0ndix1r8v6i1"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://eqo7k2ronf8k" path="res://scenes/areas/damageArea/damageArea.tscn" id="1_5f68y"]
|
||||
[ext_resource type="Script" uid="uid://w5vknsebe1yd" path="res://scenes/bullet/bullet.gd" id="1_mkndb"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_mkndb"]
|
||||
|
||||
[node name="Bullet" type="CharacterBody2D" groups=["bullet"]]
|
||||
collision_layer = 0
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_mkndb")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
position = Vector2(0, -9.53674e-07)
|
||||
scale = Vector2(0.125, 0.25)
|
||||
|
||||
[node name="rangeTimer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
[node name="DamageArea" parent="." instance=ExtResource("1_5f68y")]
|
||||
|
||||
[node name="CollisionShape2D" parent="DamageArea" index="0"]
|
||||
shape = SubResource("RectangleShape2D_mkndb")
|
||||
|
||||
[connection signal="timeout" from="rangeTimer" to="." method="_on_range_timer_timeout"]
|
||||
[connection signal="area_entered" from="DamageArea" to="." method="_on_damage_area_area_entered"]
|
||||
|
||||
[editable path="DamageArea"]
|
||||
1
scenes/bullet/bulletMinigun/bulletMinigun.gd
Normal file
1
scenes/bullet/bulletMinigun/bulletMinigun.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
class_name BulletMinigun extends "res://scenes/bullet/bullet.gd"
|
||||
1
scenes/bullet/bulletMinigun/bulletMinigun.gd.uid
Normal file
1
scenes/bullet/bulletMinigun/bulletMinigun.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://58udf4vhqogw
|
||||
15
scenes/bullet/bulletMinigun/bulletMinigun.tscn
Normal file
15
scenes/bullet/bulletMinigun/bulletMinigun.tscn
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://ddv7o76dcnpx6"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://0ndix1r8v6i1" path="res://scenes/bullet/bullet.tscn" id="1_a54uy"]
|
||||
[ext_resource type="Script" uid="uid://58udf4vhqogw" path="res://scenes/bullet/bulletMinigun/bulletMinigun.gd" id="2_4u8er"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfwyw1sr6x2np" path="res://icon.svg" id="3_xaefx"]
|
||||
|
||||
[node name="BulletMinigun" instance=ExtResource("1_a54uy")]
|
||||
script = ExtResource("2_4u8er")
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(4.76837e-07, 3.41061e-13)
|
||||
scale = Vector2(0.25, 0.25)
|
||||
texture = ExtResource("3_xaefx")
|
||||
|
||||
[editable path="DamageArea"]
|
||||
3
scenes/bullet/bulletPool.tscn
Normal file
3
scenes/bullet/bulletPool.tscn
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[gd_scene format=3 uid="uid://dm0rd88xd5m7k"]
|
||||
|
||||
[node name="bulletPool" type="Node2D" groups=["bulletPool"]]
|
||||
1
scenes/bullet/bulletRailgun/bulletRailgun.gd
Normal file
1
scenes/bullet/bulletRailgun/bulletRailgun.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
class_name BulletRailgun extends "res://scenes/bullet/bullet.gd"
|
||||
1
scenes/bullet/bulletRailgun/bulletRailgun.gd.uid
Normal file
1
scenes/bullet/bulletRailgun/bulletRailgun.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b884kxhja5sib
|
||||
9
scenes/bullet/bulletRailgun/bulletRailgun.tscn
Normal file
9
scenes/bullet/bulletRailgun/bulletRailgun.tscn
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://y7lohopyn6bw"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://0ndix1r8v6i1" path="res://scenes/bullet/bullet.tscn" id="1_0cdtm"]
|
||||
[ext_resource type="Script" uid="uid://b884kxhja5sib" path="res://scenes/bullet/bulletRailgun/bulletRailgun.gd" id="2_pmqys"]
|
||||
|
||||
[node name="BulletRailgun" instance=ExtResource("1_0cdtm")]
|
||||
script = ExtResource("2_pmqys")
|
||||
|
||||
[editable path="DamageArea"]
|
||||
1
scenes/bullet/bulletShotgun/bulletShotgun.gd
Normal file
1
scenes/bullet/bulletShotgun/bulletShotgun.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
class_name BulletShotgun extends "res://scenes/bullet/bullet.gd"
|
||||
1
scenes/bullet/bulletShotgun/bulletShotgun.gd.uid
Normal file
1
scenes/bullet/bulletShotgun/bulletShotgun.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ddbv5kpk32diu
|
||||
9
scenes/bullet/bulletShotgun/bulletShotgun.tscn
Normal file
9
scenes/bullet/bulletShotgun/bulletShotgun.tscn
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bye43kihfl72l"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://0ndix1r8v6i1" path="res://scenes/bullet/bullet.tscn" id="1_shfn0"]
|
||||
[ext_resource type="Script" uid="uid://ddbv5kpk32diu" path="res://scenes/bullet/bulletShotgun/bulletShotgun.gd" id="2_mk7vs"]
|
||||
|
||||
[node name="BulletShotgun" instance=ExtResource("1_shfn0")]
|
||||
script = ExtResource("2_mk7vs")
|
||||
|
||||
[editable path="DamageArea"]
|
||||
14
scenes/globals/globals.gd
Normal file
14
scenes/globals/globals.gd
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
extends Node
|
||||
|
||||
var currentDelay: float = 1.0
|
||||
var player: Player = null
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
|
||||
func setPlayer(_player: Player):
|
||||
player = _player
|
||||
|
||||
func getPlayer() -> Player:
|
||||
return player
|
||||
1
scenes/globals/globals.gd.uid
Normal file
1
scenes/globals/globals.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bs4fj70kivyk2
|
||||
50
scenes/main/main.gd
Normal file
50
scenes/main/main.gd
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
extends Node2D
|
||||
|
||||
@onready var timeGhost = preload("res://scenes/spaceShip/timeGhost/timeghost.tscn")
|
||||
@onready var minigun = preload("res://scenes/weapon/minigun/minigun.tscn")
|
||||
@onready var railgun = preload("res://scenes/weapon/railgun/railgun.tscn")
|
||||
@onready var shotgun = preload("res://scenes/weapon/shotgun/shotgun.tscn")
|
||||
|
||||
@onready var obstaclePool = $obstaclePool
|
||||
@onready var enemyPool = $enemyPool
|
||||
@onready var enemySpawnTimer = $spawnTimer/enemySpawnTimer
|
||||
@onready var obstaclesSpawnTimer = $spawnTimer/obstaclesSpawnTimer
|
||||
|
||||
@onready var enemy: PackedScene = preload("res://scenes/spaceShip/enemy/enemy.tscn")
|
||||
@onready var obstacle: PackedScene = preload("res://scenes/obstacle/meteor/meteor.tscn")
|
||||
|
||||
|
||||
@onready var player = $Player
|
||||
|
||||
func _ready() -> void:
|
||||
Globals.setPlayer(player)
|
||||
player.changeWeapon(shotgun)
|
||||
|
||||
for i in range(1, 10):
|
||||
addGhost()
|
||||
|
||||
|
||||
|
||||
|
||||
func addGhost():
|
||||
var ghost = timeGhost.instantiate()
|
||||
add_child(ghost)
|
||||
player.addTimeGhost(ghost)
|
||||
|
||||
func spawnObstacle(_obstacle: PackedScene, _position: Vector2):
|
||||
var newObstacle = _obstacle.instantiate()
|
||||
newObstacle.global_position = _position
|
||||
obstaclePool.add_child(newObstacle)
|
||||
|
||||
func spawnEnemy(_enemy: PackedScene, _position: Vector2):
|
||||
var newEnemy = _enemy.instantiate()
|
||||
newEnemy.global_position = _position
|
||||
enemyPool.add_child(newEnemy)
|
||||
|
||||
func _on_enemy_spawn_timer_timeout() -> void:
|
||||
spawnEnemy(enemy, Globals.getPlayer().getRandomSpawnPointPosition())
|
||||
for i in enemyPool.get_children():
|
||||
i.changeWeapon(shotgun)
|
||||
|
||||
func _on_obstacles_spawn_timer_timeout() -> void:
|
||||
spawnObstacle(obstacle, Globals.getPlayer().getRandomSpawnPointPosition())
|
||||
1
scenes/main/main.gd.uid
Normal file
1
scenes/main/main.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cvoco1axom40
|
||||
39
scenes/main/main.tscn
Normal file
39
scenes/main/main.tscn
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://cfculwiy7mtdc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cvoco1axom40" path="res://scenes/main/main.gd" id="1_kdt4m"]
|
||||
[ext_resource type="PackedScene" uid="uid://bmc2exqutt6vu" path="res://scenes/spaceShip/player/player.tscn" id="2_ia3nl"]
|
||||
[ext_resource type="PackedScene" uid="uid://dm0rd88xd5m7k" path="res://scenes/bullet/bulletPool.tscn" id="3_2s0fe"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfwyw1sr6x2np" path="res://icon.svg" id="4_r8qeh"]
|
||||
|
||||
[node name="main" type="Node2D"]
|
||||
script = ExtResource("1_kdt4m")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
modulate = Color(0.605274, 0.605274, 0.605274, 1)
|
||||
offset_left = -11272.0
|
||||
offset_top = -6736.0
|
||||
offset_right = 12152.0
|
||||
offset_bottom = 7008.0
|
||||
texture = ExtResource("4_r8qeh")
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("2_ia3nl")]
|
||||
spawnDistance = 1000
|
||||
|
||||
[node name="bulletPool" parent="." instance=ExtResource("3_2s0fe")]
|
||||
|
||||
[node name="obstaclePool" type="Node2D" parent="."]
|
||||
|
||||
[node name="enemyPool" type="Node2D" parent="."]
|
||||
|
||||
[node name="spawnTimer" type="Node" parent="."]
|
||||
|
||||
[node name="enemySpawnTimer" type="Timer" parent="spawnTimer"]
|
||||
wait_time = 10.0
|
||||
autostart = true
|
||||
|
||||
[node name="obstaclesSpawnTimer" type="Timer" parent="spawnTimer"]
|
||||
autostart = true
|
||||
|
||||
[connection signal="timeout" from="spawnTimer/enemySpawnTimer" to="." method="_on_enemy_spawn_timer_timeout"]
|
||||
[connection signal="timeout" from="spawnTimer/obstaclesSpawnTimer" to="." method="_on_obstacles_spawn_timer_timeout"]
|
||||
18
scenes/obstacle/meteor/meteor.gd
Normal file
18
scenes/obstacle/meteor/meteor.gd
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
class_name Meteor extends "res://scenes/obstacle/obstacle.gd"
|
||||
|
||||
@export var minSpeed: int = 100
|
||||
@export var maxSpeed: int = 1000
|
||||
|
||||
var speed: int = 1000
|
||||
var direction: int
|
||||
|
||||
func _init() -> void:
|
||||
var rng = RandomNumberGenerator.new()
|
||||
direction = rng.randi_range(0, 360)
|
||||
speed = rng.randi_range(minSpeed, maxSpeed)
|
||||
rotation = direction
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
velocity = Vector2.UP.rotated(direction).normalized() * speed
|
||||
move_and_slide()
|
||||
1
scenes/obstacle/meteor/meteor.gd.uid
Normal file
1
scenes/obstacle/meteor/meteor.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b82cnxsh4mn0f
|
||||
36
scenes/obstacle/meteor/meteor.tscn
Normal file
36
scenes/obstacle/meteor/meteor.tscn
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://vl8duuwwrpqm"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cgqo1nxq6xprm" path="res://scenes/obstacle/obstacle.tscn" id="1_skd46"]
|
||||
[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
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_jb48p"]
|
||||
radius = 64.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_pganv"]
|
||||
radius = 64.0
|
||||
|
||||
[node name="Meteor" instance=ExtResource("1_skd46")]
|
||||
modulate = Color(1, 0, 0, 1)
|
||||
script = ExtResource("2_8c34n")
|
||||
minSpeed = 100
|
||||
maxSpeed = 1000
|
||||
health = 10
|
||||
|
||||
[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"]
|
||||
shape = SubResource("CircleShape2D_pganv")
|
||||
|
||||
[node name="Sprite2D" parent="." index="3"]
|
||||
texture = ExtResource("3_jb48p")
|
||||
|
||||
[editable path="DamageArea"]
|
||||
[editable path="hurtArea"]
|
||||
31
scenes/obstacle/obstacle.gd
Normal file
31
scenes/obstacle/obstacle.gd
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
class_name Obstacle extends CharacterBody2D
|
||||
|
||||
@onready var sprite = $Sprite2D
|
||||
@onready var lifeTimeTimer = $lifeTimeTimer
|
||||
|
||||
@export var damage: int = 10
|
||||
@export var health: int = 1
|
||||
@export var minHealth: int = 1
|
||||
@export var maxHealth: int = 1
|
||||
@export var lifeTime: int = 600
|
||||
|
||||
func _ready() -> void:
|
||||
lifeTimeTimer.start(lifeTime)
|
||||
health += damage
|
||||
|
||||
func spawn(damage: int):
|
||||
pass
|
||||
|
||||
|
||||
func _on_hurt_area_hurt(amount: int) -> void:
|
||||
hurt(amount)
|
||||
|
||||
func hurt(amount: int):
|
||||
if health - amount <= minHealth:
|
||||
queue_free()
|
||||
else:
|
||||
health -= amount
|
||||
|
||||
|
||||
func _on_life_time_timer_timeout() -> void:
|
||||
queue_free()
|
||||
1
scenes/obstacle/obstacle.gd.uid
Normal file
1
scenes/obstacle/obstacle.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://iu7hvfpevs65
|
||||
27
scenes/obstacle/obstacle.tscn
Normal file
27
scenes/obstacle/obstacle.tscn
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
[gd_scene load_steps=4 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"]
|
||||
|
||||
[node name="Obstacle" type="CharacterBody2D" groups=["obstacle"]]
|
||||
collision_layer = 2
|
||||
collision_mask = 46
|
||||
script = ExtResource("1_osovj")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
||||
[node name="DamageArea" parent="." instance=ExtResource("1_1ys07")]
|
||||
|
||||
[node name="hurtArea" parent="." instance=ExtResource("2_osovj")]
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
|
||||
[node name="lifeTimeTimer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
[connection signal="hurt" from="hurtArea" to="." method="_on_hurt_area_hurt"]
|
||||
[connection signal="timeout" from="lifeTimeTimer" to="." method="_on_life_time_timer_timeout"]
|
||||
|
||||
[editable path="DamageArea"]
|
||||
[editable path="hurtArea"]
|
||||
22
scenes/spaceShip/enemy/enemy.gd
Normal file
22
scenes/spaceShip/enemy/enemy.gd
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
class_name Enemy extends "res://scenes/spaceShip/spaceShip.gd"
|
||||
|
||||
@onready var visionAreaStop: VisionArea = $VisionAreas/VisionAreaStop
|
||||
@onready var raycast: RayCast2D = $RayCast2D
|
||||
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if Globals.getPlayer() != null:
|
||||
look_at(Globals.getPlayer().global_position)
|
||||
var direction = Vector2.RIGHT.rotated(rotation)
|
||||
rotation += PI / 2
|
||||
if not visionAreaStop.has_overlapping_bodies():
|
||||
velocity = velocity.lerp(direction * speed, acceleration * delta)
|
||||
else:
|
||||
if not raycast.is_colliding():
|
||||
attack()
|
||||
velocity = velocity.lerp(Vector2.ZERO, acceleration * delta)
|
||||
move_and_slide()
|
||||
|
||||
func _on_hurt_area_hurt(amount: int) -> void:
|
||||
damage(amount)
|
||||
1
scenes/spaceShip/enemy/enemy.gd.uid
Normal file
1
scenes/spaceShip/enemy/enemy.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://djlqf2g8ho05r
|
||||
46
scenes/spaceShip/enemy/enemy.tscn
Normal file
46
scenes/spaceShip/enemy/enemy.tscn
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://bodpgjdjhfn4w"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://csacin2gx2tum" path="res://scenes/spaceShip/spaceShip.tscn" id="1_5w6ng"]
|
||||
[ext_resource type="Script" uid="uid://djlqf2g8ho05r" path="res://scenes/spaceShip/enemy/enemy.gd" id="2_2erf0"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfwyw1sr6x2np" path="res://icon.svg" id="2_u13ds"]
|
||||
[ext_resource type="PackedScene" uid="uid://k5fr6bfn6kkd" path="res://scenes/spaceShip/enemy/visionArea/visionArea.tscn" id="4_hybmu"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2erf0"]
|
||||
size = Vector2(112, 112)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_u13ds"]
|
||||
size = Vector2(112, 112)
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_hybmu"]
|
||||
radius = 448.071
|
||||
|
||||
[node name="Enemy" groups=["enemy"] instance=ExtResource("1_5w6ng")]
|
||||
modulate = Color(1, 0, 1, 1)
|
||||
collision_layer = 36
|
||||
collision_mask = 35
|
||||
script = ExtResource("2_2erf0")
|
||||
speed = 700
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource("RectangleShape2D_2erf0")
|
||||
|
||||
[node name="CollisionShape2D" parent="hurtArea" index="0"]
|
||||
shape = SubResource("RectangleShape2D_u13ds")
|
||||
|
||||
[node name="Sprite2D" parent="." index="2"]
|
||||
texture = ExtResource("2_u13ds")
|
||||
|
||||
[node name="VisionAreas" type="Node2D" parent="." index="5"]
|
||||
|
||||
[node name="VisionAreaStop" parent="VisionAreas" index="0" instance=ExtResource("4_hybmu")]
|
||||
|
||||
[node name="CollisionShape2D" parent="VisionAreas/VisionAreaStop" index="0"]
|
||||
shape = SubResource("CircleShape2D_hybmu")
|
||||
|
||||
[node name="RayCast2D" type="RayCast2D" parent="." index="6"]
|
||||
target_position = Vector2(0, -448)
|
||||
|
||||
[connection signal="hurt" from="hurtArea" to="." method="_on_hurt_area_hurt"]
|
||||
|
||||
[editable path="hurtArea"]
|
||||
[editable path="VisionAreas/VisionAreaStop"]
|
||||
10
scenes/spaceShip/enemy/visionArea/visionArea.tscn
Normal file
10
scenes/spaceShip/enemy/visionArea/visionArea.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://k5fr6bfn6kkd"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cuaw6yqjnk70w" path="res://scenes/spaceShip/enemy/visionArea/vision_area.gd" id="1_4ovtj"]
|
||||
|
||||
[node name="VisionArea" type="Area2D"]
|
||||
collision_layer = 64
|
||||
collision_mask = 8
|
||||
script = ExtResource("1_4ovtj")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
1
scenes/spaceShip/enemy/visionArea/vision_area.gd
Normal file
1
scenes/spaceShip/enemy/visionArea/vision_area.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
class_name VisionArea extends Area2D
|
||||
1
scenes/spaceShip/enemy/visionArea/vision_area.gd.uid
Normal file
1
scenes/spaceShip/enemy/visionArea/vision_area.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cuaw6yqjnk70w
|
||||
42
scenes/spaceShip/player/player.gd
Normal file
42
scenes/spaceShip/player/player.gd
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
class_name Player extends "res://scenes/spaceShip/spaceShip.gd"
|
||||
|
||||
@onready var dashCooldown = $dashCooldown
|
||||
@onready var spawnPointPool = $spawnPointPool
|
||||
|
||||
@export var spawnDistance: int = 1000
|
||||
|
||||
func _ready() -> void:
|
||||
randomize()
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
pass
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if Input.is_action_pressed("attack"):
|
||||
attack()
|
||||
|
||||
look_at(get_global_mouse_position())
|
||||
rotation += PI / 2
|
||||
var direction = Input.get_vector("moveLeft", "moveRight", "moveForward", "moveBackward").normalized().rotated(rotation)
|
||||
if Input.is_action_just_pressed("dash") and dashCooldown.is_stopped():
|
||||
dash()
|
||||
velocity = velocity.lerp(direction * speed, acceleration * delta)
|
||||
move_and_slide()
|
||||
if timeGhost != null:
|
||||
moveTimeGhost(global_position, rotation)
|
||||
|
||||
|
||||
func _on_hurt_area_hurt(amount: int) -> void:
|
||||
damage(amount)
|
||||
|
||||
func dash():
|
||||
dashCooldown.start()
|
||||
global_position += Vector2.UP.rotated(rotation) * 1000
|
||||
|
||||
func getRandomSpawnPointPosition() -> Vector2:
|
||||
var rng = RandomNumberGenerator.new()
|
||||
print(deg_to_rad(rng.randi_range(0, 360)))
|
||||
print(Vector2.UP.rotated(deg_to_rad(rng.randi_range(0, 360))) * spawnDistance)
|
||||
return global_position + Vector2.UP.rotated(deg_to_rad(rng.randi_range(0, 360))) * spawnDistance
|
||||
#return spawnPointPool.get_children()[rng.randi_range(0, spawnPointPool.get_children().size()-1)].global_position
|
||||
1
scenes/spaceShip/player/player.gd.uid
Normal file
1
scenes/spaceShip/player/player.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://0i8gdbb8f6ic
|
||||
53
scenes/spaceShip/player/player.tscn
Normal file
53
scenes/spaceShip/player/player.tscn
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://bmc2exqutt6vu"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://csacin2gx2tum" path="res://scenes/spaceShip/spaceShip.tscn" id="1_nnn47"]
|
||||
[ext_resource type="Script" uid="uid://0i8gdbb8f6ic" path="res://scenes/spaceShip/player/player.gd" id="2_acneu"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfwyw1sr6x2np" path="res://icon.svg" id="3_0gv45"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_0gv45"]
|
||||
radius = 56.5685
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0gv45"]
|
||||
size = Vector2(112, 112)
|
||||
|
||||
[node name="Player" groups=["player"] instance=ExtResource("1_nnn47")]
|
||||
collision_layer = 12
|
||||
collision_mask = 3
|
||||
motion_mode = 1
|
||||
script = ExtResource("2_acneu")
|
||||
spawnDistance = 1000
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource("CircleShape2D_0gv45")
|
||||
|
||||
[node name="CollisionShape2D" parent="hurtArea" index="0"]
|
||||
shape = SubResource("RectangleShape2D_0gv45")
|
||||
|
||||
[node name="Sprite2D" parent="." index="2"]
|
||||
texture = ExtResource("3_0gv45")
|
||||
|
||||
[node name="dashCooldown" type="Timer" parent="." index="5"]
|
||||
wait_time = 10.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="." index="6"]
|
||||
|
||||
[node name="spawnPointPool" type="Node2D" parent="." index="7"]
|
||||
|
||||
[node name="spawnPoint" type="Marker2D" parent="spawnPointPool" index="0"]
|
||||
position = Vector2(360, -176)
|
||||
|
||||
[node name="spawnPoint2" type="Marker2D" parent="spawnPointPool" index="1"]
|
||||
position = Vector2(392, 256)
|
||||
|
||||
[node name="spawnPoint3" type="Marker2D" parent="spawnPointPool" index="2"]
|
||||
position = Vector2(-416, 224)
|
||||
|
||||
[node name="spawnPoint4" type="Marker2D" parent="spawnPointPool" index="3"]
|
||||
position = Vector2(-408, -168)
|
||||
|
||||
[connection signal="hurt" from="hurtArea" to="." method="_on_hurt_area_hurt"]
|
||||
[connection signal="timeout" from="dashCooldown" to="." method="_on_dash_cooldown_timeout"]
|
||||
|
||||
[editable path="hurtArea"]
|
||||
9
scenes/spaceShip/player/spawnPoint/spawnPoint.tscn
Normal file
9
scenes/spaceShip/player/spawnPoint/spawnPoint.tscn
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://ih6mpdh1paql"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_oytj4"]
|
||||
radius = 64.0
|
||||
|
||||
[node name="SpawnPoint" type="Area2D"]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_oytj4")
|
||||
95
scenes/spaceShip/spaceShip.gd
Normal file
95
scenes/spaceShip/spaceShip.gd
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
class_name Spaceship extends CharacterBody2D
|
||||
|
||||
@onready var hurtArea = $hurtArea
|
||||
@onready var sprite = $Sprite2D
|
||||
@onready var weaponNode = $weaponNode
|
||||
@onready var invincibleTimer = $invincibleTimer
|
||||
|
||||
@export var minHealth: int = 0
|
||||
@export var maxHealth: int = 100
|
||||
@export var health: int = maxHealth
|
||||
|
||||
@export var speed: int = 800
|
||||
@export var acceleration: float = 0.8
|
||||
@export var pushback: int = 500
|
||||
|
||||
@export var timeGhost: TimeGhost = null
|
||||
|
||||
@export var weapon: Weapon = null
|
||||
|
||||
|
||||
@export var invincible: bool = false
|
||||
|
||||
signal destroyed
|
||||
|
||||
func _ready() -> void:
|
||||
invincibleTimer.wait_time = Globals.currentDelay * 3
|
||||
|
||||
func damage(amount: int):
|
||||
if not invincible:
|
||||
if health - amount <= minHealth:
|
||||
if timeGhost == null:
|
||||
emit_signal("destroyed")
|
||||
destroy()
|
||||
health = minHealth
|
||||
shortInvincibility()
|
||||
else:
|
||||
health -= amount
|
||||
|
||||
func heal(amount: int):
|
||||
if health + amount >= maxHealth:
|
||||
health = maxHealth
|
||||
else:
|
||||
health += amount
|
||||
|
||||
func destroy():
|
||||
if timeGhost == null:
|
||||
queue_free()
|
||||
else:
|
||||
timeGhost.destroy()
|
||||
|
||||
func attack():
|
||||
if weapon != null:
|
||||
weapon.attack()
|
||||
await get_tree().create_timer(Globals.currentDelay).timeout
|
||||
if timeGhost != null:
|
||||
timeGhost.attack()
|
||||
|
||||
func moveTimeGhost(_position: Vector2, _rotation: float):
|
||||
await get_tree().create_timer(Globals.currentDelay).timeout
|
||||
if timeGhost != null:
|
||||
timeGhost.global_position = _position
|
||||
timeGhost.rotation = _rotation
|
||||
timeGhost.moveTimeGhost(_position, _rotation)
|
||||
|
||||
func changeWeapon(_weapon: PackedScene):
|
||||
var newWeapon = _weapon.instantiate()
|
||||
for i in weaponNode.get_children():
|
||||
i.queue_free()
|
||||
weaponNode.add_child(newWeapon)
|
||||
weapon = newWeapon
|
||||
await get_tree().create_timer(Globals.currentDelay).timeout
|
||||
if timeGhost != null:
|
||||
timeGhost.changeWeapon(_weapon)
|
||||
|
||||
func addTimeGhost(_timeGhost: TimeGhost):
|
||||
if timeGhost == null:
|
||||
timeGhost = _timeGhost
|
||||
timeGhost.setSpaceship(self)
|
||||
else:
|
||||
timeGhost.addTimeGhost(_timeGhost)
|
||||
|
||||
func shortInvincibility():
|
||||
if invincibleTimer.is_stopped():
|
||||
invincible = true
|
||||
invincibleTimer.start()
|
||||
|
||||
|
||||
func _on_invincible_timer_timeout() -> void:
|
||||
invincible = false
|
||||
|
||||
|
||||
func _on_hurt_area_area_entered(area: Area2D) -> void:
|
||||
if area.get_parent().is_in_group("obstacle"):
|
||||
velocity = Vector2.UP.rotated(rotation) * -pushback
|
||||
area.get_parent().queue_free()
|
||||
1
scenes/spaceShip/spaceShip.gd.uid
Normal file
1
scenes/spaceShip/spaceShip.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://quxft75411y7
|
||||
23
scenes/spaceShip/spaceShip.tscn
Normal file
23
scenes/spaceShip/spaceShip.tscn
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://csacin2gx2tum"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://quxft75411y7" path="res://scenes/spaceShip/spaceShip.gd" id="1_a2e5l"]
|
||||
[ext_resource type="PackedScene" uid="uid://cglnd1ekr5u6r" path="res://scenes/areas/hurtArea/hurtArea.tscn" id="2_b8guf"]
|
||||
|
||||
[node name="Spaceship" type="CharacterBody2D" groups=["spaceShip"]]
|
||||
collision_layer = 4
|
||||
script = ExtResource("1_a2e5l")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
||||
[node name="hurtArea" parent="." instance=ExtResource("2_b8guf")]
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
|
||||
[node name="weaponNode" type="Node2D" parent="."]
|
||||
|
||||
[node name="invincibleTimer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[connection signal="area_entered" from="hurtArea" to="." method="_on_hurt_area_area_entered"]
|
||||
[connection signal="timeout" from="invincibleTimer" to="." method="_on_invincible_timer_timeout"]
|
||||
17
scenes/spaceShip/timeGhost/timeghost.gd
Normal file
17
scenes/spaceShip/timeGhost/timeghost.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
class_name TimeGhost extends "res://scenes/spaceShip/spaceShip.gd"
|
||||
|
||||
@export var spaceShip: Spaceship = null
|
||||
|
||||
#func _init(_speed: int, _acceleration: float) -> void:
|
||||
# speed = _speed
|
||||
#acceleration = _acceleration
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
move_and_slide()
|
||||
|
||||
func setSpaceship(_spaceShip: Spaceship):
|
||||
spaceShip = _spaceShip
|
||||
speed = spaceShip.speed
|
||||
acceleration = spaceShip.acceleration
|
||||
global_position = spaceShip.global_position
|
||||
sprite.texture = spaceShip.sprite.texture
|
||||
1
scenes/spaceShip/timeGhost/timeghost.gd.uid
Normal file
1
scenes/spaceShip/timeGhost/timeghost.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://m3hn5tl2nidk
|
||||
33
scenes/spaceShip/timeGhost/timeghost.tscn
Normal file
33
scenes/spaceShip/timeGhost/timeghost.tscn
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://dms0cw7opfd64"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://csacin2gx2tum" path="res://scenes/spaceShip/spaceShip.tscn" id="1_bm7fr"]
|
||||
[ext_resource type="Script" uid="uid://m3hn5tl2nidk" path="res://scenes/spaceShip/timeGhost/timeghost.gd" id="2_57067"]
|
||||
[ext_resource type="PackedScene" uid="uid://eqo7k2ronf8k" path="res://scenes/areas/damageArea/damageArea.tscn" id="3_5nmba"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5nmba"]
|
||||
size = Vector2(50, 50)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_m3s7j"]
|
||||
size = Vector2(50, 50)
|
||||
|
||||
[node name="Timeghost" groups=["timeGhost"] instance=ExtResource("1_bm7fr")]
|
||||
modulate = Color(0, 1, 1, 1)
|
||||
collision_layer = 20
|
||||
script = ExtResource("2_57067")
|
||||
invincible = true
|
||||
|
||||
[node name="CollisionShape2D" parent="." index="0"]
|
||||
shape = SubResource("RectangleShape2D_5nmba")
|
||||
disabled = true
|
||||
|
||||
[node name="hurtArea" parent="." index="1"]
|
||||
visible = false
|
||||
|
||||
[node name="DamageArea" parent="." index="4" instance=ExtResource("3_5nmba")]
|
||||
damage = 10
|
||||
|
||||
[node name="CollisionShape2D" parent="DamageArea" index="0"]
|
||||
shape = SubResource("RectangleShape2D_m3s7j")
|
||||
disabled = true
|
||||
|
||||
[editable path="DamageArea"]
|
||||
4
scenes/upgrade/upgrade.gd
Normal file
4
scenes/upgrade/upgrade.gd
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
class_name Upgrade extends Node2D
|
||||
|
||||
@onready var upgradeName: String = ""
|
||||
@onready var description: String = ""
|
||||
1
scenes/upgrade/upgrade.gd.uid
Normal file
1
scenes/upgrade/upgrade.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dww2ci11ovsub
|
||||
8
scenes/upgrade/upgrade.tscn
Normal file
8
scenes/upgrade/upgrade.tscn
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://bvr0ors52rcax"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dww2ci11ovsub" path="res://scenes/upgrade/upgrade.gd" id="1_6bmsu"]
|
||||
|
||||
[node name="Upgrade" type="Node2D"]
|
||||
script = ExtResource("1_6bmsu")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
14
scenes/weapon/minigun/minigun.gd
Normal file
14
scenes/weapon/minigun/minigun.gd
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
class_name Minigun extends "res://scenes/weapon/weapon.gd"
|
||||
|
||||
@onready var bullet = preload("res://scenes/bullet/bulletMinigun/bulletMinigun.tscn" )
|
||||
|
||||
func attack():
|
||||
if cooldownTimer.is_stopped():
|
||||
print(getSpread())
|
||||
spawnBullet()
|
||||
cooldownTimer.start(cooldown)
|
||||
|
||||
func spawnBullet():
|
||||
var newBullet = bullet.instantiate()
|
||||
get_tree().get_first_node_in_group("bulletPool").add_child(newBullet)
|
||||
newBullet.spawn(bulletPoint.global_position, get_parent().get_parent().rotation + getSpread(), damage, range, penetration)
|
||||
1
scenes/weapon/minigun/minigun.gd.uid
Normal file
1
scenes/weapon/minigun/minigun.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bxedwccs1lj6j
|
||||
7
scenes/weapon/minigun/minigun.tscn
Normal file
7
scenes/weapon/minigun/minigun.tscn
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://c6lpcf6nk7f3s"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://btyuxgfn12p1y" path="res://scenes/weapon/weapon.tscn" id="1_dt38b"]
|
||||
[ext_resource type="Script" uid="uid://bxedwccs1lj6j" path="res://scenes/weapon/minigun/minigun.gd" id="2_u46t0"]
|
||||
|
||||
[node name="Minigun" instance=ExtResource("1_dt38b")]
|
||||
script = ExtResource("2_u46t0")
|
||||
14
scenes/weapon/railgun/railgun.gd
Normal file
14
scenes/weapon/railgun/railgun.gd
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
class_name Railgun extends "res://scenes/weapon/weapon.gd"
|
||||
|
||||
@onready var bullet = preload("res://scenes/bullet/bulletRailgun/bulletRailgun.tscn")
|
||||
|
||||
func attack():
|
||||
if cooldownTimer.is_stopped():
|
||||
spawnBullet()
|
||||
cooldownTimer.start(cooldown)
|
||||
|
||||
func spawnBullet():
|
||||
var newBullet = bullet.instantiate()
|
||||
newBullet.spawn(bulletPoint.global_position, get_parent().get_parent().rotation, damage, penetration)
|
||||
|
||||
get_tree().get_first_node_in_group("bulletPool").add_child(newBullet)
|
||||
1
scenes/weapon/railgun/railgun.gd.uid
Normal file
1
scenes/weapon/railgun/railgun.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dth0orslxriyp
|
||||
13
scenes/weapon/railgun/railgun.tscn
Normal file
13
scenes/weapon/railgun/railgun.tscn
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bm2e5fwynwur8"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://btyuxgfn12p1y" path="res://scenes/weapon/weapon.tscn" id="1_lb4uk"]
|
||||
[ext_resource type="Script" uid="uid://dth0orslxriyp" path="res://scenes/weapon/railgun/railgun.gd" id="2_ur8td"]
|
||||
|
||||
[node name="Railgun" instance=ExtResource("1_lb4uk")]
|
||||
script = ExtResource("2_ur8td")
|
||||
damage = 10
|
||||
cooldown = 10.0
|
||||
penetration = 5
|
||||
|
||||
[node name="cooldownTimer" parent="." index="0"]
|
||||
wait_time = 10.0
|
||||
18
scenes/weapon/shotgun/shotgun.gd
Normal file
18
scenes/weapon/shotgun/shotgun.gd
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
class_name Shotgun extends "res://scenes/weapon/weapon.gd"
|
||||
|
||||
@onready var bullet = preload("res://scenes/bullet/bulletShotgun/bulletShotgun.tscn")
|
||||
|
||||
@export var bulletAmount: int = 5
|
||||
|
||||
func attack():
|
||||
if cooldownTimer.is_stopped():
|
||||
spawnBullet()
|
||||
cooldownTimer.start(cooldown)
|
||||
|
||||
func spawnBullet():
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
for i in range(0, bulletAmount):
|
||||
var newBullet = bullet.instantiate()
|
||||
newBullet.spawn(bulletPoint.global_position, get_parent().get_parent().rotation + getSpread(), damage, range, penetration)
|
||||
get_tree().get_first_node_in_group("bulletPool").add_child(newBullet)
|
||||
1
scenes/weapon/shotgun/shotgun.gd.uid
Normal file
1
scenes/weapon/shotgun/shotgun.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c3temu27a4onl
|
||||
12
scenes/weapon/shotgun/shotgun.tscn
Normal file
12
scenes/weapon/shotgun/shotgun.tscn
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bpys0cnyfwcun"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://btyuxgfn12p1y" path="res://scenes/weapon/weapon.tscn" id="1_qorbs"]
|
||||
[ext_resource type="Script" uid="uid://c3temu27a4onl" path="res://scenes/weapon/shotgun/shotgun.gd" id="2_p550e"]
|
||||
|
||||
[node name="Shotgun" instance=ExtResource("1_qorbs")]
|
||||
script = ExtResource("2_p550e")
|
||||
bulletAmount = 10
|
||||
damage = 2
|
||||
cooldown = 0.5
|
||||
spread = 0.8
|
||||
range = 0.3
|
||||
20
scenes/weapon/weapon.gd
Normal file
20
scenes/weapon/weapon.gd
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
class_name Weapon extends Node2D
|
||||
|
||||
@onready var bulletPoint = $BulletPoint
|
||||
@onready var cooldownTimer = $cooldownTimer
|
||||
|
||||
@export var damage: int = 1
|
||||
@export var cooldown: float = 0.1
|
||||
@export var penetration: int = 1
|
||||
@export var spread: float = 0.1
|
||||
@export var range: float = 8.0
|
||||
|
||||
func attack():
|
||||
randomize()
|
||||
if cooldownTimer.is_stopped():
|
||||
cooldownTimer.start(cooldown)
|
||||
|
||||
|
||||
func getSpread() -> float:
|
||||
var rng = RandomNumberGenerator.new()
|
||||
return rng.randf_range(-spread, spread)
|
||||
1
scenes/weapon/weapon.gd.uid
Normal file
1
scenes/weapon/weapon.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dpfc01642pwq0
|
||||
12
scenes/weapon/weapon.tscn
Normal file
12
scenes/weapon/weapon.tscn
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://btyuxgfn12p1y"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dpfc01642pwq0" path="res://scenes/weapon/weapon.gd" id="1_l3xq3"]
|
||||
|
||||
[node name="Weapon" type="Node2D" groups=["weapon"]]
|
||||
script = ExtResource("1_l3xq3")
|
||||
|
||||
[node name="cooldownTimer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
[node name="BulletPoint" type="Marker2D" parent="."]
|
||||
position = Vector2(0, -128)
|
||||
13
translation/messages.pot
Normal file
13
translation/messages.pot
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Don't remove the two lines below, they're required for gettext to work correctly.
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 3.6\n"
|
||||
Loading…
Add table
Add a link
Reference in a new issue