All projectiles work!

This commit is contained in:
Logan 2020-07-20 23:24:09 -05:00
parent 2b53f970e5
commit b4b2a984e3
32 changed files with 333 additions and 197 deletions

View file

@ -0,0 +1,6 @@
extends Node
var position: Vector2 = Vector2()
var health: float = -1
var energy: float = -1
var unlocked: Array = [Globals.Conduit2]

View file

@ -1,40 +1,18 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://ai/Hell Projectile.gd" type="Script" id=1]
[ext_resource path="res://art/Bad Fireball.png" type="Texture" id=2]
[sub_resource type="Animation" id=1]
resource_name = "Fireeball"
length = 0.2
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("Bad Fireball:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ 1, 0 ]
}
[ext_resource path="res://art/Fireball.png" type="Texture" id=2]
[sub_resource type="CircleShape2D" id=2]
radius = 4.54199
[node name="KinematicBody2D" type="KinematicBody2D"]
collision_layer = 8
collision_layer = 16
collision_mask = 3
script = ExtResource( 1 )
[node name="BadFireball" type="Sprite" parent="."]
texture = ExtResource( 2 )
hframes = 2
[node name="AnimationPlayer" type="AnimationPlayer" parent="BadFireball"]
autoplay = "Fireeball"
anims/Fireeball = SubResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 2 )

View file

@ -3,18 +3,23 @@ extends KinematicBody2D
class_name Enemy
var speed = 60
var gravity = 500
var gravity = 200
var health = 1
var knockback_amount = 1000
var knockback = Vector2.ZERO
const UP = Vector2(0, -1)
var velocity = Vector2()
func get_player_position():
return Player.position
func get_type():
return "enemy"
func apply_gravity(delta, modifier = 1):
velocity.y += gravity * delta * modifier
if is_on_wall() and is_on_floor():
velocity.y = -150
func do_knockback(normal):
knockback = normal

View file

@ -1,14 +1,7 @@
extends Projectile
extends EnemyProjectile
func launch_right():
velocity = (Vector2.RIGHT * speed)
func launch_left():
velocity = (Vector2.LEFT * speed)
func launch_upleft():
velocity = (Vector2(1, -1).normalized() * speed)
func launch_upright():
velocity = (Vector2(-1, -1).normalized() * speed)
func on_impact(collision):
if collision.collider.has_method("get_type"):
collision.collider.set_health(collision.collider.get_health() - 1)
var c = collision.collider
if c.has_method("get_type") and c.get_type() == "player":
Player.health -= 1
queue_free()

View file

@ -1,71 +1,47 @@
extends KinematicBody2D
extends Enemy
var Hell_Projectile = preload("res://ai/BadFireball.tscn")
var speed = 60
var gravity =500
var health = .5
const UP = Vector2(0, -1)
onready var ShootDelay : Timer = $ShootDelay
onready var ProjectileSpawn: Node2D = $Position2D
onready var PlayerRaycast: RayCast2D = $PlayerRaycast
var velocity = Vector2()
func apply_gravity(delta, modifier = 1):
velocity.y += gravity * delta * modifier
func _ready():
health = 0.5
func _physics_process(_delta):
var dist = global_position.distance_to(Globals.player)
if Globals.player != null:
if $RayCast2D.get_collider() != null && $RayCast2D.get_collider().has_method("get_type") and $RayCast2D.get_collider().get_type() == "player":
velocity = Vector2(0, 0)
if ShootDelay.is_stopped():
var temp = Hell_Projectile.instance()
get_tree().current_scene.add_child(temp)
temp.global_position = ProjectileSpawn.global_position
temp.launch_left()
ShootDelay.start()
queue_free()
elif $RayCast2D2.get_collider() != null && $RayCast2D2.get_collider().has_method("get_type") and $RayCast2D2.get_collider().get_type() == "player":
velocity = Vector2(0, 0)
if ShootDelay.is_stopped():
var temp = Hell_Projectile.instance()
get_tree().current_scene.add_child(temp)
temp.global_position = ProjectileSpawn.global_position
temp.launch_right()
ShootDelay.start()
queue_free()
elif $RayCast2D3.get_collider() != null && $RayCast2D3.get_collider().has_method("get_type") and $RayCast2D3.get_collider().get_type() == "player":
velocity = Vector2(0, 0)
if ShootDelay.is_stopped():
var temp = Hell_Projectile.instance()
get_tree().current_scene.add_child(temp)
temp.global_position = ProjectileSpawn.global_position
temp.launch_upleft()
ShootDelay.start()
queue_free()
elif $RayCast2D4.get_collider() != null && $RayCast2D4.get_collider().has_method("get_type") and $RayCast2D4.get_collider().get_type() == "player":
velocity = Vector2(0, 0)
if ShootDelay.is_stopped():
var temp = Hell_Projectile.instance()
get_tree().current_scene.add_child(temp)
temp.global_position = ProjectileSpawn.global_position
temp.launch_upright()
ShootDelay.start()
queue_free()
if knockback != Vector2.ZERO:
knockback = lerp(knockback, Vector2.ZERO, 0.5)
move_and_slide(-knockback * knockback_amount)
if knockback.x < 1 and -1 < knockback.x and knockback.y < 1 and -1 < knockback.y:
knockback = Vector2.ZERO
return
var player_position = get_player_position()
var dist = global_position.distance_to(player_position)
PlayerRaycast.cast_to = player_position - global_position
var collider = PlayerRaycast.get_collider()
if collider != null && collider.has_method("get_type") && collider.get_type() == "player":
shoot_fireball(position.direction_to(player_position))
if dist <= 400:
velocity.x = position.direction_to(Globals.player).normalized().x
velocity.x = position.direction_to(player_position).normalized().x * speed
else:
velocity = Vector2(0, 0)
apply_gravity(_delta)
velocity.x *= speed
velocity = move_and_slide(velocity, UP)
if velocity.x > 0:
$Hell.flip_h = false
elif velocity.x < 0:
$Hell.flip_h = true
if health <= 0:
queue_free()
if is_on_wall() and is_on_floor():
velocity.y = -150
func shoot_fireball(direction):
if ShootDelay.is_stopped():
var temp = Hell_Projectile.instance()
get_tree().current_scene.add_child(temp)
temp.global_position = ProjectileSpawn.global_position
temp.launch_vector(direction)
ShootDelay.start()

