Compare commits

..

No commits in common. "c3f57e231525f585c2801afb108153ee21145db4" and "0feaca291154e7141cc81793e020b0260b63110b" have entirely different histories.

12 changed files with 69 additions and 91 deletions

View File

@ -3,6 +3,7 @@
[ext_resource path="res://res/fonts/silkscreen/Silkscreen-Regular.ttf" type="DynamicFontData" id=1] [ext_resource path="res://res/fonts/silkscreen/Silkscreen-Regular.ttf" type="DynamicFontData" id=1]
[sub_resource type="DynamicFont" id=1] [sub_resource type="DynamicFont" id=1]
size = 8
font_data = ExtResource( 1 ) font_data = ExtResource( 1 )
[resource] [resource]

View File

@ -41,10 +41,8 @@ func area_entered(area):
prev_target = parent prev_target = parent
parent.deal_damage(damage) parent.deal_damage(damage)
parent.freeze_modifier = freeze_modifier parent.freeze_modifier = freeze_modifier
parent.frozen_timer = 0
parent.poison_damage = poison_damage parent.poison_damage = poison_damage
parent.poisoned_timer = 0 if ricochet_count >= bounced:
if bounced >= ricochet_count:
call_deferred("free") call_deferred("free")
choose_target() choose_target()
bounced += 1 bounced += 1

View File

@ -11,7 +11,7 @@ var shot = false
var sonic_wave var sonic_wave
func _ready(): func _ready():
hp = 7 hp = 15
func _physics_process(delta): func _physics_process(delta):
if not shooting: if not shooting:

View File

@ -16,7 +16,7 @@ use_parent_material = true
position = Vector2( -3, 0 ) position = Vector2( -3, 0 )
frames = ExtResource( 1 ) frames = ExtResource( 1 )
animation = "idle" animation = "idle"
frame = 2 frame = 3
playing = true playing = true
centered = false centered = false

View File

@ -6,7 +6,7 @@ var speed = 24
func _ready(): func _ready():
randomize() randomize()
global_position = [Vector2(33, 50), Vector2(287, 70)][randi()%2] global_position = [Vector2(33, 50), Vector2(287, 70)][randi()%2]
hp = 7 hp = 15
func _physics_process(delta): func _physics_process(delta):
global_position = global_position.move_toward(player.global_position + Vector2(8, 8), speed * delta * speed_multiplier) global_position = global_position.move_toward(player.global_position + Vector2(8, 8), speed * delta * speed_multiplier)

View File

@ -3,7 +3,6 @@ extends KinematicBody2D
onready var fireball_preload = preload("res://src/models/fireball/Fireball.tscn") onready var fireball_preload = preload("res://src/models/fireball/Fireball.tscn")
onready var bullet_preload = preload("res://src/models/bullet/Bullet.tscn") onready var bullet_preload = preload("res://src/models/bullet/Bullet.tscn")
onready var spell_holder = $"../../UIWrapper/UI/Center/SpellHolder" onready var spell_holder = $"../../UIWrapper/UI/Center/SpellHolder"
var colorize_material = load("res://res/shaders/colorize.tres")
var outline_material = load("res://res/shaders/outline_material.tres") var outline_material = load("res://res/shaders/outline_material.tres")
#var outline_material = load("res://res/shaders/empty_material.tres") #var outline_material = load("res://res/shaders/empty_material.tres")
var speed_multiplier: float = 1.0 var speed_multiplier: float = 1.0
@ -11,7 +10,6 @@ var invincibility_timer = .0
var velocity = Vector2.ZERO var velocity = Vector2.ZERO
var recharge_timer = .0 var recharge_timer = .0
var invincible = false var invincible = false
var stunned = false
var target var target
var slowed = false var slowed = false
var speed = 80 var speed = 80
@ -103,19 +101,16 @@ func _shoot():
bullet.freeze_modifier = freeze_modifier bullet.freeze_modifier = freeze_modifier
bullet.poison_damage = poison_damage bullet.poison_damage = poison_damage
bullet.speed_modifier = speed_modifier bullet.speed_modifier = speed_modifier
bullet.ricochet_count = ricochet_count
get_parent().add_child(bullet) get_parent().add_child(bullet)
bullet.global_position.x = self.global_position.x + 8 bullet.global_position.x = self.global_position.x + 8
bullet.global_position.y = self.global_position.y + 8 bullet.global_position.y = self.global_position.y + 8
for i in range(fireball_amount): bullet = fireball_preload.instance()
var fireball = fireball_preload.instance() bullet.target = target
fireball.target = target get_parent().add_child(bullet)
get_parent().add_child(fireball) bullet.global_position.x = self.global_position.x + 8
fireball.global_position.x = self.global_position.x + 8 bullet.global_position.y = self.global_position.y + 8
randomize()
fireball.global_position.y = self.global_position.y + 8 + randi()%8 - 4
func _draw(): func _draw():
if target != null and is_instance_valid(target) and not target.dead: if target != null and is_instance_valid(target) and not target.dead:
@ -148,6 +143,11 @@ func _process(_delta):
func _physics_process(delta): func _physics_process(delta):
get_input() get_input()
invincibility_timer += delta
if recharge_timer <= get_recharge():
recharge_timer += delta
var areas = $DirtCollision.get_overlapping_areas() var areas = $DirtCollision.get_overlapping_areas()
slowed = false slowed = false
for area in areas: for area in areas:
@ -171,9 +171,6 @@ func _physics_process(delta):
if Global.playing: if Global.playing:
$Sprite.playing = true $Sprite.playing = true
invincibility_timer += delta
if recharge_timer <= get_recharge():
recharge_timer += delta
velocity = move_and_slide(velocity * speed_multiplier) velocity = move_and_slide(velocity * speed_multiplier)
else: else:
$Sprite.playing = false $Sprite.playing = false
@ -182,6 +179,7 @@ func _physics_process(delta):
if Global.playing and target != null and is_instance_valid(target) and not target.dead: if Global.playing and target != null and is_instance_valid(target) and not target.dead:
target.material = outline_material target.material = outline_material
if recharge_timer >= get_recharge(): if recharge_timer >= get_recharge():
_shoot() _shoot()
recharge_timer = .0 recharge_timer = .0

