Skip to content

Commit

Permalink
feat:add animation for card movement
Browse files Browse the repository at this point in the history
  • Loading branch information
limuy2022 committed Sep 17, 2024
1 parent 0fc0006 commit 1552477
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ mono_crash.*.json

# Python
__pycache__/
venv
6 changes: 3 additions & 3 deletions script/card.gd
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ func _on_pressed():
if has_chosen:
# 已经选中,再次点击说明取消选择
has_chosen = false
position = on_board_pos
create_tween().tween_property(self, "position", on_board_pos, 0.2)
PlantsBarAutoload.cancel(board_index)
else:
# 选中该植物
if PlantsBarAutoload.choose == PlantsBarAutoload.MAXNUM:
return
var pos_get = PlantsBarAutoload.add()
position.y = PlantsBarAutoload.BAR_Y
position.x = pos_get[1]
var target_pos = Vector2(pos_get[1], PlantsBarAutoload.BAR_Y)
create_tween().tween_property(self, "position", target_pos, 0.2)
board_index = pos_get[0]
has_chosen = true

Expand Down
4 changes: 1 addition & 3 deletions tools/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
# format gdscript
gdformat .
# lint gdscript
gdlint .
# save
git add -A
gdlint .

0 comments on commit 1552477

Please sign in to comment.