View file

@ -3,11 +3,10 @@
[ext_resource path="res://art/Hell Dude.png" type="Texture" id=1]
[ext_resource path="res://ai/Hell.gd" type="Script" id=2]
[sub_resource type="RectangleShape2D" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 5.06709, 5.78183 )
[sub_resource type="Animation" id=1]
resource_name = "Devil"
[sub_resource type="Animation" id=2]
length = 0.6
loop = true
tracks/0/type = "value"
@ -30,31 +29,7 @@ script = ExtResource( 2 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0, 1.87833 )
shape = SubResource( 2 )
[node name="RayCast2D" type="RayCast2D" parent="."]
position = Vector2( 0, 1.87833 )
enabled = true
cast_to = Vector2( -80, 0 )
collision_mask = 3
[node name="RayCast2D2" type="RayCast2D" parent="."]
position = Vector2( 0, 1.87833 )
enabled = true
cast_to = Vector2( 80, 0 )
collision_mask = 3
[node name="RayCast2D3" type="RayCast2D" parent="."]
position = Vector2( 0, 1.87833 )
enabled = true
cast_to = Vector2( 80, -25 )
collision_mask = 3
[node name="RayCast2D4" type="RayCast2D" parent="."]
position = Vector2( 0, 1.87833 )
enabled = true
cast_to = Vector2( -80, -25 )
collision_mask = 3
shape = SubResource( 1 )
[node name="Hell" type="Sprite" parent="."]
position = Vector2( -7.56425, -7.87261 )
@ -65,9 +40,15 @@ frame = 4
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "Devil"
anims/Devil = SubResource( 1 )
anims/Devil = SubResource( 2 )
[node name="ShootDelay" type="Timer" parent="."]
wait_time = 1.239
wait_time = 2.0
one_shot = true
[node name="Position2D" type="Position2D" parent="."]
[node name="PlayerRaycast" type="RayCast2D" parent="."]
modulate = Color( 0.615686, 1, 0, 1 )
enabled = true
collision_mask = 3

View file

@ -9,19 +9,19 @@ func apply_gravity(delta, modifier = 1):
velocity.y += gravity * delta * modifier
func _physics_process(_delta):
var dist = global_position.distance_to(Globals.player)
if knockback != Vector2.ZERO:
knockback = lerp(knockback, Vector2.ZERO, 0.5)
move_and_slide(-knockback * knockback_amount)
if knockback.x < 1 and -1 < knockback.x and knockback.y < 1 and -1 < knockback.y:
knockback = Vector2.ZERO
return
var dist = global_position.distance_to(Player.position)
if $RayCast2D.get_collider() != null && $RayCast2D.get_collider().has_method("get_type") and $RayCast2D.get_collider().get_type() == "player":
velocity = Vector2(0, 0)
throw_bone(Vector2.LEFT)
elif $RayCast2D2.get_collider() != null && $RayCast2D2.get_collider().has_method("get_type") and $RayCast2D2.get_collider().get_type() == "player":
velocity = Vector2(0, 0)
throw_bone(Vector2.RIGHT)
elif $RayCast2D3.get_collider() != null && $RayCast2D3.get_collider().has_method("get_type") and $RayCast2D3.get_collider().get_type() == "player":
velocity = Vector2(0, 0)
throw_bone(Vector2.UP + Vector2.LEFT)
elif $RayCast2D4.get_collider() != null && $RayCast2D4.get_collider().has_method("get_type") and $RayCast2D4.get_collider().get_type() == "player":
velocity = Vector2(0, 0)
throw_bone(Vector2.UP + Vector2.RIGHT)
else:
apply_gravity(_delta)
velocity.x *= speed

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://script/Skeleton Enemy.gd" type="Script" id=1]
[ext_resource path="res://ai/Skeleton Enemy.gd" type="Script" id=1]
[ext_resource path="res://art/Skeleton.png" type="Texture" id=3]
[sub_resource type="RectangleShape2D" id=1]

View file

@ -10,7 +10,13 @@ func _ready():
speed = 50
func _physics_process(delta):
var player = Globals.player
if knockback != Vector2.ZERO:
knockback = lerp(knockback, Vector2.ZERO, 0.5)
move_and_slide(-knockback * knockback_amount)
if knockback.x < 1 and -1 < knockback.x and knockback.y < 1 and -1 < knockback.y:
knockback = Vector2.ZERO
return
var player = Player.position
var distance = global_position.distance_to(player)
if distance <= 400:
if player.x > global_position.x:

BIN
art/Fireball.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

34
art/Fireball.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Fireball.png-4dbb8800c2a107192be56dd08d7bea34.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/Fireball.png"
dest_files=[ "res://.import/Fireball.png-4dbb8800c2a107192be56dd08d7bea34.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
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View file

@ -1,7 +1,9 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://meta/DungeonTilemap.tscn" type="PackedScene" id=1]
[ext_resource path="res://characters/Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://Player/Player.tscn" type="PackedScene" id=2]
[node name="World" type="Node2D"]
position = Vector2( 6.67419, 7.34163 )

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=23 format=2]
[ext_resource path="res://meta/DungeonTilemap.tscn" type="PackedScene" id=1]
[ext_resource path="res://characters/Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://Player/Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://Music and Fonts(Misc.)/Tifax-AJ7g.ttf" type="DynamicFontData" id=3]
[ext_resource path="res://Music and Fonts(Misc.)/Hawaii Partii - Stranded Lullaby(8-Bit).wav" type="AudioStream" id=4]
[ext_resource path="res://script/typewriter.gd" type="Script" id=5]
@ -12,6 +12,8 @@
[ext_resource path="res://art/Mana.png" type="Texture" id=12]
[ext_resource path="res://Items/Door.tscn" type="PackedScene" id=13]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 169.977, 24.8286 )

View file