View File

@ -1,55 +0,0 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://src/scenes/game/sprites/gameover.png" type="Texture" id=1]
[ext_resource path="res://src/scenes/death/death.gd" type="Script" id=2]
[sub_resource type="Animation" id=1]
length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 0 ) ]
}
[sub_resource type="Animation" id=2]
resource_name = "gameover"
length = 3.0
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1.5, 3 ),
"transitions": PoolRealArray( 29.8571, 2, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 1 ), Color( 0, 0, 0, 1 ) ]
}
[node name="Death" type="Node2D"]
script = ExtResource( 2 )
[node name="Gameover" type="Control" parent="."]
margin_right = 320.0
margin_bottom = 180.0
mouse_filter = 2
[node name="Sprite" type="Sprite" parent="Gameover"]
modulate = Color( 1, 1, 1, 0 )
texture = ExtResource( 1 )
centered = false
[node name="AnimationPlayer" type="AnimationPlayer" parent="Gameover"]
autoplay = "gameover"
anims/RESET = SubResource( 1 )
anims/gameover = SubResource( 2 )
[connection signal="animation_finished" from="Gameover/AnimationPlayer" to="." method="animation_finished"]

View File

@ -1,7 +0,0 @@
extends Node2D
func _ready():
AudioDead.play()
func animation_finished(anim_name):
Global.return_to_menu()

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=24 format=2] [gd_scene load_steps=27 format=2]
[ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1] [ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1]
[ext_resource path="res://src/scenes/game/sprites/background_houses.png" type="Texture" id=2] [ext_resource path="res://src/scenes/game/sprites/background_houses.png" type="Texture" id=2]
@ -14,6 +14,7 @@
[ext_resource path="res://src/scenes/game/sprites/ui_background.png" type="Texture" id=12] [ext_resource path="res://src/scenes/game/sprites/ui_background.png" type="Texture" id=12]
[ext_resource path="res://src/scenes/game/sprites/hatch1.png" type="Texture" id=13] [ext_resource path="res://src/scenes/game/sprites/hatch1.png" type="Texture" id=13]
[ext_resource path="res://src/scenes/game/sprites/hatch2.png" type="Texture" id=14] [ext_resource path="res://src/scenes/game/sprites/hatch2.png" type="Texture" id=14]
[ext_resource path="res://src/scenes/game/sprites/gameover.png" type="Texture" id=15]
[ext_resource path="res://src/scenes/game/spell_recharge_bar.gd" type="Script" id=16] [ext_resource path="res://src/scenes/game/spell_recharge_bar.gd" type="Script" id=16]
[ext_resource path="res://src/scenes/game/sprites/stun/stun_spriteframes.tres" type="SpriteFrames" id=17] [ext_resource path="res://src/scenes/game/sprites/stun/stun_spriteframes.tres" type="SpriteFrames" id=17]
[ext_resource path="res://src/models/card/Card.tscn" type="PackedScene" id=18] [ext_resource path="res://src/models/card/Card.tscn" type="PackedScene" id=18]
@ -28,6 +29,37 @@ extents = Vector2( 10, 60 )
[sub_resource type="RectangleShape2D" id=3] [sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 140, 10.125 ) extents = Vector2( 140, 10.125 )
[sub_resource type="Animation" id=5]
length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 0 ) ]
}
[sub_resource type="Animation" id=6]
resource_name = "gameover"
length = 3.0
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1, 1.5, 3 ),
"transitions": PoolRealArray( 3.24901, 29.8571, 2, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 1 ), Color( 0, 0, 0, 1 ) ]
}
[node name="Game" type="Node"] [node name="Game" type="Node"]
script = ExtResource( 11 ) script = ExtResource( 11 )
@ -295,3 +327,17 @@ id = 2
[node name="AudioCardSelect" type="AudioStreamPlayer" parent="UIWrapper/UI/Cards/RightPlaceholder"] [node name="AudioCardSelect" type="AudioStreamPlayer" parent="UIWrapper/UI/Cards/RightPlaceholder"]
stream = ExtResource( 9 ) stream = ExtResource( 9 )
[node name="Gameover" type="Control" parent="UIWrapper/UI"]
margin_right = 320.0
margin_bottom = 180.0
mouse_filter = 2
[node name="Sprite" type="Sprite" parent="UIWrapper/UI/Gameover"]
modulate = Color( 1, 1, 1, 0 )
texture = ExtResource( 15 )
centered = false
[node name="AnimationPlayer" type="AnimationPlayer" parent="UIWrapper/UI/Gameover"]
anims/RESET = SubResource( 5 )
anims/gameover = SubResource( 6 )

