Progress on Heater
This commit is contained in:
parent
22d0f55d7b
commit
751b731896
@ -47,9 +47,7 @@ position = Vector2( -18, 3 )
|
||||
rotation = 1.5708
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="Hitbox" type="Area2D" parent="." groups=[
|
||||
"Fish",
|
||||
]]
|
||||
[node name="Hitbox" type="Area2D" parent="." groups=["Fish"]]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
|
||||
position = Vector2( -8, 1 )
|
||||
@ -89,9 +87,9 @@ margin_left = -137.0
|
||||
margin_top = -200.0
|
||||
margin_right = 138.0
|
||||
margin_bottom = -80.0
|
||||
custom_fonts/normal_font = SubResource( 4 )
|
||||
custom_colors/default_color = Color( 0.945098, 0.352941, 0.160784, 1 )
|
||||
custom_constants/line_separation = -6
|
||||
custom_fonts/normal_font = SubResource( 4 )
|
||||
bbcode_enabled = true
|
||||
bbcode_text = "[center]Wait, something's wrong with these flakes! [shake]
|
||||
Must... resist... eating...!"
|
||||
|
@ -34,15 +34,19 @@ func _on_Hitbox_area_entered(area):
|
||||
|
||||
|
||||
func _spawn_piranha():
|
||||
print("Spawning the piranha now...")
|
||||
#$AnimationPlayer.play("drop")
|
||||
#yield($AnimationPlayer, "animation_finished")
|
||||
var piranha_scene = load("res://Hazards/Piranha/Piranha.tscn")
|
||||
var piranha = piranha_scene.instance()
|
||||
# piranha.set_process(false)
|
||||
get_parent().add_child(piranha)
|
||||
piranha.position = Vector2(300, -300)
|
||||
$TweenDrop.interpolate_property(piranha, "position:y", piranha.get_global_position().y, 600, 0.5, Tween.TRANS_BACK, Tween.EASE_IN)
|
||||
$TweenDrop.start()
|
||||
yield($TweenDrop, "tween_completed")
|
||||
print("dropped")
|
||||
#call_deferred("add_child", piranha)
|
||||
add_child(piranha)
|
||||
piranha.position = $Position2D.position
|
||||
#piranha.global_position.x = position.x - 300
|
||||
#piranha.global_position.y = position.y + 300
|
||||
#$TweenDrop.interpolate_property(piranha, "position:y", piranha.get_global_position().y, piranha.get_global_position().y+500, 1, Tween.TRANS_CIRC, Tween.EASE_IN)
|
||||
#$TweenDrop.start()
|
||||
#yield($TweenDrop, "tween_completed")
|
||||
print("Piranha is now at " + str(piranha.get_global_position()))
|
||||
# piranha.set_process(true)
|
||||
|
@ -77,4 +77,7 @@ anims/recoil = SubResource( 3 )
|
||||
|
||||
[node name="TweenDrop" type="Tween" parent="."]
|
||||
|
||||
[node name="Position2D" type="Position2D" parent="."]
|
||||
position = Vector2( -1399, 16 )
|
||||
|
||||
[connection signal="area_entered" from="Wire/Hitbox" to="." method="_on_Hitbox_area_entered"]
|
||||
|
@ -8,20 +8,28 @@ var next_dest = 60
|
||||
var destination : Vector2
|
||||
|
||||
func _ready():
|
||||
pass
|
||||
print("I liiiiive...!")
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
$SwordPivot.rotation_degrees += 1
|
||||
if dest_counter >= next_dest:
|
||||
destination = _select_destination()
|
||||
next_dest = rand_range(60,1200) # second number lower = move more frequently
|
||||
dest_counter = 0
|
||||
else:
|
||||
dest_counter +=1
|
||||
if moving:
|
||||
$TweenSwim.interpolate_property(self, "position", get_global_position(), destination, .175, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT) #number lower = faster
|
||||
$TweenSwim.start()
|
||||
|
||||
if destination:
|
||||
var v = get_global_mouse_position() - global_position
|
||||
var angle = v.angle() + deg2rad(270)
|
||||
# if global_position.x < get_global_mouse_position().x:
|
||||
# $AnimatedSprite.flip_v = false
|
||||
# else:
|
||||
# $AnimatedSprite.flip_v = true
|
||||
if rad2deg(angle) < 180 or rad2deg(angle) > 360:
|
||||
$AnimatedSprite.flip_v = true
|
||||
else:
|
||||
$AnimatedSprite.flip_v = false
|
||||
var rotation_speed = PI * 0.75 # PI = 180 degrees
|
||||
var angle_delta = rotation_speed * delta
|
||||
angle = lerp_angle(global_rotation, angle + 1.57, 1.0)
|
||||
angle = clamp(angle, global_rotation - angle_delta, global_rotation + angle_delta)
|
||||
global_rotation = angle
|
||||
|
||||
|
||||
func _select_destination() -> Vector2:
|
||||
@ -43,3 +51,19 @@ func _on_Blindzone_area_entered(area: Area2D) -> void:
|
||||
func _on_Blindzone_area_exited(area):
|
||||
if area.is_in_group("Fish"):
|
||||
moving = true
|
||||
|
||||
|
||||
func _on_Timer_timeout() -> void:
|
||||
#destination.x = move_toward(position.x, fish.get_global_position().x)
|
||||
#destination.y = move_toward(position.y, fish.get_global_position().y)
|
||||
destination.x = move_toward(global_position.x, get_global_mouse_position().x, 100)
|
||||
destination.y = move_toward(global_position.y, get_global_mouse_position().y, 100)
|
||||
# if dest_counter >= next_dest:
|
||||
# destination = _select_destination()
|
||||
# next_dest = rand_range(60,1200) # second number lower = move more frequently
|
||||
# dest_counter = 0
|
||||
# else:
|
||||
# dest_counter +=1
|
||||
if moving:
|
||||
$TweenSwim.interpolate_property(self, "position", position, destination, 0.85, Tween.TRANS_EXPO, Tween.EASE_OUT) #number lower = faster
|
||||
$TweenSwim.start()
|
||||
|
@ -45,8 +45,8 @@ rotation = 1.5708
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
position = Vector2( 67, -25 )
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
position = Vector2( -44, -21 )
|
||||
scale = Vector2( -0.5, 0.5 )
|
||||
frames = SubResource( 2 )
|
||||
frame = 1
|
||||
playing = true
|
||||
@ -59,6 +59,10 @@ shape = SubResource( 3 )
|
||||
|
||||
[node name="TweenSwim" type="Tween" parent="."]
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
autostart = true
|
||||
|
||||
[connection signal="area_entered" from="SwordPivot/SwordHitbox" to="." method="_on_SwordHitbox_area_entered"]
|
||||
[connection signal="area_entered" from="Blindzone" to="." method="_on_Blindzone_area_entered"]
|
||||
[connection signal="area_exited" from="Blindzone" to="." method="_on_Blindzone_area_exited"]
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
||||
|
@ -50,9 +50,7 @@ __meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Edges" type="StaticBody2D" parent="." groups=[
|
||||
"Tank",
|
||||
]]
|
||||
[node name="Edges" type="StaticBody2D" parent="." groups=["Tank"]]
|
||||
visible = false
|
||||
collision_layer = 4
|
||||
collision_mask = 18
|
||||
@ -104,9 +102,7 @@ __meta__ = {
|
||||
[node name="Fish" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 617, 494 )
|
||||
|
||||
[node name="TankFloor" type="Area2D" parent="." groups=[
|
||||
"TankFloor",
|
||||
]]
|
||||
[node name="TankFloor" type="Area2D" parent="." groups=["TankFloor"]]
|
||||
visible = false
|
||||
position = Vector2( 960, 1070 )
|
||||
|
||||
|
@ -26,7 +26,7 @@ window/stretch/aspect="keep"
|
||||
|
||||
skip={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"unicode":0,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user