Skip to content

Commit

Permalink
Initial commit for week 3. Added some additional room decoration, lev…
Browse files Browse the repository at this point in the history
…el regen on level exit, mob generation, and initial mob behavior.
  • Loading branch information
berubejd committed Jul 6, 2020
1 parent b784227 commit eff2630
Show file tree
Hide file tree
Showing 48 changed files with 1,460 additions and 159 deletions.
14 changes: 14 additions & 0 deletions Effects/Bubble.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extends Node2D

onready var animation = $AnimationPlayer

func clear():
var current = animation.get_current_animation()

match current:
"Alert":
$Alert.visible = false
"Chase":
$Chase.visible = false

animation.stop()
81 changes: 81 additions & 0 deletions Effects/Bubble.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
[gd_scene load_steps=6 format=2]

[ext_resource path="res://Fonts/ThaleahFat.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://Effects/Bubble.gd" type="Script" id=2]

[sub_resource type="DynamicFont" id=1]
outline_size = 1
outline_color = Color( 0, 0, 0, 1 )
font_data = ExtResource( 1 )

[sub_resource type="Animation" id=2]
resource_name = "Alert"
length = 3.0
tracks/0/type = "value"
tracks/0/path = NodePath("Alert:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.5, 1, 1.5, 2, 2.5, 3 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1 ),
"update": 1,
"values": [ false, true, false, true, false, true, false ]
}

[sub_resource type="Animation" id=3]
resource_name = "Chase"
length = 1.5
tracks/0/type = "value"
tracks/0/path = NodePath("Chase:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.5, 1, 1.5 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ true, false, true, false ]
}

[node name="Bubble" type="Node2D"]
z_index = 1
script = ExtResource( 2 )

[node name="Alert" type="Label" parent="."]
visible = false
margin_left = -6.82016
margin_top = -24.236
margin_right = 9.17984
margin_bottom = -9.23597
custom_fonts/font = SubResource( 1 )
custom_colors/font_color = Color( 0.956863, 0.776471, 0.231373, 1 )
custom_colors/font_outline_modulate = Color( 0, 0, 0, 1 )
text = "?"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Chase" type="Label" parent="."]
visible = false
margin_left = -6.82016
margin_top = -24.236
margin_right = 9.17984
margin_bottom = -9.23597
custom_fonts/font = SubResource( 1 )
custom_colors/font_color = Color( 0.956863, 0.776471, 0.231373, 1 )
custom_colors/font_outline_modulate = Color( 0, 0, 0, 1 )
text = "!"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}

[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/Alert = SubResource( 2 )
anims/Chase = SubResource( 3 )
25 changes: 25 additions & 0 deletions Effects/HitEffect.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[gd_scene load_steps=5 format=2]

[ext_resource path="res://Effects/Sprites/HitEffect.png" type="Texture" id=1]

[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 24, 24 )

[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 1 )
region = Rect2( 24, 0, 24, 24 )

[sub_resource type="SpriteFrames" id=3]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ) ],
"loop": false,
"name": "default",
"speed": 10.0
} ]

[node name="HitEffect" type="AnimatedSprite"]
frames = SubResource( 3 )
frame = 1
playing = true
[connection signal="animation_finished" from="." to="." method="queue_free"]
Binary file added Effects/Sprites/HitEffect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Effects/Sprites/HitEffect.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/HitEffect.png-f5a3d3a1f1d6df534ee51df09be98487.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Effects/Sprites/HitEffect.png"
dest_files=[ "res://.import/HitEffect.png-f5a3d3a1f1d6df534ee51df09be98487.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
15 changes: 15 additions & 0 deletions Effects/WhiteColorShader.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
shader_type canvas_item;

uniform bool active = false;

void fragment() {
vec4 previous_color = texture(TEXTURE, UV);
vec4 white_color = vec4(1.0, 1.0, 1.0, previous_color.a);
vec4 new_color = previous_color;

if (active == true) {
new_color = white_color;
}

COLOR = new_color;
}
6 changes: 4 additions & 2 deletions Entities/Decoration/Candle.tscn
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=8 format=2]

[ext_resource path="res://Entities/Decoration/Sprites/Candle/candlestick_2.png" type="Texture" id=1]
[ext_resource path="res://Entities/Decoration/Sprites/Candle/candlestick_1.png" type="Texture" id=2]
[ext_resource path="res://Entities/Decoration/Sprites/Candle/candlestick_3.png" type="Texture" id=3]
[ext_resource path="res://Entities/Decoration/Sprites/Candle/candlestick_0.png" type="Texture" id=4]
[ext_resource path="res://Entities/Decoration/Flame.gd" type="Script" id=5]
[ext_resource path="res://Lights/Light.tscn" type="PackedScene" id=6]


[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ ExtResource( 4 ), ExtResource( 2 ), ExtResource( 1 ), ExtResource( 3 ) ],
Expand All @@ -15,11 +17,11 @@ animations = [ {
} ]

[node name="Candle" type="Node2D"]
script = ExtResource( 5 )

[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
position = Vector2( 8, 4 )
frames = SubResource( 1 )
frame = 1
playing = true

[node name="Light" parent="." instance=ExtResource( 6 )]
Expand Down
5 changes: 3 additions & 2 deletions Entities/Decoration/CandleHolder.tscn
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=9 format=2]

[ext_resource path="res://Entities/Decoration/Sprites/CandleHolder/candlestick_2_4.png" type="Texture" id=1]
[ext_resource path="res://Entities/Decoration/Sprites/CandleHolder/candlestick_2_3.png" type="Texture" id=2]
[ext_resource path="res://Entities/Decoration/Sprites/CandleHolder/candlestick_2_2.png" type="Texture" id=3]
[ext_resource path="res://Entities/Decoration/Sprites/CandleHolder/candlestick_2_1.png" type="Texture" id=4]
[ext_resource path="res://Entities/Decoration/Flame.gd" type="Script" id=5]
[ext_resource path="res://Lights/Light.tscn" type="PackedScene" id=6]

