Compare commits
3 Commits
a49d9b140e
...
8fcb652f17
Author | SHA1 | Date |
---|---|---|
Luna Brovchuk | 8fcb652f17 | |
Luna Brovchuk | 0364fc179b | |
Luna Brovchuk | ccac9da653 |
|
@ -3,7 +3,6 @@
|
||||||
[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]
|
||||||
|
|
|
@ -22,6 +22,7 @@ script = ExtResource( 2 )
|
||||||
use_parent_material = true
|
use_parent_material = true
|
||||||
frames = ExtResource( 1 )
|
frames = ExtResource( 1 )
|
||||||
animation = "idle"
|
animation = "idle"
|
||||||
|
frame = 1
|
||||||
playing = true
|
playing = true
|
||||||
centered = false
|
centered = false
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,12 @@ func _physics_process(delta):
|
||||||
$Sprite.global_position.y += sin(Time.get_ticks_msec() * 0.01) / 3
|
$Sprite.global_position.y += sin(Time.get_ticks_msec() * 0.01) / 3
|
||||||
|
|
||||||
velocity *= speed * speed_multiplier
|
velocity *= speed * speed_multiplier
|
||||||
if not shooting:
|
if Global.playing:
|
||||||
velocity = move_and_slide(velocity)
|
$Sprite.playing = true
|
||||||
|
if not shooting:
|
||||||
|
velocity = move_and_slide(velocity)
|
||||||
|
else:
|
||||||
|
$Sprite.playing = false
|
||||||
|
|
||||||
func _shoot():
|
func _shoot():
|
||||||
sonic_wave = sonic_wave_preload.instance()
|
sonic_wave = sonic_wave_preload.instance()
|
||||||
|
|
|
@ -124,7 +124,6 @@ visible = false
|
||||||
position = Vector2( 11, 2 )
|
position = Vector2( 11, 2 )
|
||||||
frames = ExtResource( 5 )
|
frames = ExtResource( 5 )
|
||||||
animation = "idle"
|
animation = "idle"
|
||||||
frame = 3
|
|
||||||
playing = true
|
playing = true
|
||||||
|
|
||||||
[node name="AudioGetDamage" type="AudioStreamPlayer" parent="."]
|
[node name="AudioGetDamage" type="AudioStreamPlayer" parent="."]
|
||||||
|
|
|
@ -138,7 +138,7 @@ func _physics_process(delta):
|
||||||
|
|
||||||
choose_target()
|
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
|
target.material = outline_material
|
||||||
|
|
||||||
if recharge_timer >= get_recharge():
|
if recharge_timer >= get_recharge():
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
[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/cast_time.png" type="Texture" id=7]
|
[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/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]
|
||||||
|
@ -29,14 +29,14 @@ extents = Vector2( 140, 10.125 )
|
||||||
atlas = ExtResource( 6 )
|
atlas = ExtResource( 6 )
|
||||||
region = Rect2( 155, 0, 31, 11 )
|
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]
|
[sub_resource type="AtlasTexture" id=8]
|
||||||
atlas = ExtResource( 6 )
|
atlas = ExtResource( 6 )
|
||||||
region = Rect2( 124, 0, 31, 11 )
|
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]
|
[sub_resource type="AtlasTexture" id=10]
|
||||||
atlas = ExtResource( 6 )
|
atlas = ExtResource( 6 )
|
||||||
region = Rect2( 62, 0, 31, 11 )
|
region = Rect2( 62, 0, 31, 11 )
|
||||||
|
@ -51,10 +51,10 @@ region = Rect2( 0, 0, 31, 11 )
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id=4]
|
[sub_resource type="SpriteFrames" id=4]
|
||||||
animations = [ {
|
animations = [ {
|
||||||
"frames": [ SubResource( 7 ), SubResource( 9 ), SubResource( 8 ), 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]
|
||||||
|
@ -155,10 +155,12 @@ color = Color( 0.133333, 0.133333, 0.137255, 1 )
|
||||||
|
|
||||||
[node name="UIWrapper" type="CanvasLayer" parent="."]
|
[node name="UIWrapper" type="CanvasLayer" parent="."]
|
||||||
layer = 3
|
layer = 3
|
||||||
|
follow_viewport_enable = true
|
||||||
|
|
||||||
[node name="UI" type="Control" parent="UIWrapper"]
|
[node name="UI" type="Control" parent="UIWrapper"]
|
||||||
margin_right = 40.0
|
margin_right = 320.0
|
||||||
margin_bottom = 40.0
|
margin_bottom = 180.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="Background" type="TextureRect" parent="UIWrapper/UI"]
|
[node name="Background" type="TextureRect" parent="UIWrapper/UI"]
|
||||||
margin_top = 120.0
|
margin_top = 120.0
|
||||||
|
@ -216,7 +218,6 @@ 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"
|
|
||||||
centered = false
|
centered = false
|
||||||
|
|
||||||
[node name="PlayerIcon" type="Sprite" parent="UIWrapper/UI/Left"]
|
[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"]
|
[node name="Damage" type="Sprite" parent="UIWrapper/UI/Right/Damage"]
|
||||||
position = Vector2( 256, 160 )
|
position = Vector2( 256, 160 )
|
||||||
texture = ExtResource( 8 )
|
|
||||||
|
|
||||||
[node name="Cards" type="Control" parent="UIWrapper/UI"]
|
[node name="Cards" type="Control" parent="UIWrapper/UI"]
|
||||||
visible = false
|
visible = false
|
||||||
margin_right = 320.0
|
margin_right = 320.0
|
||||||
margin_bottom = 120.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_left = 8.0
|
||||||
margin_top = 8.0
|
margin_top = 8.0
|
||||||
margin_right = 102.0
|
margin_right = 102.0
|
||||||
margin_bottom = 111.0
|
margin_bottom = 111.0
|
||||||
|
mouse_filter = 1
|
||||||
|
script = ExtResource( 8 )
|
||||||
|
|
||||||
[node name="Card" parent="UIWrapper/UI/Cards/LeftPlaceholder" instance=ExtResource( 18 )]
|
[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_left = 113.0
|
||||||
margin_top = 8.0
|
margin_top = 8.0
|
||||||
margin_right = 207.0
|
margin_right = 207.0
|
||||||
margin_bottom = 111.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="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_left = 218.0
|
||||||
margin_top = 8.0
|
margin_top = 8.0
|
||||||
margin_right = 312.0
|
margin_right = 312.0
|
||||||
margin_bottom = 111.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="Card" parent="UIWrapper/UI/Cards/RightPlaceholder" instance=ExtResource( 18 )]
|
||||||
|
|
||||||
[node name="Gameover" type="Control" parent="UIWrapper/UI"]
|
[node name="Gameover" type="Control" parent="UIWrapper/UI"]
|
||||||
margin_right = 320.0
|
margin_right = 320.0
|
||||||
margin_bottom = 180.0
|
margin_bottom = 180.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="UIWrapper/UI/Gameover"]
|
[node name="Sprite" type="Sprite" parent="UIWrapper/UI/Gameover"]
|
||||||
modulate = Color( 1, 1, 1, 0 )
|
modulate = Color( 1, 1, 1, 0 )
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
var selected_card = null
|
||||||
var difficulty = 0
|
var difficulty = 0
|
||||||
var last_diff = 0
|
var last_diff = 0
|
||||||
var mob_preloads = [
|
var mob_preloads = [
|
||||||
|
@ -17,8 +18,14 @@ func _ready():
|
||||||
Global.health = 5
|
Global.health = 5
|
||||||
Global.add_health(0)
|
Global.add_health(0)
|
||||||
|
|
||||||
func pause():
|
func _input(event):
|
||||||
Global.playing = false
|
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):
|
func _physics_process(delta):
|
||||||
if Global.playing:
|
if Global.playing:
|
||||||
|
@ -29,9 +36,10 @@ func _physics_process(delta):
|
||||||
Global.playing = false
|
Global.playing = false
|
||||||
last_diff = difficulty
|
last_diff = difficulty
|
||||||
var cards = range(8)
|
var cards = range(8)
|
||||||
for card_placeholder in $UIWrapper/UI/Cards.get_children():
|
for child in $UIWrapper/UI/Cards.get_children():
|
||||||
randomize()
|
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/Cards.visible = true
|
||||||
|
|
||||||
$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
|
||||||
|
@ -43,4 +51,8 @@ func _physics_process(delta):
|
||||||
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)
|
||||||
|
|
||||||
|
func select_card():
|
||||||
|
if selected_card != null:
|
||||||
|
Global.playing = true
|
||||||
|
$UIWrapper/UI/Cards.visible = false
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
extends KinematicBody2D
|
extends KinematicBody2D
|
||||||
|
|
||||||
onready var player = $"../../Player"
|
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 hp
|
||||||
var dead = false
|
var dead = false
|
||||||
var dead_timer = .0
|
var dead_timer = .0
|
||||||
|
|
Loading…
Reference in New Issue