@ -1,12 +1,15 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://characters/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://meta/DungeonTilemap.tscn" type="PackedScene" id=2]
[ext_resource path="res://ai/ogre.tscn" type="PackedScene" id=3]
[ext_resource path="res://Items/ChargeWandPickup.tscn" type="PackedScene" id=4]
[node name="Node2D" type="Node2D"]
[node name="TileMap" parent="." instance=ExtResource( 2 )]
tile_data = PoolIntArray( 65536, 0, 8, 65537, 0, 10, 65538, 0, 10, 65539, 0, 10, 65540, 0, 10, 65541, 0, 10, 65542, 0, 10, 65543, 0, 10, 65544, 0, 10, 65545, 0, 10, 65546, 0, 10, 65547, 0, 10, 65548, 0, 10, 65549, 0, 10, 65550, 0, 10, 65551, 0, 10, 65552, 0, 10, 65553, 0, 10, 65554, 0, 10, 65555, 0, 10, 65556, 0, 10, 65557, 0, 10, 65558, 0, 10, 65559, 0, 10, 65560, 0, 10, 65561, 0, 10, 65562, 0, 10, 65563, 0, 10, 65564, 0, 10, 65565, 0, 10, 65566, 0, 10, 65567, 0, 10, 65568, 0, 10, 65569, 0, 11, 131072, 0, 65544, 131073, 0, 131078, 131074, 0, 196617, 131075, 0, 196617, 131076, 0, 196617, 131077, 0, 196617, 131078, 0, 196617, 131079, 0, 196617, 131080, 0, 196617, 131081, 0, 196617, 131082, 0, 196617, 131083, 0, 196617, 131084, 0, 196617, 131085, 0, 196617, 131086, 0, 196617, 131087, 0, 196617, 131088, 0, 196617, 131089, 0, 196617, 131090, 0, 196617, 131091, 0, 196617, 131092, 0, 196617, 131093, 0, 196617, 131094, 0, 196617, 131095, 0, 196617, 131096, 0, 196617, 131097, 0, 196617, 131098, 0, 196617, 131099, 0, 196617, 131100, 0, 196617, 131101, 0, 196617, 131102, 0, 196617, 131103, 0, 196617, 131104, 0, 196617, 131105, 0, 196619, 196608, 0, 65544, 196609, 0, 131083, 262144, 0, 65544, 262145, 0, 131083, 327680, 0, 65544, 327681, 0, 131083, 393216, 0, 65544, 393217, 0, 131083, 458752, 0, 65544, 458753, 0, 131083, 524288, 0, 65544, 524289, 0, 131083, 589824, 0, 65544, 589825, 0, 131083, 589858, 0, 8, 589859, 0, 11, 655360, 0, 65544, 655361, 0, 131083, 655394, 0, 65544, 655395, 0, 131083, 720896, 0, 65544, 720897, 0, 65542, 720898, 0, 10, 720899, 0, 10, 720900, 0, 10, 720901, 0, 10, 720902, 0, 10, 720903, 0, 10, 720904, 0, 10, 720905, 0, 10, 720906, 0, 10, 720907, 0, 10, 720908, 0, 10, 720909, 0, 10, 720910, 0, 10, 720911, 0, 10, 720912, 0, 10, 720913, 0, 10, 720914, 0, 10, 720915, 0, 10, 720916, 0, 10, 720917, 0, 10, 720918, 0, 10, 720919, 0, 10, 720920, 0, 10, 720921, 0, 10, 720922, 0, 10, 720923, 0, 10, 720924, 0, 10, 720925, 0, 10, 720926, 0, 10, 720927, 0, 10, 720928, 0, 10, 720929, 0, 10, 720930, 0, 65541, 720931, 0, 131083, 786432, 0, 196616, 786433, 0, 196617, 786434, 0, 196617, 786435, 0, 196617, 786436, 0, 196617, 786437, 0, 196617, 786438, 0, 196617, 786439, 0, 196617, 786440, 0, 196617, 786441, 0, 196617, 786442, 0, 196617, 786443, 0, 196617, 786444, 0, 196617, 786445, 0, 196617, 786446, 0, 196617, 786447, 0, 196617, 786448, 0, 196617, 786449, 0, 196617, 786450, 0, 196617, 786451, 0, 196617, 786452, 0, 196617, 786453, 0, 196617, 786454, 0, 196617, 786455, 0, 196617, 786456, 0, 196617, 786457, 0, 196617, 786458, 0, 196617, 786459, 0, 196617, 786460, 0, 196617, 786461, 0, 196617, 786462, 0, 196617, 786463, 0, 196617, 786464, 0, 196617, 786465, 0, 196617, 786466, 0, 196617, 786467, 0, 196619 )
[node name="Player" parent="." instance=ExtResource( 1 )]
position = Vector2( 60, 176 )

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/EcoBeam.png-3c551f43d01aa1bf4191dfc734ada98c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://magic/Projectiles/EcoBeam.png"
dest_files=[ "res://.import/EcoBeam.png-3c551f43d01aa1bf4191dfc734ada98c.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
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/ExplosiveBeam.png-7c64be86fe9e64da3dbfe24ba50eb32b.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://magic/Projectiles/ExplosiveBeam.png"
dest_files=[ "res://.import/ExplosiveBeam.png-7c64be86fe9e64da3dbfe24ba50eb32b.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
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/KnockbackBeam.png-f6b07692e76f654be45e1dacdb7f97cd.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://magic/Projectiles/KnockbackBeam.png"
dest_files=[ "res://.import/KnockbackBeam.png-f6b07692e76f654be45e1dacdb7f97cd.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
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/PhantomBeam.png-ec0a238ba461b69d1e112c9f9f20d6d2.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://magic/Projectiles/PhantomBeam.png"
dest_files=[ "res://.import/PhantomBeam.png-ec0a238ba461b69d1e112c9f9f20d6d2.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
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View file

@ -3,3 +3,17 @@ extends Projectile
func _ready():
energy_cost = 2
damage = 1
func on_impact(collision):
if collision.collider.has_method("get_type") && collision.collider.get_type() == "enemy":
var c = collision.collider
c.health -= damage * damage_mod
c.do_knockback(collision.normal)
queue_free()
elif bounces_left != 0:
bounces_left -= 1
look_at(position + velocity.bounce(collision.normal))
launch(null, null)
else:
queue_free()

View file

@ -1,16 +1 @@
extends Sprite
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
extends Wand

View file

@ -60,10 +60,11 @@ UserData="*res://addons/github-integration/scripts/user_data.gd"
IconLoaderGithub="*res://addons/github-integration/scripts/IconLoaderGithub.gd"
RestHandler="*res://addons/github-integration/scripts/RestHandler.gd"
Globals="*res://script/globals.gd"
Player="*res://Player/PlayerVariables.gd"
[debug]
settings/fps/force_fps=60
settings/stdout/print_fps=true
[display]
@ -112,11 +113,19 @@ ui_accept={
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":70,"unicode":0,"echo":false,"script":null)
]
}
<<<<<<< Updated upstream
ui_up={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
=======
ui_end={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777230,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"unicode":0,"echo":false,"script":null)
>>>>>>> Stashed changes
]
}
up={
@ -154,11 +163,6 @@ inventory={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":69,"unicode":0,"echo":false,"script":null)
]
}
open={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":70,"unicode":0,"echo":false,"script":null)
]
}
[layer_names]
@ -168,6 +172,7 @@ open={
2d_physics/layer_2="World"
2d_physics/layer_3="Enemy"
2d_physics/layer_4="Projectiles"
2d_physics/layer_5="Enemy Projectile"
[rendering]

View file

@ -42,6 +42,10 @@ onready var Effect3 = $Inventory/Effects/Effect3
onready var Effect4 = $Inventory/Effects/Effect4
###
func _ready():
for id in Player.unlocked:
add_item(id)
func _process(delta):
if Input.is_action_just_pressed("inventory"):
set_open(!open)
@ -56,7 +60,6 @@ func _process(delta):
else:
ProjectileSelect.visible = true
func _input(event):
if event.is_action_pressed("ui_end"):
set_open(false)

View file

@ -43,26 +43,26 @@ func get_type():
func set_health(value):
Stats.set_health(value)
emit_signal("health_updated", value)
func get_health():
return Stats.get_health()
func set_energy(value):
Stats.set_energy(value)
emit_signal("energy_updated", value)
func get_energy():
return Stats.get_energy()
func _ready():
gravity = 2 * max_jump_height / pow(jump_duration, 2)
max_jump_velocity = -sqrt(2 * gravity * max_jump_height)
min_jump_velocity = -sqrt(2 * gravity * min_jump_height)
walljump_velocity = -sqrt(2 * gravity * walljump_height)
func _physics_process(delta):
Globals.player = position
Player.position = global_position - Vector2(0, 10)
emit_signal("grounded_updated", is_on_floor())
if get_health() <= 0:
get_tree().change_scene("res://Title/Death Screen'.tscn")
@ -84,8 +84,6 @@ func jump():
velocity.y = max_jump_velocity
CoyoteTimer.stop()
func apply_gravity(delta, modifier = 1):
velocity.y += gravity * delta * modifier
@ -101,13 +99,11 @@ func apply_movement():
var was_grounded = is_grounded
is_grounded = is_on_floor()
func get_movement_weight():
if is_on_floor():
return 0.2
else:
return 0.07
func _on_Area2D_body_entered(body):
pass

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -59,9 +59,9 @@ texture = ExtResource( 1 )
[node name="Conduit1" type="TextureButton" parent="Inventory/Conduits"]
light_mask = -2147483647
margin_left = -79.0
margin_left = -47.0
margin_top = -30.0
margin_right = -65.0
margin_right = -33.0
margin_bottom = -12.0
mouse_filter = 1
action_mode = 0
@ -77,9 +77,9 @@ position = Vector2( 7, 9 )
[node name="Conduit2" type="TextureButton" parent="Inventory/Conduits"]
light_mask = -2147483647
margin_left = -58.0
margin_left = -26.0
margin_top = -30.0
margin_right = -39.0
margin_right = -7.0
margin_bottom = -8.0
action_mode = 0
texture_normal = ExtResource( 4 )
@ -94,10 +94,10 @@ position = Vector2( 9, 9 )
[node name="Conduit3" type="TextureButton" parent="Inventory/Conduits"]
light_mask = -2147483647
margin_left = -81.0
margin_top = -8.0
margin_right = -64.0
margin_bottom = 14.0
margin_left = -49.0
margin_top = -6.0
margin_right = -32.0
margin_bottom = 16.0
action_mode = 0
texture_normal = ExtResource( 5 )
expand = true
@ -111,10 +111,10 @@ position = Vector2( 9, 10 )
[node name="Conduit4" type="TextureButton" parent="Inventory/Conduits"]
light_mask = -2147483647
margin_left = -58.0
margin_top = -8.0
margin_right = -40.0
margin_bottom = 14.0
margin_left = -24.0
margin_top = -6.0
margin_right = -6.0
margin_bottom = 16.0
action_mode = 0
texture_normal = ExtResource( 6 )
expand = true
@ -129,10 +129,10 @@ position = Vector2( 9, 10 )
[node name="Projectiles" type="Node2D" parent="Inventory"]
[node name="Projectile1" type="TextureButton" parent="Inventory/Projectiles"]
margin_left = -28.0
margin_top = -30.0
margin_right = -12.0
margin_bottom = -16.0
margin_left = 4.0
margin_top = -29.0
margin_right = 20.0
margin_bottom = -11.0
action_mode = 0
texture_normal = ExtResource( 8 )
expand = true
@ -145,10 +145,10 @@ __meta__ = {
position = Vector2( 9, 7 )
[node name="Projectile2" type="TextureButton" parent="Inventory/Projectiles"]
margin_left = 7.0
margin_left = 29.0
margin_top = -30.0
margin_right = 23.0
margin_bottom = -16.0
margin_right = 45.0
margin_bottom = -12.0
action_mode = 0
texture_normal = ExtResource( 7 )
expand = true
@ -161,10 +161,10 @@ __meta__ = {
position = Vector2( 8, 7 )
[node name="Projectile3" type="TextureButton" parent="Inventory/Projectiles"]
margin_left = -28.0
margin_top = -10.0
margin_right = -12.0
margin_bottom = 4.0
margin_left = 4.0
margin_top = -2.0
margin_right = 20.0
margin_bottom = 17.0
action_mode = 0
texture_normal = ExtResource( 9 )
expand = true
@ -177,10 +177,10 @@ __meta__ = {
position = Vector2( 9, 7 )
[node name="Projectile4" type="TextureButton" parent="Inventory/Projectiles"]
margin_left = 7.0
margin_top = -10.0
margin_right = 23.0
margin_bottom = 4.0
margin_left = 29.0
margin_top = -2.0
margin_right = 45.0
margin_bottom = 17.0
action_mode = 0
texture_normal = ExtResource( 10 )
expand = true
@ -192,9 +192,6 @@ __meta__ = {
[node name="Position2D" type="Position2D" parent="Inventory/Projectiles/Projectile4"]
position = Vector2( 8, 7 )
[node name="Effects" type="Node2D" parent="Inventory"]
visible = false
[node name="Button" type="TextureButton" parent="Inventory"]
margin_left = -22.0
margin_top = 35.0

View file

@ -9,6 +9,16 @@ var health = 3 setget set_health, get_health
var energy = 5 setget set_energy, get_energy
var is_burnout = false
func _ready():
print(Player.energy)
if Player.health == -1:
Player.health = Hearts.max_value
if Player.energy == -1:
Player.energy = Energybar.max_value
print("max")
set_health(Player.health)
set_energy(Player.energy)
func _on_Regen_timeout():
set_energy(get_accurate_energy() + 1)
if get_accurate_energy() == Energybar.max_value:
@ -18,9 +28,12 @@ func _process(delta):
if get_accurate_energy() < Energybar.max_value and Regen.is_stopped():
Regen.start()
BurnoutSprite.visible = is_burnout
set_health(Player.health)
set_energy(Player.energy)
func set_health(value):
Hearts.value = clamp(value, Hearts.min_value, Hearts.max_value)
Player.health = get_health()
func get_health():
return Hearts.value
@ -29,6 +42,7 @@ func set_energy(value):
Energybar.value = clamp(value, Energybar.min_value, Energybar.max_value)
if Energybar.value == 0:
is_burnout = true
Player.energy = get_accurate_energy()
func get_energy():
if is_burnout == true: