A game created for the Godot Wild Jam #21
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
718B

  1. extends Sprite
  2. func _ready():
  3. material.set_shader_param("sprite_scale", scale)
  4. $Splash.process_material.color = material.get_shader_param("liquid_color_surface")
  5. if scale.x != 0 and scale.y != 0:
  6. $Splash.scale = Vector2(1/scale.x, 1/scale.y)
  7. set_process(true)
  8. func _process(delta):
  9. pass
  10. func _on_Trigger_body_entered(body):
  11. if scale.x != 0:
  12. var bpos = body.get_global_transform().origin
  13. var spos = get_global_transform().origin
  14. var delta = bpos.x - spos.x
  15. $Splash.position.x = (delta * (1/scale.x))
  16. $Splash.emitting = true
  17. if (body.has_method("set_colors")):
  18. body.set_colors(
  19. material.get_shader_param("liquid_color_main"),
  20. material.get_shader_param("liquid_color_surface")
  21. )