[sub_resource type="SpriteFrames" id=1]
Expand All @@ -18,11 +19,11 @@ animations = [ {
extents = Vector2( 4, 3.42194 )

[node name="CandleHolder" type="StaticBody2D"]
script = ExtResource( 5 )

[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
position = Vector2( 8, 8 )
frames = SubResource( 1 )
frame = 1
playing = true

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
Expand Down
47 changes: 47 additions & 0 deletions Entities/Decoration/Cauldron.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[gd_scene load_steps=10 format=2]

[ext_resource path="res://Lights/Light.tscn" type="PackedScene" id=2]
[ext_resource path="res://Entities/Decoration/Sprites/Cauldron/cauldron_blue_3.png" type="Texture" id=4]
[ext_resource path="res://Entities/Decoration/Sprites/Cauldron/cauldron_blue_4.png" type="Texture" id=5]
[ext_resource path="res://Entities/Decoration/Sprites/Cauldron/cauldron_blue_1.png" type="Texture" id=6]
[ext_resource path="res://Entities/Decoration/Sprites/Cauldron/cauldron_blue_2.png" type="Texture" id=7]
[ext_resource path="res://Entities/Decoration/Sprites/Cauldron/cauldron_blue_5.png" type="Texture" id=8]

[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ ExtResource( 6 ), ExtResource( 7 ), ExtResource( 4 ), ExtResource( 5 ), ExtResource( 8 ) ],
"loop": true,
"name": "default",
"speed": 2.0
} ]

[sub_resource type="CapsuleShape2D" id=2]
radius = 4.58025
height = 6.3634

[sub_resource type="OccluderPolygon2D" id=3]
cull_mode = 1
polygon = PoolVector2Array( -6.69359, -4.72556, -2.41421, -7.46155, 2.63686, -7.3914, 6.84608, -4.58525, 6.84608, -1.56864, 2.5667, 1.30767, -2.55452, 1.30767, -6.69359, -1.70895 )

[node name="Cauldron" type="StaticBody2D"]

[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
position = Vector2( 8, 8 )
frames = SubResource( 1 )
frame = 2
playing = true

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
visible = false
position = Vector2( 8, 11.851 )
rotation = -1.57079
shape = SubResource( 2 )

[node name="Light" parent="." instance=ExtResource( 2 )]
position = Vector2( 8, 4.906 )
texture_scale = 0.01

[node name="LightOccluder2D" type="LightOccluder2D" parent="."]
show_behind_parent = true
position = Vector2( 7.99753, 7.92737 )
occluder = SubResource( 3 )
8 changes: 8 additions & 0 deletions Entities/Decoration/Flame.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extends Node2D

onready var animation = $AnimatedSprite

func _ready():
# Switch up
animation.frame = randi() % 4
animation.speed_scale = rand_range(0.9, 1.1)
7 changes: 7 additions & 0 deletions Entities/Decoration/Fountain.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends StaticBody2D

onready var light = $Light

func _on_Area2D_body_entered(body):
# This should include a signal to act on the player
light.enabled = false
52 changes: 52 additions & 0 deletions Entities/Decoration/Fountain.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[gd_scene load_steps=8 format=2]

[ext_resource path="res://Lights/Light.tscn" type="PackedScene" id=1]
[ext_resource path="res://Entities/Decoration/Sprites/Other/SmallShadow.png" type="Texture" id=2]
[ext_resource path="res://Entities/Decoration/Fountain.gd" type="Script" id=3]
[ext_resource path="res://Entities/Decoration/Sprites/Other/fountain.png" type="Texture" id=4]

[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 5.93288, 5.78033 )

[sub_resource type="OccluderPolygon2D" id=2]
cull_mode = 1
polygon = PoolVector2Array( 2.14048, 13.3379, 5.51751, 11.3514, 10.4837, 11.3514, 13.5297, 13.6028, 11.6094, 15.523, 4.39183, 15.523 )

[sub_resource type="RectangleShape2D" id=3]

[node name="Fountain" type="StaticBody2D"]
script = ExtResource( 3 )

[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 8, 8 )
texture = ExtResource( 4 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
visible = false
position = Vector2( 7.912, 9.945 )
shape = SubResource( 1 )

[node name="Light" parent="." instance=ExtResource( 1 )]
position = Vector2( 7.98346, 4.84092 )
scale = Vector2( 2.71823, 1.8792 )
texture_scale = 0.01
color = Color( 0.529412, 0.596078, 0.913725, 1 )
energy = 1.2

[node name="LightOccluder2D" type="LightOccluder2D" parent="."]
visible = false
occluder = SubResource( 2 )

[node name="Shadow" type="Sprite" parent="."]
position = Vector2( 8.24394, 14.1372 )
scale = Vector2( 1.88068, 1.05794 )
texture = ExtResource( 2 )

[node name="Area2D" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 2

[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2( 7.81353, 8.80678 )
shape = SubResource( 3 )
[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered" flags=6]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Entities/Decoration/Sprites/Cauldron/cauldron_blue_0.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/cauldron_blue_0.png-9697eedd4e608df2d9a7876f4dd2c0b1.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Entities/Decoration/Sprites/Cauldron/cauldron_blue_0.png"
dest_files=[ "res://.import/cauldron_blue_0.png-9697eedd4e608df2d9a7876f4dd2c0b1.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit eff2630

Please sign in to comment.