forked from team-sg/hero-mark-2
Marisa Rigate's Big Commit: Disaster Averted!
This commit is contained in:
parent
1215099f4d
commit
263d6219cc
19 changed files with 314 additions and 95 deletions
|
@ -9,5 +9,6 @@ func _on_ActivationArea_area_entered(area):
|
|||
if area.is_in_group("player_hitbox"):
|
||||
activate()
|
||||
$Sprite.frame = 1
|
||||
$StaticBody2D/CollisionPolygon2D.disabled = true
|
||||
pressed = true
|
||||
Audio.play_sound(sound,$AudioStreamPlayer)
|
||||
|
|
|
@ -8,7 +8,6 @@ extents = Vector2( 2, 0.5 )
|
|||
|
||||
[node name="Button" type="Node2D"]
|
||||
script = ExtResource( 2 )
|
||||
type = "button"
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
position = Vector2( 4, 4 )
|
||||
|
|
|
@ -23,4 +23,4 @@ margin_bottom = 143.0
|
|||
margin_top = 3.0
|
||||
margin_bottom = 91.0
|
||||
text = "Ms. X (Marisa Xevious):
|
||||
born 10/21/2062, she was locked up for such trivial crimes as shoplifting and marijuana possession. her reliance on weed causes many issues in her life."
|
||||
born 10/21/2062, she was locked up for such trivial crimes as shoplifting and marijuana possession. her reliance on drugs causes many issues in her life."
|
||||
|
|
|
@ -3,25 +3,38 @@ extends KinematicBody2D
|
|||
var velocity = Vector2.ZERO
|
||||
var is_moving = false
|
||||
var is_holding_shard = true
|
||||
var has_respawned = false
|
||||
onready var death_particles = $DeathSplatter
|
||||
onready var sprite = $Sprite
|
||||
onready var anims = $AnimationPlayer
|
||||
onready var raycast = $RayCast2D
|
||||
onready var respawn_raycast = $RespawnRaycast
|
||||
onready var shard_position = $Position2D
|
||||
onready var start_position = position
|
||||
onready var blink_timer = $BlinkTimer
|
||||
const shard = preload("res://objects/collectibles/shard.tscn")
|
||||
const BloodSpray := preload("res://objects/environment/blood/blood_spray.tscn")
|
||||
|
||||
func _ready():
|
||||
raycast.add_exception($Hitbox)
|
||||
blink_timer.start(rand_range(5.0,7.0))
|
||||
|
||||
func _physics_process(delta):
|
||||
print(respawn_raycast.get_collider())
|
||||
if is_moving: velocity.x = -50
|
||||
#Stop when see something
|
||||
if raycast.is_colliding(): velocity.x = 0
|
||||
if raycast.is_colliding():
|
||||
#stop behind sg
|
||||
velocity.x = 0
|
||||
if respawn_raycast.is_colliding():
|
||||
#start moving again after respawning when seeing sg
|
||||
if raycast.get_collider() != null:
|
||||
if raycast.get_collider().is_in_group("player_hitbox"): is_moving = true
|
||||
velocity.y += 128 * delta
|
||||
velocity = move_and_slide_with_snap(velocity, Vector2.DOWN, Vector2.UP, true)
|
||||
#Anims
|
||||
if velocity.x == 0:
|
||||
if !anims.get_current_animation() == "give": anims.play("idle")
|
||||
if !anims.get_current_animation() == "give" && !anims.get_current_animation() == "respawn" && !anims.get_current_animation() == "blink": anims.play("idle")
|
||||
else:
|
||||
anims.play("walk")
|
||||
#Stop at the end of path and give shard
|
||||
|
@ -39,7 +52,18 @@ func spawn_shard():
|
|||
is_holding_shard = false
|
||||
|
||||
func switch_action():
|
||||
is_moving = true
|
||||
#is_moving = true
|
||||
pass
|
||||
|
||||
func spray_blood():
|
||||
for i in 16:
|
||||
var spray = BloodSpray.instance()
|
||||
spray.pause_mode = PAUSE_MODE_PROCESS
|
||||
Physics2DServer.set_active(true)
|
||||
spray.global_position = global_position
|
||||
spray.velocity = Vector2(randf() * 80.0, 0.0).rotated(randf() * TAU)
|
||||
spray.stains_player = false
|
||||
get_parent().add_child(spray)
|
||||
|
||||
func die():
|
||||
#Create particles
|
||||
|
@ -47,5 +71,15 @@ func die():
|
|||
get_parent().add_child(death_particles)
|
||||
death_particles.global_position = global_position
|
||||
death_particles.emitting = true
|
||||
spray_blood()
|
||||
Audio.play_sound(Audio.a_msx_die,Audio.ac_die)
|
||||
queue_free()
|
||||
is_moving = false
|
||||
velocity.x = 0
|
||||
position = start_position
|
||||
anims.play("respawn")
|
||||
has_respawned = true
|
||||
|
||||
|
||||
func _on_BlinkTimer_timeout():
|
||||
anims.play("blink")
|
||||
blink_timer.start(rand_range(5.0,7.0))
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
[gd_scene load_steps=16 format=2]
|
||||
[gd_scene load_steps=20 format=2]
|
||||
|
||||
[ext_resource path="res://shaders/1px_border.gdshader" type="Shader" id=1]
|
||||
[ext_resource path="res://graphics/npc/msx_respawn.png" type="Texture" id=2]
|
||||
[ext_resource path="res://graphics/npc/msx_walk.png" type="Texture" id=3]
|
||||
[ext_resource path="res://graphics/npc/msx_blink.png" type="Texture" id=4]
|
||||
[ext_resource path="res://graphics/npc/msx_idle.png" type="Texture" id=11]
|
||||
[ext_resource path="res://scripts/snap_sprite.gd" type="Script" id=12]
|
||||
[ext_resource path="res://objects/npc/msx.gd" type="Script" id=13]
|
||||
|
@ -47,6 +49,47 @@ tracks/2/keys = {
|
|||
"values": [ 0 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=18]
|
||||
resource_name = "blink"
|
||||
length = 0.7
|
||||
step = 0.06
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:texture")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ ExtResource( 4 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Sprite:hframes")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ 4 ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("Sprite:frame")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0, 0.12, 0.24, 0.54, 0.66 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ 0, 1, 2, 3, 0 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=15]
|
||||
resource_name = "give"
|
||||
length = 0.5
|
||||
|
@ -143,6 +186,47 @@ tracks/2/keys = {
|
|||
"values": [ 0 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=17]
|
||||
resource_name = "respawn"
|
||||
length = 0.4
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite: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.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ 0, 1, 2, 3, 4, 5, 6, 7 ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Sprite:texture")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ ExtResource( 2 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("Sprite:hframes")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 1,
|
||||
"values": [ 8 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=9]
|
||||
resource_name = "walk"
|
||||
length = 0.4
|
||||
|
@ -206,8 +290,10 @@ script = ExtResource( 13 )
|
|||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
autoplay = "idle"
|
||||
anims/RESET = SubResource( 16 )
|
||||
anims/blink = SubResource( 18 )
|
||||
anims/give = SubResource( 15 )
|
||||
anims/idle = SubResource( 4 )
|
||||
anims/respawn = SubResource( 17 )
|
||||
anims/walk = SubResource( 9 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
|
@ -260,8 +346,19 @@ cast_to = Vector2( 32, 0 )
|
|||
collision_mask = 3
|
||||
collide_with_areas = true
|
||||
|
||||
[node name="RespawnRaycast" type="RayCast2D" parent="."]
|
||||
position = Vector2( 16, 0 )
|
||||
enabled = true
|
||||
cast_to = Vector2( 56, 0 )
|
||||
collision_mask = 8
|
||||
collide_with_areas = true
|
||||
|
||||
[node name="Position2D" type="Position2D" parent="."]
|
||||
position = Vector2( 17, 2 )
|
||||
__meta__ = {
|
||||
"_gizmo_extents_": 0.0
|
||||
}
|
||||
|
||||
[node name="BlinkTimer" type="Timer" parent="."]
|
||||
|
||||
[connection signal="timeout" from="BlinkTimer" to="." method="_on_BlinkTimer_timeout"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue