Skip to content

Commit

Permalink
Merge pull request #66 from ligen131/fix-20240228-small-bugs
Browse files Browse the repository at this point in the history
Fix: 若干小 bug 修复
  • Loading branch information
cutekibry authored Feb 28, 2024
2 parents 214f0c6 + 732f587 commit 3141325
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bg/dynamic_bg/dynamic_bg.gd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func set_victory(v: bool):
func _ready():
var x_offset = 0
var y_offset = 0
self.color = ImageLib.get_palette_color_by_name("darkest")
self.color = ImageLib.get_palette_color_by_info("blue", "darkest")

while HEIGHT + y_offset + (WIDTH / W_STEP) * H_STEP > -50:
spawn(x_offset, y_offset)
Expand Down
2 changes: 1 addition & 1 deletion levels/base_level/base_level.gd
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ func _on_next_level_button_pressed():
level_menu.init(chap_id)
else:
var base_level = BaseLevelScn.instantiate()
base_level.init(chap_id, lvl_id)
get_tree().root.add_child(base_level)
base_level.init(chap_id, lvl_id + 1)
queue_free()

func _on_replay_button_pressed():
Expand Down
3 changes: 3 additions & 0 deletions objects/block/block.gd
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ func set_card(card: Card) -> void:
assert(not self.is_fixed, "void Block::set_card(card: Card) should only be called when is_fixed is false.")
if self.occupied_card != card:
self.occupied_card = card
if card != null:
card.position = self.position
card.current_block = self
occupied_card_changed.emit(self)


Expand Down
5 changes: 2 additions & 3 deletions objects/card/card.gd
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,16 @@ func put_down():

if old_card != null: # 若原来占有的卡非空,则进行交换
if self.last_block != null: # 若当前 Card 之前占用了 Block,则将该 Block 占用的 Card 放置在原先的位置上
old_card.position = self.last_block.position
self.last_block.set_card(old_card)
else: # 若当前 Card 是由 CardBase 生成的,则将该 Block 占用的 Card 释放
old_card.queue_free()

self.current_block = entered_block
self.position = entered_block.position
self.is_dragging = false

self.last_block = null

$SFXPutDown.play()


else:
queue_free()
Expand Down

0 comments on commit 3141325

Please sign in to comment.