Compare commits

..

3 Commits

Author SHA1 Message Date
Luna Brovchuk 8fcb652f17 Minor Fix 2023-10-02 17:42:26 +02:00
Luna Brovchuk 0364fc179b Merge branch 'main' of http://meowo.cc:3000/meowo/LD54 2023-10-02 17:41:07 +02:00
Luna Brovchuk ccac9da653 Fix Card Selection Menu, Pause 2023-10-02 17:39:11 +02:00
9 changed files with 70 additions and 27 deletions

View File

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

View File

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

View File

@ -48,8 +48,12 @@ func _physics_process(delta):
$Sprite.global_position.y += sin(Time.get_ticks_msec() * 0.01) / 3
velocity *= speed * speed_multiplier
if not shooting:
velocity = move_and_slide(velocity)
if Global.playing:
$Sprite.playing = true
if not shooting:
velocity = move_and_slide(velocity)
else:
$Sprite.playing = false
func _shoot():
sonic_wave = sonic_wave_preload.instance()

View File

@ -124,7 +124,6 @@ visible = false
position = Vector2( 11, 2 )
frames = ExtResource( 5 )
animation = "idle"
frame = 3
playing = true
[node name="AudioGetDamage" type="AudioStreamPlayer" parent="."]

View File

@ -138,7 +138,7 @@ func _physics_process(delta):
choose_target()
if 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
if recharge_timer >= get_recharge():

View File

