Compare commits

..

No commits in common. "bbe9a17cfa73f3f8f8198b92f7b77ac3e358a798" and "86fa60a731940e8246458665c681549f17d810c3" have entirely different histories.

13 changed files with 86 additions and 115 deletions

View File

@ -20,6 +20,7 @@ config/icon="res://icon.png"
Global="*res://src/scripts/global.gd" Global="*res://src/scripts/global.gd"
Window="*res://src/scripts/window.gd" Window="*res://src/scripts/window.gd"
EnemyClass="*res://src/scripts/enemy_class.gd"
Music="*res://src/music/Music.tscn" Music="*res://src/music/Music.tscn"
[display] [display]

View File

@ -20,7 +20,7 @@ script = ExtResource( 2 )
use_parent_material = true use_parent_material = true
frames = ExtResource( 1 ) frames = ExtResource( 1 )
animation = "idle" animation = "idle"
frame = 3 frame = 1
playing = true playing = true
centered = false centered = false

View File

@ -1,4 +1,4 @@
extends "res://src/scripts/enemy_class.gd" extends EnemyClass
var velocity = Vector2.ZERO var velocity = Vector2.ZERO
var speed = 64 var speed = 64

View File

@ -1,4 +1,4 @@
extends "res://src/scripts/enemy_class.gd" extends EnemyClass
var dash_target = Vector2.ZERO var dash_target = Vector2.ZERO
var afterdash_timer = .0 var afterdash_timer = .0

View File

@ -1,4 +1,4 @@
extends "res://src/scripts/enemy_class.gd" extends EnemyClass
var velocity = Vector2.ZERO var velocity = Vector2.ZERO
var speed = 24 var speed = 24

View File

@ -8,7 +8,7 @@ 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 target var target: EnemyClass
var slowed = false var slowed = false
var speed = 80 var speed = 80
@ -92,16 +92,13 @@ func _draw():
draw_dashed_line(Vector2(12, 12), target.global_position - self.global_position + mob_offset, Color("ffde00"), 1) draw_dashed_line(Vector2(12, 12), target.global_position - self.global_position + mob_offset, Color("ffde00"), 1)
func _process(_delta): func _process(_delta):
if Global.playing: $Sprite.play("idle") if velocity == Vector2.ZERO else $Sprite.play("run")
$Sprite.play("idle") if velocity == Vector2.ZERO else $Sprite.play("run") if abs(velocity.x) > 10:
if abs(velocity.x) > 10: $Sprite.flip_h = true if velocity.x < 0 else false
$Sprite.flip_h = true if velocity.x < 0 else false
if velocity != Vector2.ZERO:
if velocity != Vector2.ZERO: $CPUParticles2D.emitting = true
$CPUParticles2D.emitting = true $CPUParticles2D.direction.x = 1 if velocity.x < 0 else -1
$CPUParticles2D.direction.x = 1 if velocity.x < 0 else -1
else:
$CPUParticles2D.emitting = false
else: else:
$CPUParticles2D.emitting = false $CPUParticles2D.emitting = false
@ -130,12 +127,7 @@ func _physics_process(delta):
else: else:
speed_multiplier = 1.0 speed_multiplier = 1.0
if Global.playing: velocity = move_and_slide(velocity * speed_multiplier)
$Sprite.playing = true
velocity = move_and_slide(velocity * speed_multiplier)
else:
$Sprite.playing = false
choose_target() choose_target()
if target != null and is_instance_valid(target) and not target.dead: if target != null and is_instance_valid(target) and not target.dead:

View File

