Compare commits

..

2 Commits

Author SHA1 Message Date
Luna Brovchuk bbe9a17cfa Merge branch 'main' of http://meowo.cc:3000/meowo/LD54 2023-10-02 16:24:07 +02:00
Luna Brovchuk e451dfdaa9 Create Cards, Fix Enemy Class 2023-10-02 16:22:35 +02:00
13 changed files with 115 additions and 86 deletions

View File

@ -20,7 +20,6 @@ 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

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://src/scenes/game/sprites/cards/cards_spriteframes.tres" type="SpriteFrames" id=1] [ext_resource path="res://src/models/card/sprites/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-de0d7634707005f50aa7f118048a0217.stex" path="res://.import/cards.png-e5300b701a043110ff3e3d30fc9c32cf.stex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://src/scenes/game/sprites/cards/cards.png" source_file="res://src/models/card/sprites/cards.png"
dest_files=[ "res://.import/cards.png-de0d7634707005f50aa7f118048a0217.stex" ] dest_files=[ "res://.import/cards.png-e5300b701a043110ff3e3d30fc9c32cf.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/scenes/game/sprites/cards/cards.png" type="Texture" id=1] [ext_resource path="res://src/models/card/sprites/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

@ -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 = 1 frame = 3
playing = true playing = true
centered = false centered = false

View File

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

View File

@ -1,4 +1,4 @@
extends EnemyClass extends "res://src/scripts/enemy_class.gd"
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 EnemyClass extends "res://src/scripts/enemy_class.gd"
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: EnemyClass var target
var slowed = false var slowed = false
var speed = 80 var speed = 80
@ -92,13 +92,16 @@ 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):
$Sprite.play("idle") if velocity == Vector2.ZERO else $Sprite.play("run") if Global.playing:
if abs(velocity.x) > 10: $Sprite.play("idle") if velocity == Vector2.ZERO else $Sprite.play("run")
$Sprite.flip_h = true if velocity.x < 0 else false if abs(velocity.x) > 10:
$Sprite.flip_h = true if velocity.x < 0 else false
if velocity != Vector2.ZERO:
$CPUParticles2D.emitting = true if velocity != Vector2.ZERO:
$CPUParticles2D.direction.x = 1 if velocity.x < 0 else -1 $CPUParticles2D.emitting = true
$CPUParticles2D.direction.x = 1 if velocity.x < 0 else -1
else:
$CPUParticles2D.emitting = false
else: else:
$CPUParticles2D.emitting = false $CPUParticles2D.emitting = false
@ -127,7 +130,12 @@ func _physics_process(delta):
else: else:
speed_multiplier = 1.0 speed_multiplier = 1.0
velocity = move_and_slide(velocity * speed_multiplier) if Global.playing:
$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,9 +6,6 @@
[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]
@ -16,6 +13,9 @@
[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": false, "loop": true,
"name": "idle", "name": "default",
"speed": 0.0 "speed": 5.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="Stun" type="Control" parent="UIWrapper/UI/Left"] [node name="Debuffs" type="Control" parent="UIWrapper/UI/Left"]
margin_right = 40.0 margin_right = 40.0
margin_bottom = 40.0 margin_bottom = 40.0
[node name="StunPlaceholder1" type="AnimatedSprite" parent="UIWrapper/UI/Left/Stun"] [node name="Slowed" type="AnimatedSprite" parent="UIWrapper/UI/Left/Debuffs"]
position = Vector2( 59, 144 ) position = Vector2( 59, 144 )
frames = ExtResource( 7 ) frames = ExtResource( 19 )
animation = "idle" animation = "idle"
[node name="StunIcon1" type="AnimatedSprite" parent="UIWrapper/UI/Left/Stun/StunPlaceholder1"] [node name="Sprite" type="AnimatedSprite" parent="UIWrapper/UI/Left/Debuffs/Slowed"]
frames = ExtResource( 8 ) frames = ExtResource( 17 )
animation = "idle" animation = "idle"
[node name="StunPlaceholder2" type="AnimatedSprite" parent="UIWrapper/UI/Left/Stun"] [node name="Stun" type="AnimatedSprite" parent="UIWrapper/UI/Left/Debuffs"]
position = Vector2( 76, 144 ) position = Vector2( 76, 144 )
frames = ExtResource( 7 ) frames = ExtResource( 19 )
animation = "idle" animation = "idle"
[node name="StunIcon2" type="AnimatedSprite" parent="UIWrapper/UI/Left/Stun/StunPlaceholder2"] [node name="Sprite" type="AnimatedSprite" parent="UIWrapper/UI/Left/Debuffs/Stun"]
frames = ExtResource( 8 ) frames = ExtResource( 17 )
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 )
animation = "idle" frame = 5
centered = false centered = false
[node name="PlayerIcon" type="Sprite" parent="UIWrapper/UI/Left"] [node name="PlayerIcon" type="Sprite" parent="UIWrapper/UI/Left"]
@ -247,35 +247,47 @@ 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="Gameover" type="Control" parent="UIWrapper"] [node name="Cards" type="Control" parent="UIWrapper/UI"]
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/Gameover"] [node name="Sprite" type="Sprite" parent="UIWrapper/UI/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/Gameover"] [node name="AnimationPlayer" type="AnimationPlayer" parent="UIWrapper/UI/Gameover"]
anims/RESET = SubResource( 5 ) anims/RESET = SubResource( 5 )
anims/gameover = SubResource( 6 ) anims/gameover = SubResource( 6 )

View File

@ -26,16 +26,22 @@ 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
$UIWrapper/UI/Center/Cards.visible = true var cards = range(8)
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
for i in range(clamp(difficulty + 1, 1, 4)): if Global.playing:
mob_timers[i] += delta for i in range(clamp(difficulty + 1, 1, 4)):
if mob_timers[i] >= mob_threshold[i]: mob_timers[i] += delta
mob_timers[i] = .0 if mob_timers[i] >= mob_threshold[i]:
var mob_instance = mob_preloads[i].instance() mob_timers[i] = .0
$View/Enemies.add_child(mob_instance) var mob_instance = mob_preloads[i].instance()
$View/Enemies.add_child(mob_instance)

View File

@ -30,35 +30,39 @@ 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 dead: if Global.playing:
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