@ -7,7 +7,7 @@
[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/cast_time.png" type="Texture" id=7]
[ext_resource path="res://src/scenes/game/sprites/damage.png" type="Texture" id=8]
[ext_resource path="res://src/scenes/game/card_placeholder.gd" type="Script" id=8]
[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/sprites/ui_background.png" type="Texture" id=12]
@ -29,14 +29,14 @@ extents = Vector2( 140, 10.125 )
atlas = ExtResource( 6 )
region = Rect2( 155, 0, 31, 11 )
[sub_resource type="AtlasTexture" id=9]
atlas = ExtResource( 6 )
region = Rect2( 93, 0, 31, 11 )
[sub_resource type="AtlasTexture" id=8]
atlas = ExtResource( 6 )
region = Rect2( 124, 0, 31, 11 )
[sub_resource type="AtlasTexture" id=9]
atlas = ExtResource( 6 )
region = Rect2( 93, 0, 31, 11 )
[sub_resource type="AtlasTexture" id=10]
atlas = ExtResource( 6 )
region = Rect2( 62, 0, 31, 11 )
@ -51,10 +51,10 @@ region = Rect2( 0, 0, 31, 11 )
[sub_resource type="SpriteFrames" id=4]
animations = [ {
"frames": [ SubResource( 7 ), SubResource( 9 ), SubResource( 8 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ],
"loop": false,
"name": "idle",
"speed": 0.0
"frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[sub_resource type="Animation" id=5]
@ -155,10 +155,12 @@ color = Color( 0.133333, 0.133333, 0.137255, 1 )
[node name="UIWrapper" type="CanvasLayer" parent="."]
layer = 3
follow_viewport_enable = true
[node name="UI" type="Control" parent="UIWrapper"]
margin_right = 40.0
margin_bottom = 40.0
margin_right = 320.0
margin_bottom = 180.0
mouse_filter = 2
[node name="Background" type="TextureRect" parent="UIWrapper/UI"]
margin_top = 120.0
@ -216,7 +218,6 @@ margin_bottom = 40.0
[node name="HealthSprite" type="AnimatedSprite" parent="UIWrapper/UI/Left/Health"]
position = Vector2( 52, 156 )
frames = SubResource( 4 )
animation = "idle"
centered = false
[node name="PlayerIcon" type="Sprite" parent="UIWrapper/UI/Left"]
@ -277,40 +278,49 @@ margin_bottom = 40.0
[node name="Damage" type="Sprite" parent="UIWrapper/UI/Right/Damage"]
position = Vector2( 256, 160 )
texture = ExtResource( 8 )
[node name="Cards" type="Control" parent="UIWrapper/UI"]
visible = false
margin_right = 320.0
margin_bottom = 120.0
mouse_filter = 2
[node name="LeftPlaceholder" type="Control" parent="UIWrapper/UI/Cards"]
[node name="LeftPlaceholder" type="Control" parent="UIWrapper/UI/Cards" groups=["card_placeholder"]]
margin_left = 8.0
margin_top = 8.0
margin_right = 102.0
margin_bottom = 111.0
mouse_filter = 1
script = ExtResource( 8 )
[node name="Card" parent="UIWrapper/UI/Cards/LeftPlaceholder" instance=ExtResource( 18 )]
[node name="CenterPlaceholder" type="Control" parent="UIWrapper/UI/Cards"]
[node name="CenterPlaceholder" type="Control" parent="UIWrapper/UI/Cards" groups=["card_placeholder"]]
margin_left = 113.0
margin_top = 8.0
margin_right = 207.0
margin_bottom = 111.0
mouse_filter = 1
script = ExtResource( 8 )
id = 1
[node name="Card" parent="UIWrapper/UI/Cards/CenterPlaceholder" instance=ExtResource( 18 )]
[node name="RightPlaceholder" type="Control" parent="UIWrapper/UI/Cards"]
[node name="RightPlaceholder" type="Control" parent="UIWrapper/UI/Cards" groups=["card_placeholder"]]
margin_left = 218.0
margin_top = 8.0
margin_right = 312.0
margin_bottom = 111.0
mouse_filter = 1
script = ExtResource( 8 )
id = 2
[node name="Card" parent="UIWrapper/UI/Cards/RightPlaceholder" instance=ExtResource( 18 )]
[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 )

View File

@ -0,0 +1,18 @@
extends Control
export var id: int
onready var game = get_tree().get_root().get_node("Game")
func _process(delta):
if not Global.playing:
if game.selected_card == null or game.selected_card == id:
self.modulate = Color(1, 1, 1, 1)
else:
self.modulate = Color(0.2, 0.2, 0.2, 1)
func _ready():
connect("mouse_entered", self, "select_hover", [self])
func select_hover(node):
game.selected_card = id

View File

@ -1,5 +1,6 @@
extends Node
var selected_card = null
var difficulty = 0
var last_diff = 0
var mob_preloads = [
@ -17,8 +18,14 @@ func _ready():
Global.health = 5
Global.add_health(0)
func pause():
Global.playing = false
func _input(event):
if not Global.playing:
if event is InputEventMouseButton:
select_card()
if event is InputEventMouseMotion:
var pos = event.position
if pos.x < 8 or pos.y < 8 or pos.x > 312 or pos.y > 112:
selected_card = null
func _physics_process(delta):
if Global.playing:
@ -29,9 +36,10 @@ func _physics_process(delta):
Global.playing = false
last_diff = difficulty
var cards = range(8)
for card_placeholder in $UIWrapper/UI/Cards.get_children():
for child in $UIWrapper/UI/Cards.get_children():
randomize()
card_placeholder.get_node("Card").frame = cards.pop_at(randi()%cards.size())
if child.is_in_group("card_placeholder"):
child.get_node("Card").frame = cards.pop_at(randi()%cards.size())
$UIWrapper/UI/Cards.visible = true
$UIWrapper/UI/LevelProgressBar/ColorRect.rect_size.x = (Global.play_time - difficulty * 60) / 60.0 * 300
@ -43,4 +51,8 @@ func _physics_process(delta):
mob_timers[i] = .0
var mob_instance = mob_preloads[i].instance()
$View/Enemies.add_child(mob_instance)
func select_card():
if selected_card != null:
Global.playing = true
$UIWrapper/UI/Cards.visible = false

View File

@ -1,7 +1,7 @@
extends KinematicBody2D
onready var player = $"../../Player"
var empty_material = load("res://res/shaders/empty_material.tscn")
var empty_material = load("res://res/shaders/empty_material.tres")
var hp
var dead = false
var dead_timer = .0