Fixed skelly

This commit is contained in:
Logan 2020-07-20 14:24:15 -05:00
parent 8e22dd6671
commit 260372e703
14 changed files with 132 additions and 62 deletions

24
EnemyProjectile.gd Normal file
View file

@ -0,0 +1,24 @@
extends KinematicBody2D
class_name EnemyProjectile
export var speed = 200
var velocity = Vector2.ZERO
var damage = 0.5
func _physics_process(delta):
var collision = move_and_collide(velocity * delta)
if collision != null:
on_impact(collision)
func launch_rotated():
velocity = (Vector2(speed, 0)).rotated(rotation)
func launch_vector(vector):
velocity = vector.normalized() * speed
func on_impact(collision):
if collision.collider.has_method("get_type") && collision.collider.get_type() == "player":
var c = collision.collider
c.health -= damage
print(collision.collider)
queue_free()

View file

@ -25,7 +25,7 @@ tracks/0/keys = {
[node name="Skeleton Enemy" type="KinematicBody2D"]
collision_layer = 4
collision_mask = 11
collision_mask = 3
script = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]

View file

@ -1,24 +1,10 @@
extends KinematicBody2D
var velocity = Vector2.ZERO
var speed = 100
func _physics_process(delta):
var c = move_and_collide(velocity)
if c != null:
on_impact(c)
extends EnemyProjectile
func launch_right():
velocity = (Vector2.RIGHT * speed)
launch_vector(Vector2.RIGHT)
func launch_left():
velocity = (Vector2.LEFT * speed)
launch_vector(Vector2.LEFT)
func launch_upleft():
velocity = (Vector2(-1, -1).normalized() * speed)
launch_vector(Vector2(-1, -1))
func launch_upright():
velocity = (Vector2(1, -1).normalized() * speed)
func on_impact(collision):
print(collision.collider)
if collision.collider.has_method("get_type"):
collision.collider.health -= 1
queue_free()
velocity = (Vector2(1, -1))

View file

@ -25,8 +25,8 @@ radius = 3.0
height = 2.0
[node name="KinematicBody2D" type="KinematicBody2D"]
collision_layer = 8
collision_mask = 3
collision_layer = 16
collision_mask = 11
script = ExtResource( 2 )
__meta__ = {
"_edit_group_": true

View file

@ -1,17 +1,17 @@
extends Enemy
var contact_damage = 1.5
var contact_damage = 0.5
onready var Spr = $Sprite
onready var DamageCD = $DamageCD
onready var Hurtbox = $Area2D
func _ready():
speed = 100
speed = 50
func _physics_process(delta):
var player = Globals.player
var distance = global_position.distance_to(player)
if distance <= 400:
if player.x > global_position.x:
Spr.flip_h = false
@ -19,21 +19,16 @@ func _physics_process(delta):
elif player.x < global_position.x:
Spr.flip_h = true
velocity.x = -speed
if health <= 0:
queue_free()
if not is_on_floor():
velocity.y = 10
var collision = move_and_collide(velocity)
if collision != null:
on_impact(collision)
func on_impact(collision):
if collision.collider.has_method("get_type") && collision.collider.get_type() == "player":
if DamageCD.is_stopped():
var c = collision.collider
c.set_health(c.get_health() - contact_damage)
DamageCD.start()
velocity.y = 50
velocity = move_and_slide(velocity)
deal_damage()
func deal_damage():
if DamageCD.is_stopped():
for body in Hurtbox.get_overlapping_bodies():
if body.has_method("get_type") && body.get_type() == "player":
body.health -= contact_damage
DamageCD.start()

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=2]
[ext_resource path="res://ai/ogre.gd" type="Script" id=1]
[ext_resource path="res://art/Ogre_Run.png" type="Texture" id=2]
@ -23,9 +23,13 @@ tracks/0/keys = {
"values": [ 0, 1, 2, 3 ]
}
[sub_resource type="CapsuleShape2D" id=3]
radius = 12.0
height = 6.0
[node name="Ogre" type="KinematicBody2D"]
collision_layer = 4
collision_mask = 2147483651
collision_mask = 2147483655
script = ExtResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
@ -44,3 +48,10 @@ one_shot = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "Run"
anims/Run = SubResource( 2 )
[node name="Area2D" type="Area2D" parent="."]
collision_layer = 0
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2( 1, -13 )
shape = SubResource( 3 )

