Cleanup and stuff

This commit is contained in:
Victor Turgeon 2023-10-11 01:46:51 -04:00
parent 1bcd7bcea9
commit b59b4eb4ba
6 changed files with 133 additions and 4 deletions

53
Scenes/Levels/lev30F7.tmp Normal file
View File

@ -0,0 +1,53 @@
[gd_scene load_steps=8 format=3 uid="uid://uoyiei4wyig3"]
[ext_resource type="Script" path="res://Scripts/level.gd" id="1_0nmok"]
[ext_resource type="PackedScene" uid="uid://b8s2seg2lf7wo" path="res://Scenes/Tilemaps/tileset_1.tscn" id="1_4n82n"]
[ext_resource type="PackedScene" uid="uid://cl7w6ndvons1a" path="res://Scenes/Props/candle_1.tscn" id="2_5hdq4"]
[ext_resource type="PackedScene" uid="uid://by2xmwcng01uy" path="res://Scenes/Props/candle_2.tscn" id="2_o33c4"]
[ext_resource type="PackedScene" uid="uid://b5lnjonlf4i1b" path="res://Scenes/enemy.tscn" id="4_g0oey"]
[ext_resource type="PackedScene" uid="uid://0onqgygm832d" path="res://Scenes/Player/player.tscn" id="5_ik47y"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1g1r4"]
size = Vector2(930, 450)
[node name="Level1" type="Node2D"]
script = ExtResource("1_0nmok")
[node name="Player" parent="." instance=ExtResource("5_ik47y")]
[node name="TileSet1" parent="." instance=ExtResource("1_4n82n")]
[node name="Decor" type="Node2D" parent="."]
[node name="Candles" parent="Decor" instance=ExtResource("2_o33c4")]
position = Vector2(160, 384)
[node name="Candles2" parent="Decor" instance=ExtResource("2_o33c4")]
position = Vector2(160, 128)
[node name="Candles3" parent="Decor" instance=ExtResource("2_o33c4")]
position = Vector2(800, 128)
[node name="Candles4" parent="Decor" instance=ExtResource("2_o33c4")]
position = Vector2(800, 384)
[node name="Candle" parent="Decor" instance=ExtResource("2_5hdq4")]
position = Vector2(432, 224)
[node name="Candle2" parent="Decor" instance=ExtResource("2_5hdq4")]
position = Vector2(432, 320)
[node name="Candle3" parent="Decor" instance=ExtResource("2_5hdq4")]
position = Vector2(528, 224)
[node name="Candle4" parent="Decor" instance=ExtResource("2_5hdq4")]
position = Vector2(528, 320)
[node name="Enemy" parent="." instance=ExtResource("4_g0oey")]
position = Vector2(481.898, 270.98)
[node name="PlayableArea" type="Area2D" parent="."]
[node name="PlayableRect" type="CollisionShape2D" parent="PlayableArea"]
position = Vector2(479, 239)
shape = SubResource("RectangleShape2D_1g1r4")

53
Scenes/Levels/lev3BA5.tmp Normal file
View File

@ -0,0 +1,53 @@
[gd_scene load_steps=8 format=3 uid="uid://uoyiei4wyig3"]
[ext_resource type="Script" path="res://Scripts/level.gd" id="1_0nmok"]
[ext_resource type="PackedScene" uid="uid://b8s2seg2lf7wo" path="res://Scenes/Tilemaps/tileset_1.tscn" id="1_4n82n"]
[ext_resource type="PackedScene" uid="uid://cl7w6ndvons1a" path="res://Scenes/Props/candle_1.tscn" id="2_5hdq4"]
[ext_resource type="PackedScene" uid="uid://by2xmwcng01uy" path="res://Scenes/Props/candle_2.tscn" id="2_o33c4"]
[ext_resource type="PackedScene" uid="uid://b5lnjonlf4i1b" path="res://Scenes/enemy.tscn" id="4_g0oey"]
[ext_resource type="PackedScene" uid="uid://0onqgygm832d" path="res://Scenes/Player/player.tscn" id="5_ik47y"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1g1r4"]
size = Vector2(930, 450)
[node name="Level1" type="Node2D"]
script = ExtResource("1_0nmok")
[node name="Player" parent="." instance=ExtResource("5_ik47y")]
[node name="TileSet1" parent="." instance=ExtResource("1_4n82n")]
[node name="Decor" type="Node2D" parent="."]
[node name="Candles" parent="Decor" instance=ExtResource("2_o33c4")]
position = Vector2(160, 384)
[node name="Candles2" parent="Decor" instance=ExtResource("2_o33c4")]
position = Vector2(160, 128)
[node name="Candles3" parent="Decor" instance=ExtResource("2_o33c4")]
position = Vector2(800, 128)
[node name="Candles4" parent="Decor" instance=ExtResource("2_o33c4")]
position = Vector2(800, 384)
[node name="Candle" parent="Decor" instance=ExtResource("2_5hdq4")]
position = Vector2(432, 224)
[node name="Candle2" parent="Decor" instance=ExtResource("2_5hdq4")]
position = Vector2(432, 320)
[node name="Candle3" parent="Decor" instance=ExtResource("2_5hdq4")]
position = Vector2(528, 224)
[node name="Candle4" parent="Decor" instance=ExtResource("2_5hdq4")]
position = Vector2(528, 320)
[node name="Enemy" parent="." instance=ExtResource("4_g0oey")]
position = Vector2(481.898, 270.98)
[node name="PlayableArea" type="Area2D" parent="."]
[node name="PlayableRect" type="CollisionShape2D" parent="PlayableArea"]
position = Vector2(479, 239)
shape = SubResource("RectangleShape2D_1g1r4")

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://uoyiei4wyig3"] [gd_scene load_steps=8 format=3 uid="uid://uoyiei4wyig3"]
[ext_resource type="Script" path="res://Scripts/level.gd" id="1_0nmok"] [ext_resource type="Script" path="res://Scripts/level.gd" id="1_0nmok"]
[ext_resource type="PackedScene" uid="uid://b8s2seg2lf7wo" path="res://Scenes/Tilemaps/tileset_1.tscn" id="1_4n82n"] [ext_resource type="PackedScene" uid="uid://b8s2seg2lf7wo" path="res://Scenes/Tilemaps/tileset_1.tscn" id="1_4n82n"]
@ -7,6 +7,9 @@
[ext_resource type="PackedScene" uid="uid://b5lnjonlf4i1b" path="res://Scenes/enemy.tscn" id="4_g0oey"] [ext_resource type="PackedScene" uid="uid://b5lnjonlf4i1b" path="res://Scenes/enemy.tscn" id="4_g0oey"]
[ext_resource type="PackedScene" uid="uid://0onqgygm832d" path="res://Scenes/Player/player.tscn" id="5_ik47y"] [ext_resource type="PackedScene" uid="uid://0onqgygm832d" path="res://Scenes/Player/player.tscn" id="5_ik47y"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1g1r4"]
size = Vector2(930, 384)
[node name="Level1" type="Node2D"] [node name="Level1" type="Node2D"]
script = ExtResource("1_0nmok") script = ExtResource("1_0nmok")
@ -42,3 +45,9 @@ position = Vector2(528, 320)
[node name="Enemy" parent="." instance=ExtResource("4_g0oey")] [node name="Enemy" parent="." instance=ExtResource("4_g0oey")]
position = Vector2(481.898, 270.98) position = Vector2(481.898, 270.98)
[node name="PlayableArea" type="Area2D" parent="."]
[node name="PlayableRect" type="CollisionShape2D" parent="PlayableArea"]
position = Vector2(479, 272)
shape = SubResource("RectangleShape2D_1g1r4")

View File

@ -58,6 +58,7 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
focus_mode = 0
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
theme = ExtResource("1_ep8kc") theme = ExtResource("1_ep8kc")
toggle_mode = true toggle_mode = true

View File

@ -3,11 +3,24 @@ extends Node2D
var currentSpawnableScene : PackedScene = null var currentSpawnableScene : PackedScene = null
@onready var menuZone : Control = $Camera2D/CanvasLayer/PlayerUI.menuZone @onready var menuZone : Control = $Camera2D/CanvasLayer/PlayerUI.menuZone
@onready var enemy : CharacterBody2D = $"../Enemy" @onready var enemy : CharacterBody2D = $"../Enemy"
@onready var playableArea : Area2D = $"../PlayableArea"
var isInPlayableArea : bool = false
func _ready():
playableArea.mouse_entered.connect(entered_playable_area)
playableArea.mouse_exited.connect(exited_playable_area)
func _process(delta): func _process(delta):
handle_menu_inputs() handle_menu_inputs()
handle_spawn() handle_spawn()
func entered_playable_area():
isInPlayableArea = true
func exited_playable_area():
isInPlayableArea = false
func handle_menu_inputs(): func handle_menu_inputs():
if Input.is_action_just_pressed("fullscreen_toggle"): if Input.is_action_just_pressed("fullscreen_toggle"):
if get_window().mode == Window.MODE_EXCLUSIVE_FULLSCREEN: if get_window().mode == Window.MODE_EXCLUSIVE_FULLSCREEN:
@ -20,7 +33,7 @@ func handle_spawn():
spawn_current() spawn_current()
func spawn_current(): func spawn_current():
if is_in_menu() || currentSpawnableScene == null: if !isInPlayableArea || is_in_menu() || currentSpawnableScene == null:
return return
var spawnable = currentSpawnableScene.instantiate() var spawnable = currentSpawnableScene.instantiate()
spawnable.global_position = get_global_mouse_position() spawnable.global_position = get_global_mouse_position()

View File

@ -84,7 +84,6 @@ func endAttack():
animatedSprite.play("default") animatedSprite.play("default")
func receive_damage(dmg): func receive_damage(dmg):
print(currentHp - dmg)
if !isAlive: if !isAlive:
return return
if currentHp - dmg <= 0: if currentHp - dmg <= 0:
@ -102,7 +101,8 @@ func die():
isAlive = false isAlive = false
animatedSprite.stop() animatedSprite.stop()
animatedSprite.play("death") animatedSprite.play("death")
animatedSprite.disconnect("animation_finished", endAttack) if animatedSprite.is_connected("animation_finished", endAttack):
animatedSprite.disconnect("animation_finished", endAttack)
animatedSprite.connect("animation_finished", fadeOut) animatedSprite.connect("animation_finished", fadeOut)
func fadeOut(): func fadeOut():