1extends Sprite
2
3var animation
4var wave_pos
5var root
6var angle_line
7var animation_length
8
9func _ready():
10    root = get_node("/root/game")
11    animation = self.get_node('anim')
12    angle_line = int(self.get_pos().x)
13    if root.current_map_terrain != null:
14        angle_line = root.current_map_terrain.world_to_map(self.get_pos())
15        angle_line = int(angle_line.y)
16    #wave_pos = (1+ sin(angle_line) ) * ( animation.get_current_animation_length() * 0.5)
17    animation_length = int(animation.get_current_animation_length())
18    wave_pos = angle_line % animation_length
19    animation.play('wave_' + str(randi()%3) )
20    animation.seek(wave_pos,true)
21