Compare commits
No commits in common. "306cde4a8a208eb704c1f57ab360ff4209e0510a" and "feef84ebbe4db3c44d62911a66c35221d3897dcf" have entirely different histories.
306cde4a8a
...
feef84ebbe
|
@ -89,5 +89,6 @@ common/enable_pause_aware_picking=true
|
|||
|
||||
[rendering]
|
||||
|
||||
quality/driver/driver_name="GLES2"
|
||||
environment/default_clear_color=Color( 0, 0, 0, 1 )
|
||||
environment/default_environment="res://default_env.tres"
|
||||
|
|
|
@ -15,5 +15,5 @@ void fragment(){
|
|||
|
||||
[resource]
|
||||
shader = SubResource( 3 )
|
||||
shader_param/active = true
|
||||
shader_param/color = Color( 1, 1, 1, 0 )
|
||||
shader_param/active = false
|
||||
shader_param/color = Color( 1, 1, 1, 1 )
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
[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]
|
||||
|
|
|
@ -2,15 +2,13 @@ extends KinematicBody2D
|
|||
|
||||
var velocity = Vector2.ZERO
|
||||
var speed = 128
|
||||
var poison_damage = 0
|
||||
var poisoned = false
|
||||
var damage = 5
|
||||
var freeze_modifier = 1
|
||||
var bounced = 0
|
||||
var ricochet_count = 0
|
||||
var frozen = false
|
||||
var bounced = false
|
||||
var ricochet = false
|
||||
var prev_target
|
||||
var target
|
||||
var explosive_damage = 0
|
||||
var speed_modifier = 1
|
||||
|
||||
func choose_target():
|
||||
target = null
|
||||
|
@ -31,7 +29,7 @@ func _physics_process(delta):
|
|||
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 * speed_modifier)
|
||||
self.global_position = self.global_position.move_toward(target_center, delta * speed)
|
||||
else:
|
||||
self.call_deferred("free")
|
||||
|
||||
|
@ -40,10 +38,9 @@ func area_entered(area):
|
|||
if parent.is_in_group("enemy") and parent != prev_target:
|
||||
prev_target = parent
|
||||
parent.deal_damage(damage)
|
||||
parent.freeze_modifier = freeze_modifier
|
||||
parent.poison_damage = poison_damage
|
||||
if ricochet_count >= bounced:
|
||||
parent.frozen = frozen
|
||||
parent.poisoned = poisoned
|
||||
if bounced or not ricochet:
|
||||
call_deferred("free")
|
||||
choose_target()
|
||||
bounced += 1
|
||||
damage *= 0.5
|
||||
bounced = true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
[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]
|
||||
|
@ -6,12 +6,7 @@
|
|||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 2, 2 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 2, 2 )
|
||||
|
||||
[node name="Fireball" type="KinematicBody2D"]
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
|
@ -24,7 +19,4 @@ centered = false
|
|||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[connection signal="area_entered" from="Area2D" to="." method="area_entered"]
|
||||
|
|
|
@ -2,9 +2,8 @@ extends KinematicBody2D
|
|||
|
||||
onready var fireball_preload = preload("res://src/models/fireball/Fireball.tscn")
|
||||
onready var bullet_preload = preload("res://src/models/bullet/Bullet.tscn")
|
||||
onready var spell_holder = $"../../UIWrapper/UI/Center/SpellHolder"
|
||||
var outline_material = load("res://res/shaders/outline_material.tres")
|
||||
#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 invincibility_timer = .0
|
||||
var velocity = Vector2.ZERO
|
||||
|
@ -67,41 +66,11 @@ func area_entered(area):
|
|||
get_tree().get_root().get_node("Game/View/Camera2D").current = true
|
||||
|
||||
func get_recharge():
|
||||
var recharge = 2.0
|
||||
for modifier in spell_holder.modifiers:
|
||||
if modifier == "rapidfire":
|
||||
recharge /= 2.0
|
||||
return recharge
|
||||
return 2.0
|
||||
|
||||
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.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)
|
||||
bullet.global_position.x = self.global_position.x + 8
|
||||
bullet.global_position.y = self.global_position.y + 8
|
||||
|
|
|
@ -32,14 +32,14 @@ extents = Vector2( 140, 10.125 )
|
|||
atlas = ExtResource( 6 )
|
||||
region = Rect2( 155, 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=8]
|
||||
atlas = ExtResource( 6 )
|
||||
region = Rect2( 124, 0, 31, 11 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=10]
|
||||
atlas = ExtResource( 6 )
|
||||
region = Rect2( 62, 0, 31, 11 )
|
||||
|
@ -54,10 +54,10 @@ region = Rect2( 0, 0, 31, 11 )
|
|||
|
||||
[sub_resource type="SpriteFrames" id=4]
|
||||
animations = [ {
|
||||
"frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ],
|
||||
"loop": true,
|
||||
"name": "default",
|
||||
"speed": 5.0
|
||||
"frames": [ SubResource( 7 ), SubResource( 9 ), SubResource( 8 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ],
|
||||
"loop": false,
|
||||
"name": "idle",
|
||||
"speed": 0.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="Animation" id=5]
|
||||
|
|
Loading…
Reference in New Issue