-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5839072
commit 23d0517
Showing
8 changed files
with
186 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
extends KinematicBody2D | ||
#enemy's velocity | ||
var vsp = Vector2() | ||
#enemy's direction | ||
var dir = 1 | ||
#is this enemy alive | ||
var lfe = 1 | ||
#this dictates how long the enemy falls after death | ||
var fall = 60 | ||
const enemydead = preload("res://scenes/enemies/enemy-dead.tscn") | ||
func _physics_process(delta): | ||
if lfe == 1: | ||
pass | ||
else: | ||
globallevel.score = globallevel.score + 5 | ||
var a = enemydead.instance() | ||
a.vsp.x = (vsp.x /30) | ||
get_parent().add_child(a) | ||
a.position = position | ||
queue_free() | ||
vsp = move_and_slide(vsp,Vector2.UP) | ||
|
||
|
||
# warning-ignore:unused_argument | ||
|
||
|
||
func _on_Hitboxplayer_body_entered(body): | ||
if globallevel.invstate <= 1: | ||
globallevel.score = globallevel.score - 50 | ||
globallevel.hp = globallevel.hp - 4 | ||
globallevel.invstate = 60 | ||
|
||
|
||
func _on_Hitboxprojectile_body_entered(body): | ||
lfe = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
[gd_scene load_steps=8 format=2] | ||
|
||
[ext_resource path="res://gfx/obj/placeholder/enemy-placeholder.png" type="Texture" id=1] | ||
[ext_resource path="res://gfx/enemies/Spikey/Preview.png" type="Texture" id=2] | ||
[ext_resource path="res://scenes/enemies/Spikey.gd" type="Script" id=3] | ||
|
||
[sub_resource type="SpriteFrames" id=1] | ||
animations = [ { | ||
"frames": [ ExtResource( 1 ) ], | ||
"loop": true, | ||
"name": "Dead", | ||
"speed": 5.0 | ||
}, { | ||
"frames": [ ExtResource( 2 ) ], | ||
"loop": true, | ||
"name": "idle", | ||
"speed": 5.0 | ||
} ] | ||
|
||
[sub_resource type="RectangleShape2D" id=2] | ||
extents = Vector2( 6.25, 6.5 ) | ||
|
||
[sub_resource type="RectangleShape2D" id=3] | ||
extents = Vector2( 5, 6 ) | ||
|
||
[sub_resource type="RectangleShape2D" id=4] | ||
extents = Vector2( 8.09375, 10.25 ) | ||
|
||
[node name="KinematicBody2D" type="KinematicBody2D"] | ||
collision_layer = 16 | ||
collision_mask = 66 | ||
script = ExtResource( 3 ) | ||
|
||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."] | ||
frames = SubResource( 1 ) | ||
animation = "idle" | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] | ||
position = Vector2( -0.25, 1.5 ) | ||
shape = SubResource( 2 ) | ||
|
||
[node name="Hitbox-player" type="Area2D" parent="."] | ||
collision_layer = 0 | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox-player"] | ||
position = Vector2( 0, 2 ) | ||
shape = SubResource( 3 ) | ||
|
||
[node name="Hitbox-projectile" type="Area2D" parent="."] | ||
collision_layer = 0 | ||
collision_mask = 32 | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox-projectile"] | ||
position = Vector2( -0.09375, -2.25 ) | ||
shape = SubResource( 4 ) | ||
|
||
[connection signal="body_entered" from="Hitbox-player" to="." method="_on_Hitboxplayer_body_entered"] | ||
[connection signal="body_entered" from="Hitbox-projectile" to="." method="_on_Hitboxprojectile_body_entered"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.