diff --git a/scripts/item_animations.gd b/scripts/item_animations.gd index ee5b1e5..9e37ca0 100644 --- a/scripts/item_animations.gd +++ b/scripts/item_animations.gd @@ -14,12 +14,20 @@ func Item_anim(item): var tweene = get_tree().create_tween() tweene.tween_property(res,"rotation",360,1) await get_tree().create_timer(1).timeout + var x = enemy.get_rect().size.x + x = x / 2 + var y = enemy.get_rect().size.y + y = y / 2 res.hide() + enemy.hide() await get_tree().create_timer(.2).timeout res.position = res.position - Vector2(x,y) + res.rotation = 0 res.show() var tweenw = get_tree().create_tween() - tweenw.tween_property(res,"position",res.position.y + 20,1) + tweenw.tween_property(res,"position",Vector2(res.position.x,res.position.y + 100),1) + await get_tree().create_timer(1).timeout + res.skew = 50 await get_tree().create_timer(1).timeout res.hide() res.scale = Vector2(1,1) diff --git a/scripts/items.gd b/scripts/items.gd index f2c066b..8ed4430 100644 --- a/scripts/items.gd +++ b/scripts/items.gd @@ -1,6 +1,6 @@ extends Control signal animation(item) -func _on_main_window_run_items(item): +func _on_main_window_run_items(item,enemy): match item: "potion": #run pokemon menu @@ -8,7 +8,7 @@ func _on_main_window_run_items(item): #handle heals pass "poke_ball": - animation.emit(item) + animation.emit(item,enemy) #catch_rate #handle fail and catch pass diff --git a/scripts/main_window.gd b/scripts/main_window.gd index 2475fcb..6bf0a5d 100644 --- a/scripts/main_window.gd +++ b/scripts/main_window.gd @@ -338,7 +338,7 @@ func Item_pressed(key): $Cast/darken.hide() $Castless/Bag.hide() disable_btns(false) - run_items.emit(key) + run_items.emit(key,data.Enemy) func shop(): Globals.money = data.Money get_tree().change_scene_to_file("res://scenes/shop.tscn")