@ -6,6 +6,9 @@
[ext_resource path="res://res/themes/8px.tres" type="Theme" id=4] [ext_resource path="res://res/themes/8px.tres" type="Theme" id=4]
[ext_resource path="res://src/models/player/Player.tscn" type="PackedScene" id=5] [ext_resource path="res://src/models/player/Player.tscn" type="PackedScene" id=5]
[ext_resource path="res://src/scenes/game/sprites/health/health.png" type="Texture" id=6] [ext_resource path="res://src/scenes/game/sprites/health/health.png" type="Texture" id=6]
[ext_resource path="res://src/scenes/game/sprites/stun/stun_placeholder_spriteframes.tres" type="SpriteFrames" id=7]
[ext_resource path="res://src/scenes/game/sprites/stun/stun_spriteframes.tres" type="SpriteFrames" id=8]
[ext_resource path="res://src/scenes/game/sprites/cards/Card.tscn" type="PackedScene" id=9]
[ext_resource path="res://src/scenes/game/sprites/player_icon.png" type="Texture" id=10] [ext_resource path="res://src/scenes/game/sprites/player_icon.png" type="Texture" id=10]
[ext_resource path="res://src/scenes/game/game.gd" type="Script" id=11] [ext_resource path="res://src/scenes/game/game.gd" type="Script" id=11]
[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]
@ -13,9 +16,6 @@
[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/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/models/card/Card.tscn" type="PackedScene" id=18]
[ext_resource path="res://src/scenes/game/sprites/stun/stun_placeholder_spriteframes.tres" type="SpriteFrames" id=19]
[sub_resource type="RectangleShape2D" id=2] [sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 10, 60 ) extents = Vector2( 10, 60 )
@ -50,9 +50,9 @@ region = Rect2( 0, 0, 31, 11 )
[sub_resource type="SpriteFrames" id=4] [sub_resource type="SpriteFrames" id=4]
animations = [ { animations = [ {
"frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ], "frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ],
"loop": true, "loop": false,
"name": "default", "name": "idle",
"speed": 5.0 "speed": 0.0
} ] } ]
[sub_resource type="Animation" id=5] [sub_resource type="Animation" id=5]
@ -179,26 +179,26 @@ margin_bottom = 2.0
margin_right = 40.0 margin_right = 40.0
margin_bottom = 40.0 margin_bottom = 40.0
[node name="Debuffs" type="Control" parent="UIWrapper/UI/Left"] [node name="Stun" type="Control" parent="UIWrapper/UI/Left"]
margin_right = 40.0 margin_right = 40.0
margin_bottom = 40.0 margin_bottom = 40.0
[node name="Slowed" type="AnimatedSprite" parent="UIWrapper/UI/Left/Debuffs"] [node name="StunPlaceholder1" type="AnimatedSprite" parent="UIWrapper/UI/Left/Stun"]
position = Vector2( 59, 144 ) position = Vector2( 59, 144 )
frames = ExtResource( 19 ) frames = ExtResource( 7 )
animation = "idle" animation = "idle"
[node name="Sprite" type="AnimatedSprite" parent="UIWrapper/UI/Left/Debuffs/Slowed"] [node name="StunIcon1" type="AnimatedSprite" parent="UIWrapper/UI/Left/Stun/StunPlaceholder1"]
frames = ExtResource( 17 ) frames = ExtResource( 8 )
animation = "idle" animation = "idle"
[node name="Stun" type="AnimatedSprite" parent="UIWrapper/UI/Left/Debuffs"] [node name="StunPlaceholder2" type="AnimatedSprite" parent="UIWrapper/UI/Left/Stun"]
position = Vector2( 76, 144 ) position = Vector2( 76, 144 )
frames = ExtResource( 19 ) frames = ExtResource( 7 )
animation = "idle" animation = "idle"
[node name="Sprite" type="AnimatedSprite" parent="UIWrapper/UI/Left/Debuffs/Stun"] [node name="StunIcon2" type="AnimatedSprite" parent="UIWrapper/UI/Left/Stun/StunPlaceholder2"]
frames = ExtResource( 17 ) frames = ExtResource( 8 )
animation = "idle" animation = "idle"
frame = 1 frame = 1
@ -209,7 +209,7 @@ margin_bottom = 40.0
[node name="HealthSprite" type="AnimatedSprite" parent="UIWrapper/UI/Left/Health"] [node name="HealthSprite" type="AnimatedSprite" parent="UIWrapper/UI/Left/Health"]
position = Vector2( 52, 156 ) position = Vector2( 52, 156 )
frames = SubResource( 4 ) frames = SubResource( 4 )
frame = 5 animation = "idle"
centered = false centered = false
[node name="PlayerIcon" type="Sprite" parent="UIWrapper/UI/Left"] [node name="PlayerIcon" type="Sprite" parent="UIWrapper/UI/Left"]
@ -247,47 +247,35 @@ script = ExtResource( 16 )
margin_right = 80.0 margin_right = 80.0
margin_bottom = 3.0 margin_bottom = 3.0
[node name="Cards" type="Control" parent="UIWrapper/UI/Center"]
visible = false
margin_right = 40.0
margin_bottom = 40.0
[node name="CardLeft" parent="UIWrapper/UI/Center/Cards" instance=ExtResource( 9 )]
position = Vector2( 11, 10 )
[node name="CardCenter" parent="UIWrapper/UI/Center/Cards" instance=ExtResource( 9 )]
position = Vector2( 113, 10 )
frame = 1
[node name="CardRight" parent="UIWrapper/UI/Center/Cards" instance=ExtResource( 9 )]
position = Vector2( 215, 10 )
frame = 2
[node name="Right" type="Control" parent="UIWrapper/UI"] [node name="Right" type="Control" parent="UIWrapper/UI"]
margin_right = 40.0 margin_right = 40.0
margin_bottom = 40.0 margin_bottom = 40.0
[node name="Cards" type="Control" parent="UIWrapper/UI"] [node name="Gameover" type="Control" parent="UIWrapper"]
margin_right = 320.0
margin_bottom = 120.0
[node name="LeftPlaceholder" type="Control" parent="UIWrapper/UI/Cards"]
margin_left = 8.0
margin_top = 8.0
margin_right = 102.0
margin_bottom = 111.0
[node name="Card" parent="UIWrapper/UI/Cards/LeftPlaceholder" instance=ExtResource( 18 )]
[node name="CenterPlaceholder" type="Control" parent="UIWrapper/UI/Cards"]
margin_left = 113.0
margin_top = 8.0
margin_right = 207.0
margin_bottom = 111.0
[node name="Card" parent="UIWrapper/UI/Cards/CenterPlaceholder" instance=ExtResource( 18 )]
[node name="RightPlaceholder" type="Control" parent="UIWrapper/UI/Cards"]
margin_left = 218.0
margin_top = 8.0
margin_right = 312.0
margin_bottom = 111.0
[node name="Card" parent="UIWrapper/UI/Cards/RightPlaceholder" instance=ExtResource( 18 )]
[node name="Gameover" type="Control" parent="UIWrapper/UI"]
margin_right = 320.0 margin_right = 320.0
margin_bottom = 180.0 margin_bottom = 180.0
[node name="Sprite" type="Sprite" parent="UIWrapper/UI/Gameover"] [node name="Sprite" type="Sprite" parent="UIWrapper/Gameover"]
modulate = Color( 1, 1, 1, 0 ) modulate = Color( 1, 1, 1, 0 )
texture = ExtResource( 15 ) texture = ExtResource( 15 )
centered = false centered = false
[node name="AnimationPlayer" type="AnimationPlayer" parent="UIWrapper/UI/Gameover"] [node name="AnimationPlayer" type="AnimationPlayer" parent="UIWrapper/Gameover"]
anims/RESET = SubResource( 5 ) anims/RESET = SubResource( 5 )
anims/gameover = SubResource( 6 ) anims/gameover = SubResource( 6 )

View File

@ -26,22 +26,16 @@ func _physics_process(delta):
difficulty = int(Global.play_time / 60) difficulty = int(Global.play_time / 60)
if difficulty != last_diff: if difficulty != last_diff:
Global.playing = false
last_diff = difficulty last_diff = difficulty
var cards = range(8) $UIWrapper/UI/Center/Cards.visible = true
for card_placeholder in $UIWrapper/UI/Cards.get_children():
randomize()
card_placeholder.get_node("Card").frame = cards.pop_at(randi()%cards.size())
$UIWrapper/UI/Cards.visible = true
#TODO Pause #TODO Pause
$UIWrapper/UI/LevelProgressBar/ColorRect.rect_size.x = (Global.play_time - difficulty * 60) / 60.0 * 300 $UIWrapper/UI/LevelProgressBar/ColorRect.rect_size.x = (Global.play_time - difficulty * 60) / 60.0 * 300
if Global.playing: for i in range(clamp(difficulty + 1, 1, 4)):
for i in range(clamp(difficulty + 1, 1, 4)): mob_timers[i] += delta
mob_timers[i] += delta if mob_timers[i] >= mob_threshold[i]:
if mob_timers[i] >= mob_threshold[i]: mob_timers[i] = .0
mob_timers[i] = .0 var mob_instance = mob_preloads[i].instance()
var mob_instance = mob_preloads[i].instance() $View/Enemies.add_child(mob_instance)
$View/Enemies.add_child(mob_instance)

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://src/models/card/sprites/cards_spriteframes.tres" type="SpriteFrames" id=1] [ext_resource path="res://src/scenes/game/sprites/cards/cards_spriteframes.tres" type="SpriteFrames" id=1]
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 47, 51.5 ) extents = Vector2( 47, 51.5 )

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -2,15 +2,15 @@
importer="texture" importer="texture"
type="StreamTexture" type="StreamTexture"
path="res://.import/cards.png-e5300b701a043110ff3e3d30fc9c32cf.stex" path="res://.import/cards.png-de0d7634707005f50aa7f118048a0217.stex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://src/models/card/sprites/cards.png" source_file="res://src/scenes/game/sprites/cards/cards.png"
dest_files=[ "res://.import/cards.png-e5300b701a043110ff3e3d30fc9c32cf.stex" ] dest_files=[ "res://.import/cards.png-de0d7634707005f50aa7f118048a0217.stex" ]
[params] [params]

View File

@ -1,6 +1,6 @@
[gd_resource type="SpriteFrames" load_steps=10 format=2] [gd_resource type="SpriteFrames" load_steps=10 format=2]
[ext_resource path="res://src/models/card/sprites/cards.png" type="Texture" id=1] [ext_resource path="res://src/scenes/game/sprites/cards/cards.png" type="Texture" id=1]
[sub_resource type="AtlasTexture" id=1] [sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 ) atlas = ExtResource( 1 )

View File

@ -30,39 +30,35 @@ func _process(delta):
func death(): func death():
dead = true dead = true
$Sprite.playing = false $Sprite.playing = false
death_position = self.global_position
$Area2D.call_deferred("free") $Area2D.call_deferred("free")
remove_from_group("enemy") remove_from_group("enemy")
material = empty_material material = empty_material
$Sprite.material = empty_material $Sprite.material = empty_material
func _physics_process(delta): func _physics_process(delta):
if Global.playing: if dead:
death_position = self.global_position
if dead:
self.global_position = death_position
dead_timer += delta
$Sprite.modulate.a = 1 - (dead_timer * 2)
if dead_timer >= 0.5:
self.call_deferred("free")
if poisoned:
poisoned_timer += delta
poison_damage_timer += delta
if poisoned_timer >= poisoned_time:
poisoned_timer = .0
poison_damage_timer = .0
poisoned = false
if poison_damage_timer >= 1:
deal_damage(poisoned_damage)
if frozen:
frozen_timer += delta
speed_multiplier = 0.5
if frozen_timer >= frozen_time:
frozen_time = 0
frozen = false
else:
speed_multiplier = 1
if not Global.playing:
self.global_position = death_position self.global_position = death_position
dead_timer += delta
$Sprite.modulate.a = 1 - (dead_timer * 2)
if dead_timer >= 0.5:
self.call_deferred("free")
if poisoned:
poisoned_timer += delta
poison_damage_timer += delta
if poisoned_timer >= poisoned_time:
poisoned_timer = .0
poison_damage_timer = .0
poisoned = false
if poison_damage_timer >= 1:
deal_damage(poisoned_damage)
if frozen:
frozen_timer += delta
speed_multiplier = 0.5
if frozen_timer >= frozen_time:
frozen_time = 0
frozen = false
else:
speed_multiplier = 1