├── .gitignore ├── Bullet.gd ├── Bullet.tscn ├── Enemy.gd ├── Enemy.tscn ├── Main.tscn ├── default_env.tres ├── icon.png ├── icon.png.import └── project.godot /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Godot-specific ignores 3 | .import/ 4 | export.cfg 5 | export_presets.cfg 6 | 7 | # Mono-specific ignores 8 | .mono/ 9 | data_*/ 10 | -------------------------------------------------------------------------------- /Bullet.gd: -------------------------------------------------------------------------------- 1 | extends Node2D 2 | 3 | const speed = 100 4 | 5 | func _process(delta): 6 | position += transform.x * speed * delta 7 | 8 | 9 | func _on_KillTimer_timeout() -> void: 10 | queue_free() 11 | -------------------------------------------------------------------------------- /Bullet.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=2] 2 | 3 | [ext_resource path="res://Bullet.gd" type="Script" id=1] 4 | [ext_resource path="res://icon.png" type="Texture" id=2] 5 | 6 | [node name="Bullet" type="Node2D"] 7 | position = Vector2( 76.6947, 53.4539 ) 8 | script = ExtResource( 1 ) 9 | __meta__ = { 10 | "_edit_group_": true 11 | } 12 | 13 | [node name="Sprite" type="Sprite" parent="."] 14 | scale = Vector2( 0.4, 0.4 ) 15 | texture = ExtResource( 2 ) 16 | 17 | [node name="KillTimer" type="Timer" parent="."] 18 | wait_time = 10.0 19 | autostart = true 20 | [connection signal="timeout" from="KillTimer" to="." method="_on_KillTimer_timeout"] 21 | -------------------------------------------------------------------------------- /Enemy.gd: -------------------------------------------------------------------------------- 1 | extends Node2D 2 | 3 | const bullet_scene = preload("res://Bullet.tscn") 4 | onready var shoot_timer = $ShootTimer 5 | onready var rotater = $Rotater 6 | 7 | const rotate_speed = 100 8 | const shoot_timer_wait_time = 0.2 9 | const spawn_point_count = 4 10 | const radius = 100 11 | 12 | func _ready(): 13 | var step = 2 * PI / spawn_point_count 14 | 15 | for i in range(spawn_point_count): 16 | var spawn_point = Node2D.new() 17 | var pos = Vector2(radius, 0).rotated(step * i) 18 | spawn_point.position = pos 19 | spawn_point.rotation = pos.angle() 20 | rotater.add_child(spawn_point) 21 | 22 | shoot_timer.wait_time = shoot_timer_wait_time 23 | shoot_timer.start() 24 | 25 | 26 | func _process(delta): 27 | var new_rotation = rotater.rotation_degrees + rotate_speed * delta 28 | rotater.rotation_degrees = fmod(new_rotation, 360) 29 | 30 | 31 | func _on_ShootTimer_timeout() -> void: 32 | for s in rotater.get_children(): 33 | var bullet = bullet_scene.instance() 34 | get_tree().root.add_child(bullet) 35 | bullet.position = s.global_position 36 | bullet.rotation = s.global_rotation 37 | 38 | 39 | -------------------------------------------------------------------------------- /Enemy.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=2] 2 | 3 | [ext_resource path="res://Enemy.gd" type="Script" id=1] 4 | [ext_resource path="res://icon.png" type="Texture" id=2] 5 | 6 | [node name="Enemy" type="Node2D"] 7 | scale = Vector2( 0.8, 0.8 ) 8 | script = ExtResource( 1 ) 9 | 10 | [node name="Sprite" type="Sprite" parent="."] 11 | scale = Vector2( 2, 2 ) 12 | texture = ExtResource( 2 ) 13 | 14 | [node name="ShootTimer" type="Timer" parent="."] 15 | 16 | [node name="Rotater" type="Sprite" parent="."] 17 | visible = false 18 | texture = ExtResource( 2 ) 19 | [connection signal="timeout" from="ShootTimer" to="." method="_on_ShootTimer_timeout"] 20 | -------------------------------------------------------------------------------- /Main.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=2 format=2] 2 | 3 | [ext_resource path="res://Enemy.tscn" type="PackedScene" id=1] 4 | 5 | [node name="Node" type="Node"] 6 | 7 | [node name="Enemy" parent="." instance=ExtResource( 1 )] 8 | position = Vector2( 640, 360 ) 9 | -------------------------------------------------------------------------------- /default_env.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Environment" load_steps=2 format=2] 2 | 3 | [sub_resource type="ProceduralSky" id=1] 4 | 5 | [resource] 6 | background_mode = 2 7 | background_sky = SubResource( 1 ) 8 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/robyn3choi/godot-tutorial_bullet-hell-pattern-generator/e961340013f4615ebe4ab6b6bb11957d66a7751f/icon.png -------------------------------------------------------------------------------- /icon.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://icon.png" 13 | dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /project.godot: -------------------------------------------------------------------------------- 1 | ; Engine configuration file. 2 | ; It's best edited using the editor UI and not directly, 3 | ; since the parameters that go here are not all obvious. 4 | ; 5 | ; Format: 6 | ; [section] ; section goes between [] 7 | ; param=value ; assign values to parameters 8 | 9 | config_version=4 10 | 11 | _global_script_classes=[ ] 12 | _global_script_class_icons={ 13 | 14 | } 15 | 16 | [application] 17 | 18 | config/name="bullet-hell-pattern-generator" 19 | run/main_scene="res://Main.tscn" 20 | config/icon="res://icon.png" 21 | 22 | [display] 23 | 24 | window/size/width=1280 25 | window/size/height=720 26 | window/stretch/mode="2d" 27 | window/stretch/aspect="keep_width" 28 | 29 | [rendering] 30 | 31 | environment/default_environment="res://default_env.tres" 32 | --------------------------------------------------------------------------------