View File

@ -4,4 +4,4 @@ onready var player = get_tree().get_root().get_node("Game/View/Player")
var max_size = 80 var max_size = 80
func _process(delta): func _process(delta):
$ColorRect.rect_size.x = max_size * (clamp(player.recharge_timer, 0, player.get_recharge()) / player.get_recharge()) $ColorRect.rect_size.x = max_size * (player.recharge_timer / player.get_recharge())

View File

@ -56,17 +56,14 @@ func _physics_process(delta):
poison_damage = 0 poison_damage = 0
if poisoned_damage_timer >= 1: if poisoned_damage_timer >= 1:
deal_damage(poison_damage) deal_damage(poison_damage)
poisoned_damage_timer = 0
if freeze_modifier != 1: if freeze_modifier != 1:
$Sprite.modulate.b = 1.2
frozen_timer += delta frozen_timer += delta
speed_multiplier = freeze_modifier speed_multiplier = freeze_modifier
if frozen_timer >= frozen_time: if frozen_timer >= frozen_time:
frozen_time = 0 frozen_time = 0
freeze_modifier = 1 freeze_modifier = 1
else: else:
$Sprite.modulate.b = 1
speed_multiplier = 1 speed_multiplier = 1
if not Global.playing: if not Global.playing:

View File

@ -1,6 +1,5 @@
extends Node extends Node
var DEATH_SCENE = preload("res://src/scenes/death/Death.tscn")
var GAME_SCENE = preload("res://src/scenes/game/Game.tscn") var GAME_SCENE = preload("res://src/scenes/game/Game.tscn")
var MENU_SCENE = preload("res://src/scenes/menu/Menu.tscn") var MENU_SCENE = preload("res://src/scenes/menu/Menu.tscn")
@ -11,9 +10,6 @@ var health = 5
func game_start(): func game_start():
get_tree().change_scene_to(GAME_SCENE) get_tree().change_scene_to(GAME_SCENE)
func death_scene():
get_tree().change_scene_to(DEATH_SCENE)
func return_to_menu(): func return_to_menu():
playing = false playing = false
get_tree().change_scene_to(MENU_SCENE) get_tree().change_scene_to(MENU_SCENE)
@ -23,5 +19,9 @@ func add_health(amount):
get_tree().get_root().get_node("Game/UIWrapper/UI/Left/Health/HealthSprite").frame = health get_tree().get_root().get_node("Game/UIWrapper/UI/Left/Health/HealthSprite").frame = health
if health == 0: if health == 0:
playing = false playing = false
AudioDead.play()
get_tree().get_root().get_node("Game/View/Enemies").free() get_tree().get_root().get_node("Game/View/Enemies").free()
death_scene() var animplayer = get_tree().get_root().get_node("Game/UIWrapper/UI/Gameover/AnimationPlayer")
animplayer.play("gameover")
yield(animplayer, "animation_finished")
return_to_menu()