Skip to content

Commit

Permalink
ci:add gdlint
Browse files Browse the repository at this point in the history
  • Loading branch information
limuy2022 committed Jul 10, 2024
1 parent 989ab31 commit f834d4b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 30 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/gdfmt.yml → .github/workflows/gdcheck.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: GdScriptfmtCheck
name: GdScriptCheck

on:
push:
Expand All @@ -17,5 +17,7 @@ jobs:
- uses: actions/checkout@v4
- name: Install GdFmt
run: pip3 install "gdtoolkit==4.*"
- name: Check
- name: Format Check
run: gdformat . -c
- name: Linter Check
run: gdlint .
45 changes: 24 additions & 21 deletions scenes/bullets/seedler/seedler_nut.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ func throw():
move.tween_property(self, "position", position + Vector2(0, 6500), 3)


func throw_shot_beam(area: Area2D):
func throw_shot_beam(_area: Area2D):
#if area.name != "down"
#return
const times = 4
const TIMES = 4
var beams: Array[Area2D] = []
var velocity = [
Vector2(-50, -650),
Vector2(-30, -750),
Vector2(50, -650),
Vector2(30, -750),
]
for i in range(times):
for i in range(TIMES):
beams.push_back(thorns.instantiate())
beams[i].is_fall = true
beams[i].position = position
Expand All @@ -39,67 +39,70 @@ func throw_shot_beam(area: Area2D):
# 启动爆炸动作
# 大小中等, 原地旋转, 爆炸
func burst(pos: Vector2):
const time = 0.8
const TIME = 0.8
# TAU / s
const speed = 1.5 * TAU
const SPEED = 1.5 * TAU
position = pos
scale = Vector2(1.5, 1.5)
var tween = create_tween()
tween.tween_property(self, "rotation", rotation + speed * time, time)
tween.tween_property(self, "rotation", rotation + SPEED * TIME, TIME)
tween.tween_callback(burst_shot_beam)
tween.tween_callback(queue_free)


func burst_shot_beam():
const times = 15
const TIMES = 15
var beams: Array[Area2D] = []
for i in range(times):
for i in range(TIMES):
beams.push_back(thorns.instantiate())
beams[i].is_fall = false
beams[i].position = position
var rad = TAU / times * i + (TAU / 12 if i % 2 == 0 else -TAU / 12)
var rad = TAU / TIMES * i + (TAU / 12 if i % 2 == 0 else -TAU / 12)
beams[i].rotation = rad
beams[i].velocity = Vector2(sin(rad), cos(rad)) * 800
for beam in beams:
get_parent().add_child(beam)


# 启动超级爆炸
# 最大, 原地旋转
func super_burst(pos : Vector2):
const time = 0.8
const wait_time = 0.65
func super_burst(pos: Vector2):
const TIME = 0.8
const WAIT_TIME = 0.65
# TAU / s
const speed = 1.5 * TAU
const SPEED = 1.5 * TAU
position = pos
scale = Vector2(2, 2)
var tween = create_tween()
tween.tween_property(self, "rotation", rotation + speed * time, time)
tween.tween_property(self, "rotation", rotation + SPEED * TIME, TIME)
tween.tween_callback(super_burst_shot_beam.bind())
tween.tween_interval(wait_time)
tween.tween_interval(WAIT_TIME)
tween.tween_callback(queue_free)


func super_burst_shot_beam():
const times = 12
const num = 6
for j in range(num):
const TIMES = 12
const NUM = 6
for j in range(NUM):
print("aaa")
var beams: Array[Area2D] = []
for i in range(times):
for i in range(TIMES):
beams.push_back(thorns.instantiate())
beams[i].is_fall = false
beams[i].position = position
var rad = TAU / times * i + (TAU / 12 if i % 2 == 0 else -TAU / 12)
var rad = TAU / TIMES * i + (TAU / 12 if i % 2 == 0 else -TAU / 12)
beams[i].velocity = Vector2(sin(rad), cos(rad)) * 800
for beam in beams:
get_parent().add_child(beam)
await get_tree().create_timer(0.1).timeout


func _ready():
$OutScreen.screen_exited.connect(queue_free)
super_burst(Vector2(300, 300))


func _process(delta):
func _process(_delta):
pass


Expand Down
18 changes: 11 additions & 7 deletions scenes/weapons/seedler/seedler.gd
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
extends Sprite2D

const TIMES = 5
@onready var path = $"../Path2D"
@onready var follow = $"../Path2D/PathFollow2D"

func move(length : float) -> void:

func move(length: float) -> void:
follow.progress = length
position = follow.global_position



func start() -> void:
rotation = 0
follow.loop = 1
var start_val = 0
var end = path.curve.get_baked_length()
var mid = end / 2
var movement = create_tween().set_loops(times).set_ease(Tween.EASE_IN).set_trans(Tween.TRANS_SINE)
var movement = create_tween().set_loops(TIMES).set_ease(Tween.EASE_IN).set_trans(
Tween.TRANS_SINE
)
movement.tween_method(move, start_val, mid, 1)
movement.tween_method(move, mid, end, 1)
var rotate_tween = create_tween().set_loops(times)
var rotate_tween = create_tween().set_loops(TIMES)
rotate_tween.tween_property(self, "rotation", TAU * 5, 2)
rotate_tween.tween_callback(func():rotation = 0)

const times = 5
rotate_tween.tween_callback(func(): rotation = 0)


func _ready() -> void:
if get_tree().current_scene == self:
Expand Down

0 comments on commit f834d4b

Please sign in to comment.