Arrow.gd 639 B

123456789101112131415161718192021222324252627282930313233
  1. extends Glowy
  2. class_name Arrow
  3. var left = true
  4. var meshnode
  5. var mesh
  6. var freq = 2
  7. var phase = 0
  8. var active = true
  9. func _init(col = Color8(130,70,180)):
  10. self.color = col
  11. self.power=2.5
  12. func _process(delta):
  13. if active:
  14. meshnode.translation = Vector3(abs(sin(phase)),0,0)
  15. phase=wrapf(phase+delta*6.28*freq,0,6.28)
  16. func _ready():
  17. mesh = MeshInstance.new()
  18. mesh.mesh = load("res://AlphaVoxel/more.obj")
  19. meshnode = Spatial.new()
  20. meshnode.add_child(mesh)
  21. mesh.set_surface_material(0,self.mat)
  22. mesh.translation = Vector3(-3.0,-5.0,0)
  23. if not left:
  24. self.rotation=Vector3(0,PI,0)
  25. add_child(meshnode)
  26. #print ("Arrow ready")