first Prototype
This commit is contained in:
parent
89503407e7
commit
c887a2168c
78 changed files with 2494 additions and 2 deletions
50
scenes/main/main.gd
Normal file
50
scenes/main/main.gd
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
extends Node2D
|
||||
|
||||
@onready var timeGhost = preload("res://scenes/spaceShip/timeGhost/timeghost.tscn")
|
||||
@onready var minigun = preload("res://scenes/weapon/minigun/minigun.tscn")
|
||||
@onready var railgun = preload("res://scenes/weapon/railgun/railgun.tscn")
|
||||
@onready var shotgun = preload("res://scenes/weapon/shotgun/shotgun.tscn")
|
||||
|
||||
@onready var obstaclePool = $obstaclePool
|
||||
@onready var enemyPool = $enemyPool
|
||||
@onready var enemySpawnTimer = $spawnTimer/enemySpawnTimer
|
||||
@onready var obstaclesSpawnTimer = $spawnTimer/obstaclesSpawnTimer
|
||||
|
||||
@onready var enemy: PackedScene = preload("res://scenes/spaceShip/enemy/enemy.tscn")
|
||||
@onready var obstacle: PackedScene = preload("res://scenes/obstacle/meteor/meteor.tscn")
|
||||
|
||||
|
||||
@onready var player = $Player
|
||||
|
||||
func _ready() -> void:
|
||||
Globals.setPlayer(player)
|
||||
player.changeWeapon(shotgun)
|
||||
|
||||
for i in range(1, 10):
|
||||
addGhost()
|
||||
|
||||
|
||||
|
||||
|
||||
func addGhost():
|
||||
var ghost = timeGhost.instantiate()
|
||||
add_child(ghost)
|
||||
player.addTimeGhost(ghost)
|
||||
|
||||
func spawnObstacle(_obstacle: PackedScene, _position: Vector2):
|
||||
var newObstacle = _obstacle.instantiate()
|
||||
newObstacle.global_position = _position
|
||||
obstaclePool.add_child(newObstacle)
|
||||
|
||||
func spawnEnemy(_enemy: PackedScene, _position: Vector2):
|
||||
var newEnemy = _enemy.instantiate()
|
||||
newEnemy.global_position = _position
|
||||
enemyPool.add_child(newEnemy)
|
||||
|
||||
func _on_enemy_spawn_timer_timeout() -> void:
|
||||
spawnEnemy(enemy, Globals.getPlayer().getRandomSpawnPointPosition())
|
||||
for i in enemyPool.get_children():
|
||||
i.changeWeapon(shotgun)
|
||||
|
||||
func _on_obstacles_spawn_timer_timeout() -> void:
|
||||
spawnObstacle(obstacle, Globals.getPlayer().getRandomSpawnPointPosition())
|
||||
1
scenes/main/main.gd.uid
Normal file
1
scenes/main/main.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cvoco1axom40
|
||||
39
scenes/main/main.tscn
Normal file
39
scenes/main/main.tscn
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://cfculwiy7mtdc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cvoco1axom40" path="res://scenes/main/main.gd" id="1_kdt4m"]
|
||||
[ext_resource type="PackedScene" uid="uid://bmc2exqutt6vu" path="res://scenes/spaceShip/player/player.tscn" id="2_ia3nl"]
|
||||
[ext_resource type="PackedScene" uid="uid://dm0rd88xd5m7k" path="res://scenes/bullet/bulletPool.tscn" id="3_2s0fe"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfwyw1sr6x2np" path="res://icon.svg" id="4_r8qeh"]
|
||||
|
||||
[node name="main" type="Node2D"]
|
||||
script = ExtResource("1_kdt4m")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
modulate = Color(0.605274, 0.605274, 0.605274, 1)
|
||||
offset_left = -11272.0
|
||||
offset_top = -6736.0
|
||||
offset_right = 12152.0
|
||||
offset_bottom = 7008.0
|
||||
texture = ExtResource("4_r8qeh")
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("2_ia3nl")]
|
||||
spawnDistance = 1000
|
||||
|
||||
[node name="bulletPool" parent="." instance=ExtResource("3_2s0fe")]
|
||||
|
||||
[node name="obstaclePool" type="Node2D" parent="."]
|
||||
|
||||
[node name="enemyPool" type="Node2D" parent="."]
|
||||
|
||||
[node name="spawnTimer" type="Node" parent="."]
|
||||
|
||||
[node name="enemySpawnTimer" type="Timer" parent="spawnTimer"]
|
||||
wait_time = 10.0
|
||||
autostart = true
|
||||
|
||||
[node name="obstaclesSpawnTimer" type="Timer" parent="spawnTimer"]
|
||||
autostart = true
|
||||
|
||||
[connection signal="timeout" from="spawnTimer/enemySpawnTimer" to="." method="_on_enemy_spawn_timer_timeout"]
|
||||
[connection signal="timeout" from="spawnTimer/obstaclesSpawnTimer" to="." method="_on_obstacles_spawn_timer_timeout"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue