fixed y-wing turret laser trajectory. - Zerothelootrat
This commit is contained in:
17
README.md
17
README.md
@@ -15,18 +15,25 @@ currently only have one enemy and one level up type
|
|||||||
|
|
||||||
|
|
||||||
##todo:
|
##todo:
|
||||||
- [x] Finish Y-Wing Art
|
- [ ] Power up 2 (shield) : After dinner 6/7/2024
|
||||||
- [x] Import Y-Wing & get turret working
|
|
||||||
-[x] Implement Y-Wing Main Cannon
|
|
||||||
- [ ] Power up 2 (shield)
|
|
||||||
- [ ] locate sounds
|
- [ ] locate sounds
|
||||||
- [ ] World Map
|
- [ ] World Map
|
||||||
- [ ] Work on Boss fight
|
- [ ] Work on Boss Enemy
|
||||||
|
- [ ] Spawner Refactor to allow level editing
|
||||||
|
- [ ] Boss Fight state machine
|
||||||
- [ ] Level 1 and boss fight
|
- [ ] Level 1 and boss fight
|
||||||
|
|
||||||
|
##finished:
|
||||||
|
- [x] Finish Y-Wing Art
|
||||||
|
- [x] Import Y-Wing & get turret working
|
||||||
|
- [x] Implement Y-Wing Main Cannon
|
||||||
|
|
||||||
update log:
|
update log:
|
||||||
6/4/2024
|
6/4/2024
|
||||||
First implementation of y-wing sprite, and turret. Scripting to be done later.
|
First implementation of y-wing sprite, and turret. Scripting to be done later.
|
||||||
|
|
||||||
6/5/2024
|
6/5/2024
|
||||||
Y-Wing implemented, and turret working (X/Y coords for the blaster bolt needs tweaking) Multiple target_pos.x * 2?
|
Y-Wing implemented, and turret working (X/Y coords for the blaster bolt needs tweaking) Multiple target_pos.x * 2?
|
||||||
|
|
||||||
|
6/7/2024
|
||||||
|
Y-wing 99% finished, tweaks required. added a few things to objectives list. moved finished objects to finished objects list.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ position = Vector2(370, 0)
|
|||||||
position = Vector2(470, 0)
|
position = Vector2(470, 0)
|
||||||
|
|
||||||
[node name="SpawnTimer" type="Timer" parent="."]
|
[node name="SpawnTimer" type="Timer" parent="."]
|
||||||
wait_time = 2.0
|
wait_time = 10.0
|
||||||
autostart = true
|
autostart = true
|
||||||
|
|
||||||
[connection signal="timeout" from="SpawnTimer" to="." method="_on_spawn_timer_timeout"]
|
[connection signal="timeout" from="SpawnTimer" to="." method="_on_spawn_timer_timeout"]
|
||||||
|
|||||||
@@ -20,4 +20,9 @@ texture = ExtResource("1_8xaek")
|
|||||||
position = Vector2(0, 2)
|
position = Vector2(0, 2)
|
||||||
shape = SubResource("CapsuleShape2D_kjs2o")
|
shape = SubResource("CapsuleShape2D_kjs2o")
|
||||||
|
|
||||||
|
[node name="Timer" type="Timer" parent="."]
|
||||||
|
wait_time = 10.0
|
||||||
|
autostart = true
|
||||||
|
|
||||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
|
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ func _physics_process(delta):
|
|||||||
fire_main_cannon()
|
fire_main_cannon()
|
||||||
main_cannon = false
|
main_cannon = false
|
||||||
mainCannonFire.start()
|
mainCannonFire.start()
|
||||||
|
|
||||||
aim_turret(delta)
|
aim_turret(delta)
|
||||||
|
|
||||||
if target_ray.is_colliding and target_ray.get_collider() is player:
|
if target_ray.is_colliding and target_ray.get_collider() is player:
|
||||||
@@ -69,14 +70,26 @@ func _physics_process(delta):
|
|||||||
#turret.rotate(current_rotation)
|
#turret.rotate(current_rotation)
|
||||||
#turret.rotation(atan2(target.x - turret_pos.x,target.y - turret_pos.y))
|
#turret.rotation(atan2(target.x - turret_pos.x,target.y - turret_pos.y))
|
||||||
|
|
||||||
|
var default_target : Vector2
|
||||||
|
|
||||||
#figured out with loki, holy shit this was annoying
|
#figured out with loki, holy shit this was annoying
|
||||||
func aim_turret(delta):
|
func aim_turret(delta):
|
||||||
var target : Vector2 = get_tree().current_scene.player.global_position
|
var player = get_tree().current_scene.player
|
||||||
|
if is_instance_valid(player):
|
||||||
|
|
||||||
|
var target = get_tree().current_scene.player.global_position
|
||||||
var turret_pos = turret.global_position
|
var turret_pos = turret.global_position
|
||||||
var target_rot = atan2(target.x - turret_pos.x, target.y - turret_pos.y)
|
var target_rot = atan2(target.x - turret_pos.x, target.y - turret_pos.y)
|
||||||
var target_pos = get_tree().current_scene.player.global_position
|
var target_pos = get_tree().current_scene.player.global_position
|
||||||
var current_rotation = turret.rotation
|
var current_rotation = turret.rotation
|
||||||
|
if target == null:
|
||||||
|
firing_solution = 0
|
||||||
|
|
||||||
|
if target == null:
|
||||||
|
default_target.x = 0
|
||||||
|
default_target.y = 0
|
||||||
|
target = default_target
|
||||||
|
|
||||||
|
|
||||||
var speed = 5 #in degrees, can adjust
|
var speed = 5 #in degrees, can adjust
|
||||||
var direction = 1
|
var direction = 1
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ extends Area2D
|
|||||||
var speed = 100
|
var speed = 100
|
||||||
var target2 : Vector2
|
var target2 : Vector2
|
||||||
var new_rot
|
var new_rot
|
||||||
|
var direction
|
||||||
func initialize(firing_solution,target):
|
func initialize(firing_solution,target):
|
||||||
print('firing_solution='+str(firing_solution))
|
print('firing_solution='+str(firing_solution))
|
||||||
new_rot = firing_solution
|
new_rot = firing_solution
|
||||||
@@ -18,6 +19,8 @@ func initialize(firing_solution,target):
|
|||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
set_rotation(new_rot)
|
set_rotation(new_rot)
|
||||||
|
direction = (target2 - global_position).normalized()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
@@ -26,10 +29,27 @@ func _physics_process(delta):
|
|||||||
#print(target2)
|
#print(target2)
|
||||||
#print(typeof(global_position))
|
#print(typeof(global_position))
|
||||||
#print(typeof(target))
|
#print(typeof(target))
|
||||||
global_position -= (global_position - target2).normalized() * speed * delta
|
#var direction = (global_position - target2).normalized()
|
||||||
|
|
||||||
|
#print("target2 " + str(target2))
|
||||||
|
#print("direction normalized " + str(direction))
|
||||||
|
#print("target_far " + str(target_far))
|
||||||
|
#print("direction " + str(direction))
|
||||||
|
#print("target2 " + str(target2))
|
||||||
|
#global_position += (direction - global_position).normalized() * speed * delta
|
||||||
|
global_position += direction * speed * delta
|
||||||
|
if global_position.x >= 980:
|
||||||
|
#print("cleanup")
|
||||||
|
queue_free()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _on_area_entered(area):
|
func _on_area_entered(area):
|
||||||
if area is player:
|
if area is player:
|
||||||
area.take_damage(1)
|
area.take_damage(1)
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_timer_timeout():
|
||||||
|
print("cleanup")
|
||||||
|
queue_free()
|
||||||
|
|||||||
Reference in New Issue
Block a user