BIN
art/Paralax Dungeon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Paralax Dungeon.png-2c5e068917f3e5c367739fab672862f7.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/Paralax Dungeon.png"
dest_files=[ "res://.import/Paralax Dungeon.png-2c5e068917f3e5c367739fab672862f7.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,4 +1,4 @@
[gd_scene load_steps=13 format=2]
[gd_scene load_steps=14 format=2]
[ext_resource path="res://script/player.gd" type="Script" id=1]
[ext_resource path="res://ui/PlayerStats.tscn" type="PackedScene" id=2]
@ -7,6 +7,7 @@
[ext_resource path="res://ui/Inventory.tscn" type="PackedScene" id=5]
[ext_resource path="res://art/WizardM.png" type="Texture" id=6]
[ext_resource path="res://script/WandPosition.gd" type="Script" id=7]
[ext_resource path="res://art/Paralax Dungeon.png" type="Texture" id=8]
[sub_resource type="OccluderPolygon2D" id=1]
polygon = PoolVector2Array( -7, 0, -7, -2, -6, -2, -6, -3, -5, -3, -5, -5, -6, -5, -6, -10, -7, -10, -7, -12, -6, -12, -6, -19, -4, -19, -4, -18, -3, -18, -3, -17, 1, -17, 1, -16, 3, -16, 3, -15, 4, -15, 4, -14, 5, -14, 5, -13, 6, -13, 6, -12, 7, -12, 7, -10, 6, -10, 6, -9, 5, -9, 5, -8, 6, -8, 6, -4, 5, -4, 5, 0, -7, 0 )
@ -85,7 +86,7 @@ drag_margin_bottom = 0.0
script = ExtResource( 4 )
[node name="WandPosition" type="Position2D" parent="."]
position = Vector2( 0, -7 )
position = Vector2( 0, -9 )
script = ExtResource( 7 )
[node name="Sprite" type="Sprite" parent="."]
@ -124,3 +125,12 @@ position = Vector2( 0, -7 )
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hitbox"]
visible = false
polygon = PoolVector2Array( -6, -12, -6, -5, -7, -5, -7, -3, -6, -3, -6, 2, -5, 2, -5, 4, -6, 4, -6, 5, -7, 5, -7, 7, 5, 7, 5, 3, 6, 3, 6, -1, 5, -1, 5, -2, 6, -2, 6, -3, 7, -3, 7, -5, 6, -5, 6, -6, 5, -6, 5, -7, 4, -7, 4, -8, 3, -8, 3, -9, 1, -9, 1, -10, -3, -10, -3, -11, -4, -11, -4, -12, -6, -12 )
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
motion_mirroring = Vector2( 32, 32 )
[node name="Paralax Dungeon" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
position = Vector2( 192, 90 )
texture = ExtResource( 8 )

View file

@ -1,16 +1,20 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://characters/Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://meta/DungeonTilemap.tscn" type="PackedScene" id=2]
[ext_resource path="res://ai/Skeleton Enemy.tscn" type="PackedScene" id=3]
[ext_resource path="res://Items/TripleWandPickup.tscn" type="PackedScene" id=3]
[ext_resource path="res://ai/Skeleton Enemy.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 )
[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, 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, 131077, 131092, 0, 131083, 196608, 0, 65544, 196609, 0, 131083, 196627, 0, 65544, 196628, 0, 131083, 262144, 0, 65544, 262145, 0, 131083, 262163, 0, 65544, 262164, 0, 131083, 327680, 0, 65544, 327681, 0, 131083, 327699, 0, 65544, 327700, 0, 131083, 393216, 0, 65544, 393217, 0, 131083, 393235, 0, 65544, 393236, 0, 131083, 458752, 0, 65544, 458753, 0, 131083, 458771, 0, 65544, 458772, 0, 131083, 524288, 0, 65544, 524289, 0, 131083, 524307, 0, 65544, 524308, 0, 131083, 589824, 0, 65544, 589825, 0, 131083, 589843, 0, 65544, 589844, 0, 131083, 655360, 0, 65544, 655361, 0, 131083, 655379, 0, 65544, 655380, 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, 65541, 720916, 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, 196619 )
[node name="TripleWand" parent="." instance=ExtResource( 3 )]
position = Vector2( 67, 168 )
[node name="Skeleton Enemy" parent="." instance=ExtResource( 3 )]
position = Vector2( 197.564, 145.285 )
[node name="Skeleton Enemy" parent="." instance=ExtResource( 4 )]
position = Vector2( 291, 166 )

View file

@ -4,7 +4,7 @@
[ext_resource path="res://magic/Projectiles/ExplosiveProjectile.gd" type="Script" id=2]
[sub_resource type="CircleShape2D" id=1]
radius = 6.0
radius = 4.12311
[sub_resource type="Gradient" id=3]
offsets = PoolRealArray( 0.0120482, 0.192771, 0.534137, 1 )
@ -33,10 +33,10 @@ collision_mask = 6
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
rotation = 0.785398
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
visible = false
shape = SubResource( 1 )
[node name="Particles2D" type="Particles2D" parent="."]

View file

@ -4,7 +4,7 @@
[ext_resource path="res://magic/Wands/TripleWand.gd" type="Script" id=2]
[node name="TripleWand" type="Sprite"]
position = Vector2( 2, -2 )
position = Vector2( 5, 0 )
rotation = 1.5708
texture = ExtResource( 1 )
offset = Vector2( 0, -11 )
@ -12,11 +12,11 @@ script = ExtResource( 2 )
[node name="ProjectileSpawn1" type="Position2D" parent="."]
position = Vector2( -5.00007, -20 )
rotation = -1.64061
rotation = -1.5708
[node name="ProjectileSpawn2" type="Position2D" parent="."]
position = Vector2( -8.01086e-05, -22 )
rotation = -1.6057
rotation = -1.5708
[node name="ProjectileSpawn3" type="Position2D" parent="."]
position = Vector2( 4.99993, -20 )

View file

@ -20,6 +20,11 @@ _global_script_classes=[ {
"path": "res://ai/Enemy.gd"
}, {
"base": "KinematicBody2D",
"class": "EnemyProjectile",
"language": "GDScript",
"path": "res://EnemyProjectile.gd"
}, {
"base": "KinematicBody2D",
"class": "Projectile",
"language": "GDScript",
"path": "res://magic/Projectiles/Projectile.gd"
@ -37,6 +42,7 @@ _global_script_classes=[ {
_global_script_class_icons={
"Collectable": "",
"Enemy": "",
"EnemyProjectile": "",
"Projectile": "",
"StateMachine": "",
"Wand": ""
@ -57,7 +63,7 @@ Globals="*res://script/globals.gd"
[debug]
settings/fps/force_fps=60
settings/stdout/print_fps=true
[display]
@ -97,11 +103,11 @@ texture={
[input]
ui_up={
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":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)
"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)
]
}
up={
@ -148,6 +154,7 @@ inventory={
2d_physics/layer_2="World"
2d_physics/layer_3="Enemy"
2d_physics/layer_4="Projectiles"
2d_physics/layer_5="Enemy Projectile"
[rendering]

View file

@ -39,9 +39,8 @@ margin_left = 4.0
margin_top = -5.0
margin_right = -64.0
margin_bottom = -16.0
max_value = 10.0
step = 1.0
value = 10.0
max_value = 20.0
value = 20.0
texture_progress = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false