Compare commits
2 Commits
feef84ebbe
...
306cde4a8a
Author | SHA1 | Date |
---|---|---|
Luna Brovchuk | 306cde4a8a | |
Luna Brovchuk | bd0a0c2fc4 |
|
@ -89,6 +89,5 @@ common/enable_pause_aware_picking=true
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
quality/driver/driver_name="GLES2"
|
|
||||||
environment/default_clear_color=Color( 0, 0, 0, 1 )
|
environment/default_clear_color=Color( 0, 0, 0, 1 )
|
||||||
environment/default_environment="res://default_env.tres"
|
environment/default_environment="res://default_env.tres"
|
||||||
|
|
|
@ -15,5 +15,5 @@ void fragment(){
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
shader = SubResource( 3 )
|
shader = SubResource( 3 )
|
||||||
shader_param/active = false
|
shader_param/active = true
|
||||||
shader_param/color = Color( 1, 1, 1, 1 )
|
shader_param/color = Color( 1, 1, 1, 0 )
|
||||||
|
|
|
@ -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]
|
||||||
|
|
|
@ -2,13 +2,15 @@ extends KinematicBody2D
|
||||||
|
|
||||||
var velocity = Vector2.ZERO
|
var velocity = Vector2.ZERO
|
||||||
var speed = 128
|
var speed = 128
|
||||||
var poisoned = false
|
var poison_damage = 0
|
||||||
var damage = 5
|
var damage = 5
|
||||||
var frozen = false
|
var freeze_modifier = 1
|
||||||
var bounced = false
|
var bounced = 0
|
||||||
var ricochet = false
|
var ricochet_count = 0
|
||||||
var prev_target
|
var prev_target
|
||||||
var target
|
var target
|
||||||
|
var explosive_damage = 0
|
||||||
|
var speed_modifier = 1
|
||||||
|
|
||||||
func choose_target():
|
func choose_target():
|
||||||
target = null
|
target = null
|
||||||
|
@ -29,7 +31,7 @@ func _physics_process(delta):
|
||||||
var target_center = target.global_position + (target_sprite_size / 2)
|
var target_center = target.global_position + (target_sprite_size / 2)
|
||||||
if target.is_in_group("rat"):
|
if target.is_in_group("rat"):
|
||||||
target_center = target.global_position + Vector2(0, 2)
|
target_center = target.global_position + Vector2(0, 2)
|
||||||
self.global_position = self.global_position.move_toward(target_center, delta * speed)
|
self.global_position = self.global_position.move_toward(target_center, delta * speed * speed_modifier)
|
||||||
else:
|
else:
|
||||||
self.call_deferred("free")
|
self.call_deferred("free")
|
||||||
|
|
||||||
|
@ -38,9 +40,10 @@ func area_entered(area):
|
||||||
if parent.is_in_group("enemy") and parent != prev_target:
|
if parent.is_in_group("enemy") and parent != prev_target:
|
||||||
prev_target = parent
|
prev_target = parent
|
||||||
parent.deal_damage(damage)
|
parent.deal_damage(damage)
|
||||||
parent.frozen = frozen
|
parent.freeze_modifier = freeze_modifier
|
||||||
parent.poisoned = poisoned
|
parent.poison_damage = poison_damage
|
||||||
if bounced or not ricochet:
|
if ricochet_count >= bounced:
|
||||||
call_deferred("free")
|
call_deferred("free")
|
||||||
choose_target()
|
choose_target()
|
||||||
bounced = true
|
bounced += 1
|
||||||
|
damage *= 0.5
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/models/fireball/fireball.png" type="Texture" id=1]
|
[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]
|
[ext_resource path="res://src/models/fireball/fireball.gd" type="Script" id=2]
|
||||||
|
@ -6,7 +6,12 @@
|
||||||
[sub_resource type="RectangleShape2D" id=1]
|
[sub_resource type="RectangleShape2D" id=1]
|
||||||
extents = Vector2( 2, 2 )
|
extents = Vector2( 2, 2 )
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=2]
|
||||||
|
extents = Vector2( 2, 2 )
|
||||||
|
|
||||||
[node name="Fireball" type="KinematicBody2D"]
|
[node name="Fireball" type="KinematicBody2D"]
|
||||||
|
collision_layer = 4
|
||||||
|
collision_mask = 4
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="."]
|
[node name="Sprite" type="Sprite" parent="."]
|
||||||
|
@ -19,4 +24,7 @@ centered = false
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource( 2 )
|
||||||
|
|
||||||
[connection signal="area_entered" from="Area2D" to="." method="area_entered"]
|
[connection signal="area_entered" from="Area2D" to="." method="area_entered"]
|
||||||
|
|
|
@ -2,8 +2,9 @@ extends KinematicBody2D
|
||||||
|
|
||||||
onready var fireball_preload = preload("res://src/models/fireball/Fireball.tscn")
|
onready var fireball_preload = preload("res://src/models/fireball/Fireball.tscn")
|
||||||
onready var bullet_preload = preload("res://src/models/bullet/Bullet.tscn")
|
onready var bullet_preload = preload("res://src/models/bullet/Bullet.tscn")
|
||||||
#var outline_material = load("res://res/shaders/outline_material.tres")
|
onready var spell_holder = $"../../UIWrapper/UI/Center/SpellHolder"
|
||||||
var outline_material = load("res://res/shaders/empty_material.tres")
|
var outline_material = load("res://res/shaders/outline_material.tres")
|
||||||
|
#var outline_material = load("res://res/shaders/empty_material.tres")
|
||||||
var speed_multiplier: float = 1.0
|
var speed_multiplier: float = 1.0
|
||||||
var invincibility_timer = .0
|
var invincibility_timer = .0
|
||||||
var velocity = Vector2.ZERO
|
var velocity = Vector2.ZERO
|
||||||
|
@ -66,11 +67,41 @@ func area_entered(area):
|
||||||
get_tree().get_root().get_node("Game/View/Camera2D").current = true
|
get_tree().get_root().get_node("Game/View/Camera2D").current = true
|
||||||
|
|
||||||
func get_recharge():
|
func get_recharge():
|
||||||
return 2.0
|
var recharge = 2.0
|
||||||
|
for modifier in spell_holder.modifiers:
|
||||||
|
if modifier == "rapidfire":
|
||||||
|
recharge /= 2.0
|
||||||
|
return recharge
|
||||||
|
|
||||||
func _shoot():
|
func _shoot():
|
||||||
|
var ricochet_count = 0
|
||||||
|
var dmg_multiplier = 1
|
||||||
|
var explosive_damage = 0
|
||||||
|
var fireball_amount = 0
|
||||||
|
var freeze_modifier = 1
|
||||||
|
var poison_damage = 0
|
||||||
|
var speed_modifier = 1
|
||||||
|
|
||||||
|
for modifier in spell_holder.modifiers:
|
||||||
|
match modifier:
|
||||||
|
"ricochet": ricochet_count += 1
|
||||||
|
"big_magic": dmg_multiplier *= 1.25
|
||||||
|
"explode": explosive_damage += 10
|
||||||
|
"fireball": fireball_amount += 1
|
||||||
|
"freeze": freeze_modifier /= 2.0
|
||||||
|
"poison": poison_damage += 5
|
||||||
|
"quick_magic": speed_modifier *= 1.5
|
||||||
|
|
||||||
bullet = bullet_preload.instance()
|
bullet = bullet_preload.instance()
|
||||||
bullet.target = target
|
bullet.target = target
|
||||||
|
|
||||||
|
bullet.damage *= dmg_multiplier
|
||||||
|
bullet.scale = Vector2(dmg_multiplier, dmg_multiplier)
|
||||||
|
bullet.explosive_damage = explosive_damage
|
||||||
|
bullet.freeze_modifier = freeze_modifier
|
||||||
|
bullet.poison_damage = poison_damage
|
||||||
|
bullet.speed_modifier = speed_modifier
|
||||||
|
|
||||||
get_parent().add_child(bullet)
|
get_parent().add_child(bullet)
|
||||||
bullet.global_position.x = self.global_position.x + 8
|
bullet.global_position.x = self.global_position.x + 8
|
||||||
bullet.global_position.y = self.global_position.y + 8
|
bullet.global_position.y = self.global_position.y + 8
|
||||||
|
|
|
@ -32,14 +32,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 )
|
||||||
|
@ -54,10 +54,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]
|
||||||
|
|
Loading…
Reference in New Issue