22 lines
		
	
	
		
			366 B
		
	
	
	
		
			GDScript3
		
	
	
	
	
	
		
		
			
		
	
	
			22 lines
		
	
	
		
			366 B
		
	
	
	
		
			GDScript3
		
	
	
	
	
	
| 
								 | 
							
								extends Area2D
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								var speed = 750
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func setSpeed(speedVal):
							 | 
						||
| 
								 | 
							
									speed = speedVal
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
								func _physics_process(delta):
							 | 
						||
| 
								 | 
							
									position += transform.x * speed * delta
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func _on_Bullet_body_entered(body):
							 | 
						||
| 
								 | 
							
									if body.is_in_group("mobs"):
							 | 
						||
| 
								 | 
							
										body.queue_free()
							 | 
						||
| 
								 | 
							
									queue_free()
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func _on_body_entered(body):
							 | 
						||
| 
								 | 
							
									# blast the body?
							 | 
						||
| 
								 | 
							
									if body.is_in_group("boxes"):
							 | 
						||
| 
								 | 
							
										body.queue_free()
							 | 
						||
| 
								 | 
							
										queue_free()
							 |