mirror of https://github.com/profan/ld-39-jam.git
				
				
				
			eww
This commit is contained in:
		
							parent
							
								
									0a8e9f5cc0
								
							
						
					
					
						commit
						28a51c47de
					
				| 
						 | 
				
			
			@ -8,11 +8,12 @@ onready var sprite = get_node("Sprite")
 | 
			
		|||
func _ready():
 | 
			
		||||
	set_fixed_process(true)
 | 
			
		||||
	
 | 
			
		||||
func fire(vel, dir, speed):
 | 
			
		||||
	velocity = vel + (dir * speed)
 | 
			
		||||
func fire(delta, vel, dir, speed):
 | 
			
		||||
	velocity = (dir * (speed * delta)) + (dir * vel.length())
 | 
			
		||||
	sprite.rotate(dir.angle())
 | 
			
		||||
	
 | 
			
		||||
func _fixed_process(delta):
 | 
			
		||||
	move(velocity * delta)
 | 
			
		||||
	move(velocity)
 | 
			
		||||
	lifetime -= delta
 | 
			
		||||
	if lifetime <= 0:
 | 
			
		||||
		queue_free()
 | 
			
		||||
		queue_free()
 | 
			
		||||
							
								
								
									
										8
									
								
								Gun.gd
								
								
								
								
							
							
						
						
									
										8
									
								
								Gun.gd
								
								
								
								
							| 
						 | 
				
			
			@ -3,19 +3,19 @@ extends Sprite
 | 
			
		|||
var Bullet = load("res://Bullet.tscn")
 | 
			
		||||
 | 
			
		||||
var gun_cooldown = 0
 | 
			
		||||
var gun_delay = 0.25
 | 
			
		||||
var gun_delay = 0.1125
 | 
			
		||||
 | 
			
		||||
func _ready():
 | 
			
		||||
	set_fixed_process(true)
 | 
			
		||||
	
 | 
			
		||||
func _fixed_process(delta):
 | 
			
		||||
	gun_cooldown = gun_cooldown - delta
 | 
			
		||||
	gun_cooldown = clamp(gun_cooldown - delta, 0, 1)
 | 
			
		||||
	
 | 
			
		||||
func fire(vel, dir):
 | 
			
		||||
func fire(delta, vel, dir):
 | 
			
		||||
	if gun_cooldown <= 0:
 | 
			
		||||
		var new_bullet = Bullet.instance()
 | 
			
		||||
		var gun_pos = get_global_pos()
 | 
			
		||||
		new_bullet.set_pos(gun_pos)
 | 
			
		||||
		get_tree().get_root().add_child(new_bullet)
 | 
			
		||||
		new_bullet.fire(vel, dir, 256)	
 | 
			
		||||
		new_bullet.fire(delta, vel, dir, 512)
 | 
			
		||||
		gun_cooldown += gun_delay
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,11 +43,11 @@ func _fixed_process(delta):
 | 
			
		|||
		is_moving = false
 | 
			
		||||
		
 | 
			
		||||
	if Input.is_action_pressed("player_attack_primary"):
 | 
			
		||||
		left_gun.fire(ship_vel, -ship_dir)
 | 
			
		||||
		right_gun.fire(ship_vel, -ship_dir)
 | 
			
		||||
		left_gun.fire(delta, ship_vel, -ship_dir)
 | 
			
		||||
		right_gun.fire(delta, ship_vel, -ship_dir)
 | 
			
		||||
	elif Input.is_action_pressed("player_attack_secondary"):
 | 
			
		||||
		pass
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	if Input.is_action_pressed("player_switch_up"):
 | 
			
		||||
		pass
 | 
			
		||||
	elif Input.is_action_pressed("player_switch_down"):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue