diff --git a/scenes/comet.gd b/scenes/comet.gd index cbafd72..8107618 100644 --- a/scenes/comet.gd +++ b/scenes/comet.gd @@ -1,5 +1,11 @@ extends Area2D +# TODO: Have a list of "sizes" a comet can be +# TODO: Have speeds be determined on a rage based on its "size" +# TODO: Provide a specific score based on the "size" +# TODO: Have the comet spawn 2 of the next "size" when hit +# TODO: Have the comet disapear if shot at is smallest "size" + @export var movement_speed := 600 var rotation_speed : int @@ -12,11 +18,15 @@ func _ready() -> void: func _physics_process(delta: float) -> void: rotate(deg_to_rad(rotaion_direction * rotation_speed * delta)) + # TODO: Add "floating in space" movement - - + # Screen Wrap + var viewport_size := get_viewport_rect().size + position.x = wrap(position.x, 0, viewport_size.x) + position.y = wrap(position.y, 0,viewport_size.y) func _on_body_entered(body: Node2D) -> void: print(body) + # TODO: Add "explosion" logic if bullet hits me if body.is_in_group("ship"): body.crash() diff --git a/scenes/game.gd b/scenes/game.gd new file mode 100644 index 0000000..3cf3912 --- /dev/null +++ b/scenes/game.gd @@ -0,0 +1,10 @@ +extends Node2D + +# TODO: Make a HUD that shows "level" and "score" (& maybe high score) +# TODO: Display a game over screen when the ship is hit by a comet with abilty to restart +# TODO: Create a node that randomly spwans some comets on the map +# TODO: Detect when all comets are gone and increase the level (& maybe speed?) +# TODO: Make a space like background, maybe some scrolling, maybe randomly generated +# TODO: Make a small title screen that starts before the game scene +# TODO: MAYBE track high score in a file + diff --git a/scenes/game.tscn b/scenes/game.tscn index bf1e3e2..8b05707 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=3 format=3 uid="uid://bdarunpk3c2eh"] +[gd_scene load_steps=4 format=3 uid="uid://bdarunpk3c2eh"] +[ext_resource type="Script" path="res://scenes/game.gd" id="1_6727i"] [ext_resource type="PackedScene" uid="uid://cbo47ftx0vcro" path="res://scenes/ship.tscn" id="1_esyqo"] [ext_resource type="PackedScene" uid="uid://bsonrs8vhtly8" path="res://scenes/comet.tscn" id="2_b37uv"] [node name="Game" type="Node2D"] +script = ExtResource("1_6727i") [node name="Background" type="CanvasLayer" parent="."] layer = -1 diff --git a/scripts/bullet.gd b/scripts/bullet.gd index 9ee019d..1109c5a 100644 --- a/scripts/bullet.gd +++ b/scripts/bullet.gd @@ -1,9 +1,10 @@ extends Area2D +# TODO: Tweak speed and LifeTimer values + @export var speed := 1400.00 var direction := Vector2.UP - func _physics_process(delta: float) -> void: # Movement position += direction.rotated(rotation) * speed * delta diff --git a/scripts/ship.gd b/scripts/ship.gd index 7c9f954..a5c97f3 100644 --- a/scripts/ship.gd +++ b/scripts/ship.gd @@ -1,5 +1,8 @@ extends CharacterBody2D +# TODO: Add the ability to "warp" +# TODO: Tweak speed and shoot time values + const BULLET = preload("res://scenes/bullet.tscn") @export var accleration := 90.0 @@ -43,6 +46,7 @@ func fire_gun(pos : Vector2, rot : float) -> void: $ShotCooldown.start() func crash(): + # TODO: Maybe emit a signal that the main game node listens for "game over" state $AnimationPlayer.play("crash")