Fireball, Time Bar, Level System, Spawn System, Fix Rat Shaders, Sort Ingame UI
parent
fae81e7d82
commit
ee51bdc8c5
|
@ -0,0 +1,11 @@
|
|||
[gd_resource type="Theme" load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://res/fonts/silkscreen/Silkscreen-Regular.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 8
|
||||
extra_spacing_bottom = -8
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[resource]
|
||||
default_font = SubResource( 1 )
|
|
@ -1,7 +1,7 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://src/models/bullet/bullet.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/models/bullet/Bullet.gd" type="Script" id=2]
|
||||
[ext_resource path="res://src/models/bullet/bullet.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 3.5, 3.5 )
|
||||
|
|
|
@ -12,7 +12,11 @@ func _physics_process(delta):
|
|||
var target_texture = target.get_node("Sprite").frames.get_frame("idle", 0)
|
||||
var target_sprite_size = Vector2(target_texture.get_width(), target_texture.get_width())
|
||||
var target_center = target.global_position + (target_sprite_size / 2)
|
||||
if target.is_in_group("rat"):
|
||||
target_center = target.global_position + Vector2(0, 2)
|
||||
self.global_position = self.global_position.move_toward(target_center, delta * speed)
|
||||
else:
|
||||
self.call_deferred("free")
|
||||
|
||||
func area_entered(area):
|
||||
var parent = area.get_parent()
|
|
@ -25,7 +25,7 @@ flip_h = true
|
|||
use_parent_material = true
|
||||
frames = ExtResource( 1 )
|
||||
animation = "idle"
|
||||
frame = 4
|
||||
frame = 1
|
||||
playing = true
|
||||
centered = false
|
||||
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://src/models/enemies/rat/sprites/rat_spriteframes.tres" type="SpriteFrames" id=1]
|
||||
[ext_resource path="res://src/models/enemies/rat/Rat.gd" type="Script" id=2]
|
||||
[ext_resource path="res://src/models/enemies/rat/rat.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 8, 3 )
|
||||
extents = Vector2( 8, 3.5 )
|
||||
|
||||
[node name="Rat" type="KinematicBody2D" groups=["enemy", "rat"]]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="AnimatedSprite" parent="."]
|
||||
use_parent_material = true
|
||||
frames = ExtResource( 1 )
|
||||
animation = "idle"
|
||||
frame = 3
|
||||
playing = true
|
||||
centered = false
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
position = Vector2( 12, 6 )
|
||||
position = Vector2( 11, 5.5 )
|
||||
shape = SubResource( 1 )
|
||||
|
|
|
@ -2,7 +2,7 @@ extends EnemyClass
|
|||
|
||||
onready var player = $"../../Player"
|
||||
var velocity = Vector2.ZERO
|
||||
var speed = 48
|
||||
var speed = 24
|
||||
|
||||
func _ready():
|
||||
hp = 15
|
||||
|
@ -11,4 +11,4 @@ func _process(delta):
|
|||
$Sprite.flip_h = true if player.global_position.x > self.global_position.x else false
|
||||
|
||||
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)
|
|
@ -0,0 +1,22 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://src/models/fireball/fireball.png" type="Texture" id=1]
|
||||
[ext_resource path="res://src/models/fireball/fireball.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 2, 2 )
|
||||
|
||||
[node name="Fireball" type="KinematicBody2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
position = Vector2( -2, -2 )
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[connection signal="area_entered" from="Area2D" to="." method="area_entered"]
|
|
@ -0,0 +1,30 @@
|
|||
extends KinematicBody2D
|
||||
|
||||
var velocity = Vector2.ZERO
|
||||
var sin_timer = .0
|
||||
var speed = 64
|
||||
var poisoned = false
|
||||
var damage = 5
|
||||
var frozen = false
|
||||
var target
|
||||
|
||||
func _physics_process(delta):
|
||||
sin_timer += delta
|
||||
if target != null and is_instance_valid(target):
|
||||
var target_texture = target.get_node("Sprite").frames.get_frame("idle", 0)
|
||||
var target_sprite_size = Vector2(target_texture.get_width(), target_texture.get_width())
|
||||
var target_center = target.global_position + (target_sprite_size / 2)
|
||||
if target.is_in_group("rat"):
|
||||
target_center = target.global_position + Vector2(0, 2)
|
||||
var angle = global_position.angle_to_point(target_center)
|
||||
move_and_collide(Vector2(speed, sin(sin_timer * 10) * 90).rotated(angle + PI) * delta)
|
||||
else:
|
||||
self.call_deferred("free")
|
||||
|
||||
func area_entered(area):
|
||||
var parent = area.get_parent()
|
||||
if parent.is_in_group("enemy"):
|
||||
parent.deal_damage(damage)
|
||||
parent.frozen = frozen
|
||||
parent.poisoned = poisoned
|
||||
call_deferred("free")
|
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/fireball.png-cd7388e1024202929d5484e59b923c94.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/models/fireball/fireball.png"
|
||||
dest_files=[ "res://.import/fireball.png-cd7388e1024202929d5484e59b923c94.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
|
@ -5,10 +5,10 @@
|
|||
[ext_resource path="res://res/shaders/colorize.tres" type="Material" id=3]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 3.5, 3.5 )
|
||||
extents = Vector2( 4, 4 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 3.5, 9 )
|
||||
extents = Vector2( 7, 11 )
|
||||
|
||||
[sub_resource type="Animation" id=4]
|
||||
resource_name = "RESET"
|
||||
|
@ -48,7 +48,7 @@ tracks/0/loop_wrap = true
|
|||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 2 ),
|
||||
"times": PoolRealArray( 0, 0.9 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ true, false ]
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
extends KinematicBody2D
|
||||
|
||||
onready var fireball_preload = preload("res://src/models/fireball/Fireball.tscn")
|
||||
onready var bullet_preload = preload("res://src/models/bullet/Bullet.tscn")
|
||||
var outline_material = load("res://res/shaders/outline_material.tres")
|
||||
var speed_multiplier: float = 1.0
|
||||
|
@ -70,6 +71,12 @@ func _shoot():
|
|||
get_parent().add_child(bullet)
|
||||
bullet.global_position.x = self.global_position.x + 8
|
||||
bullet.global_position.y = self.global_position.y + 8
|
||||
|
||||
bullet = fireball_preload.instance()
|
||||
bullet.target = target
|
||||
get_parent().add_child(bullet)
|
||||
bullet.global_position.x = self.global_position.x + 8
|
||||
bullet.global_position.y = self.global_position.y + 8
|
||||
|
||||
func _draw():
|
||||
if target != null and is_instance_valid(target):
|
||||
|
@ -79,6 +86,8 @@ func _draw():
|
|||
mob_offset = Vector2(8, 7)
|
||||
if target.is_in_group("ghost"):
|
||||
mob_offset = Vector2(8, 12)
|
||||
if target.is_in_group("rat"):
|
||||
mob_offset = Vector2(14, 6)
|
||||
draw_dashed_line(Vector2(12, 12), target.global_position - self.global_position + mob_offset, Color("ffde00"), 1)
|
||||
|
||||
func _process(_delta):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
[gd_scene load_steps=21 format=2]
|
||||
[gd_scene load_steps=17 format=2]
|
||||
|
||||
[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/spell_holder.gd" type="Script" id=3]
|
||||
[ext_resource path="res://res/fonts/silkscreen/Silkscreen-Regular.ttf" type="DynamicFontData" 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/scenes/game/sprites/health/3.png" type="Texture" id=6]
|
||||
[ext_resource path="res://src/scenes/game/sprites/health/1.png" type="Texture" id=7]
|
||||
|
@ -12,9 +12,6 @@
|
|||
[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]
|
||||
[ext_resource path="res://src/models/enemies/trash_can/TrashCan.tscn" type="PackedScene" id=13]
|
||||
[ext_resource path="res://src/models/enemies/bat/Bat.tscn" type="PackedScene" id=14]
|
||||
[ext_resource path="res://src/models/enemies/ghost/Ghost.tscn" type="PackedScene" id=15]
|
||||
[ext_resource path="res://src/scenes/game/spell_recharge_bar.gd" type="Script" id=16]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
|
@ -23,10 +20,6 @@ extents = Vector2( 10, 60 )
|
|||
[sub_resource type="RectangleShape2D" id=3]
|
||||
extents = Vector2( 140, 10.125 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 8
|
||||
font_data = ExtResource( 4 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=4]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 9 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 6 ) ],
|
||||
|
@ -78,16 +71,6 @@ z_index = 1
|
|||
|
||||
[node name="Enemies" type="Node2D" parent="View"]
|
||||
|
||||
[node name="TrashCan" parent="View/Enemies" instance=ExtResource( 13 )]
|
||||
|
||||
[node name="Bat" parent="View/Enemies" instance=ExtResource( 14 )]
|
||||
|
||||
[node name="Bat2" parent="View/Enemies" instance=ExtResource( 14 )]
|
||||
position = Vector2( 142, 54 )
|
||||
|
||||
[node name="Ghost" parent="View/Enemies" instance=ExtResource( 15 )]
|
||||
position = Vector2( 509, 100 )
|
||||
|
||||
[node name="CPUParticles2D" type="CPUParticles2D" parent="View"]
|
||||
position = Vector2( 160, 90 )
|
||||
amount = 9
|
||||
|
@ -113,43 +96,65 @@ margin_bottom = 180.0
|
|||
texture = ExtResource( 12 )
|
||||
expand = true
|
||||
|
||||
[node name="SpellHolder" type="Control" parent="UIWrapper/UI"]
|
||||
[node name="LevelProgressBar" type="Control" parent="UIWrapper/UI"]
|
||||
margin_left = 10.0
|
||||
margin_top = 126.0
|
||||
margin_right = 310.0
|
||||
margin_bottom = 128.0
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="UIWrapper/UI/LevelProgressBar"]
|
||||
margin_right = 300.0
|
||||
margin_bottom = 2.0
|
||||
|
||||
[node name="Left" type="Control" parent="UIWrapper/UI"]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="Health" type="Control" parent="UIWrapper/UI/Left"]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="HealthSprite" type="AnimatedSprite" parent="UIWrapper/UI/Left/Health"]
|
||||
position = Vector2( 52, 148 )
|
||||
frames = SubResource( 4 )
|
||||
frame = 3
|
||||
centered = false
|
||||
|
||||
[node name="PlayerIcon" type="Sprite" parent="UIWrapper/UI/Left"]
|
||||
position = Vector2( 10, 136 )
|
||||
texture = ExtResource( 10 )
|
||||
centered = false
|
||||
|
||||
[node name="Center" type="Control" parent="UIWrapper/UI"]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="SpellHolder" type="Control" parent="UIWrapper/UI/Center"]
|
||||
margin_left = 120.0
|
||||
margin_top = 145.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 159.0
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Text" type="Label" parent="UIWrapper/UI/SpellHolder"]
|
||||
[node name="Text" type="Label" parent="UIWrapper/UI/Center/SpellHolder"]
|
||||
margin_left = 1.0
|
||||
margin_top = -14.0
|
||||
margin_right = 79.0
|
||||
margin_bottom = 7.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
theme = ExtResource( 4 )
|
||||
text = "spell modifiers"
|
||||
|
||||
[node name="Health" type="Control" parent="UIWrapper/UI"]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="HealthSprite" type="AnimatedSprite" parent="UIWrapper/UI/Health"]
|
||||
position = Vector2( 70, 145 )
|
||||
frames = SubResource( 4 )
|
||||
frame = 2
|
||||
centered = false
|
||||
|
||||
[node name="SpellRechargeBar" type="Control" parent="UIWrapper/UI"]
|
||||
[node name="SpellRechargeBar" type="Control" parent="UIWrapper/UI/Center"]
|
||||
margin_left = 120.0
|
||||
margin_top = 162.0
|
||||
margin_right = 200.0
|
||||
margin_bottom = 165.0
|
||||
script = ExtResource( 16 )
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="UIWrapper/UI/SpellRechargeBar"]
|
||||
[node name="ColorRect" type="ColorRect" parent="UIWrapper/UI/Center/SpellRechargeBar"]
|
||||
margin_right = 80.0
|
||||
margin_bottom = 3.0
|
||||
|
||||
[node name="PlayerIcon" type="Sprite" parent="UIWrapper/UI"]
|
||||
position = Vector2( 20, 134 )
|
||||
texture = ExtResource( 10 )
|
||||
centered = false
|
||||
[node name="Right" type="Control" parent="UIWrapper/UI"]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
|
|
|
@ -1,5 +1,38 @@
|
|||
extends Node
|
||||
|
||||
var difficulty = 0
|
||||
var last_diff = 0
|
||||
var mob_preloads = [
|
||||
preload("res://src/models/enemies/rat/Rat.tscn"),
|
||||
preload("res://src/models/enemies/bat/Bat.tscn"),
|
||||
preload("res://src/models/enemies/trash_can/TrashCan.tscn"),
|
||||
preload("res://src/models/enemies/ghost/Ghost.tscn"),
|
||||
]
|
||||
var mob_timers = [.0, .0, .0, .0]
|
||||
var mob_threshold = [5, 7, 10, 7]
|
||||
|
||||
func _ready():
|
||||
Global.play_time = .0
|
||||
Global.health = 3
|
||||
Global.add_health(0)
|
||||
|
||||
func pause():
|
||||
Global.playing = false
|
||||
|
||||
func _physics_process(delta):
|
||||
if Global.playing:
|
||||
Global.play_time += delta
|
||||
|
||||
difficulty = int(Global.play_time / 60)
|
||||
if difficulty != last_diff:
|
||||
last_diff = difficulty
|
||||
# TODO perk selection
|
||||
|
||||
$UIWrapper/UI/LevelProgressBar/ColorRect.rect_size.x = (Global.play_time - difficulty * 60) / 60.0 * 300
|
||||
|
||||
for i in range(clamp(difficulty + 1, 1, 4)):
|
||||
mob_timers[i] += delta
|
||||
if mob_timers[i] >= mob_threshold[i]:
|
||||
mob_timers[i] = .0
|
||||
var mob_instance = mob_preloads[i].instance()
|
||||
$View/Enemies.add_child(mob_instance)
|
||||
|
|
|
@ -4,6 +4,7 @@ var GAME_SCENE = preload("res://src/scenes/game/Game.tscn")
|
|||
var MENU_SCENE = preload("res://src/scenes/menu/Menu.tscn")
|
||||
|
||||
var playing = true
|
||||
var play_time = .0
|
||||
var health = 2
|
||||
|
||||
func game_start():
|
||||
|
|
Loading…
Reference in New Issue