update obstacle NPCs (Cirno + Sanae)

This commit is contained in:
D L 2023-01-29 14:46:06 -08:00
parent aa5abc16b5
commit 81009436c0
15 changed files with 188 additions and 82 deletions

Binary file not shown.

BIN
Graphics/ObstacleNPC.mdp Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Freestanding_Cirno.png-5e602f5666da63b5920ee1ec5f8b9f70.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Graphics/Units/Freestanding_Cirno.png"
dest_files=[ "res://.import/Freestanding_Cirno.png-5e602f5666da63b5920ee1ec5f8b9f70.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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

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

View File

@ -5,7 +5,7 @@
[ext_resource path="res://Tile Sets/SnowySlopesExtra.tres" type="TileSet" id=3] [ext_resource path="res://Tile Sets/SnowySlopesExtra.tres" type="TileSet" id=3]
[ext_resource path="res://Graphics/Animations/Background.tres" type="Texture" id=4] [ext_resource path="res://Graphics/Animations/Background.tres" type="Texture" id=4]
[ext_resource path="res://Scripts/GameScene.gd" type="Script" id=5] [ext_resource path="res://Scripts/GameScene.gd" type="Script" id=5]
[ext_resource path="res://Units/DownhillAutoscrollerRival.tscn" type="PackedScene" id=6] [ext_resource path="res://Units/DownhillAutoscrollerRivalMystia.tscn" type="PackedScene" id=6]
[sub_resource type="Animation" id=1] [sub_resource type="Animation" id=1]
resource_name = "PitTransition" resource_name = "PitTransition"
@ -61,9 +61,9 @@ __meta__ = {
tile_set_name = "SnowySlopes" tile_set_name = "SnowySlopes"
camera_h_offset = 2.5 camera_h_offset = 2.5
spawning = { spawning = {
Vector2( 45, -6 ): "NPC", Vector2( 45, -6 ): "CIRNO",
Vector2( 80, -7 ): "NPC", Vector2( 80, -7 ): "SANAE",
Vector2( 218, -29 ): "NPC" Vector2( 218, -29 ): "CIRNO"
} }
[node name="CanvasLayerBG" type="CanvasLayer" parent="."] [node name="CanvasLayerBG" type="CanvasLayer" parent="."]

View File

@ -1,7 +1,8 @@
enum UnitType { enum UnitType {
PLAYER, PLAYER,
NPC,
RIVAL, RIVAL,
CIRNO,
SANAE,
} }
enum ActionType { enum ActionType {
@ -74,13 +75,12 @@ const UNIT_TYPE_ACTIONS = {
ActionType.RECOIL, ActionType.RECOIL,
ActionType.SPIN, ActionType.SPIN,
], ],
UnitType.NPC: [
ActionType.MOVE,
],
UnitType.RIVAL: [ UnitType.RIVAL: [
ActionType.JUMP, ActionType.JUMP,
ActionType.MOVE, ActionType.MOVE,
], ],
UnitType.CIRNO: [],
UnitType.SANAE: [],
} }
const UNIT_TYPE_CURRENT_ACTIONS = { const UNIT_TYPE_CURRENT_ACTIONS = {
@ -90,13 +90,16 @@ const UNIT_TYPE_CURRENT_ACTIONS = {
UnitCurrentAction.RECOILING, UnitCurrentAction.RECOILING,
UnitCurrentAction.SPINNING, UnitCurrentAction.SPINNING,
], ],
UnitType.NPC: [
UnitCurrentAction.IDLE,
],
UnitType.RIVAL: [ UnitType.RIVAL: [
UnitCurrentAction.IDLE, UnitCurrentAction.IDLE,
UnitCurrentAction.JUMPING, UnitCurrentAction.JUMPING,
], ],
UnitType.CIRNO: [
UnitCurrentAction.IDLE,
],
UnitType.SANAE: [
UnitCurrentAction.IDLE,
],
} }
# default conditions # default conditions
@ -107,12 +110,17 @@ const UNIT_TYPE_CONDITIONS = {
UnitCondition.MOVING_STATUS: UnitMovingStatus.IDLE, UnitCondition.MOVING_STATUS: UnitMovingStatus.IDLE,
UnitCondition.IS_INVINCIBLE: false, UnitCondition.IS_INVINCIBLE: false,
}, },
UnitType.NPC: { UnitType.RIVAL: {
UnitCondition.CURRENT_ACTION: UnitCurrentAction.IDLE, UnitCondition.CURRENT_ACTION: UnitCurrentAction.IDLE,
UnitCondition.IS_ON_GROUND: false, UnitCondition.IS_ON_GROUND: false,
UnitCondition.MOVING_STATUS: UnitMovingStatus.IDLE, UnitCondition.MOVING_STATUS: UnitMovingStatus.IDLE,
}, },
UnitType.RIVAL: { UnitType.CIRNO: {
UnitCondition.CURRENT_ACTION: UnitCurrentAction.IDLE,
UnitCondition.IS_ON_GROUND: false,
UnitCondition.MOVING_STATUS: UnitMovingStatus.IDLE,
},
UnitType.SANAE: {
UnitCondition.CURRENT_ACTION: UnitCurrentAction.IDLE, UnitCondition.CURRENT_ACTION: UnitCurrentAction.IDLE,
UnitCondition.IS_ON_GROUND: false, UnitCondition.IS_ON_GROUND: false,
UnitCondition.MOVING_STATUS: UnitMovingStatus.IDLE, UnitCondition.MOVING_STATUS: UnitMovingStatus.IDLE,
@ -125,9 +133,11 @@ const CURRENT_ACTION_TIMERS = {
UnitCurrentAction.JUMPING: 0.4, UnitCurrentAction.JUMPING: 0.4,
UnitCurrentAction.RECOILING: 0.67, UnitCurrentAction.RECOILING: 0.67,
}, },
UnitType.NPC: { UnitType.RIVAL: {
UnitCurrentAction.JUMPING: 0.4, UnitCurrentAction.JUMPING: 0.4,
}, },
UnitType.CIRNO: {},
UnitType.SANAE: {},
} }
const UNIT_CONDITION_TIMERS = { const UNIT_CONDITION_TIMERS = {
@ -135,8 +145,9 @@ const UNIT_CONDITION_TIMERS = {
UnitType.PLAYER: { UnitType.PLAYER: {
UnitCondition.IS_INVINCIBLE: [2.5, true, false], UnitCondition.IS_INVINCIBLE: [2.5, true, false],
}, },
UnitType.NPC: {},
UnitType.RIVAL: {}, UnitType.RIVAL: {},
UnitType.CIRNO: {},
UnitType.SANAE: {},
} }
# Position relative to player's origin, list of directions to check for collision # Position relative to player's origin, list of directions to check for collision
@ -150,14 +161,6 @@ const ENV_COLLIDERS = {
# contact with ground is at (0, 0) # contact with ground is at (0, 0)
[Vector2(0, 0), [Direction.LEFT, Direction.DOWN, Direction.RIGHT]], [Vector2(0, 0), [Direction.LEFT, Direction.DOWN, Direction.RIGHT]],
], ],
UnitType.NPC: [
[Vector2(0, 1.5), [Direction.LEFT, Direction.UP, Direction.RIGHT]],
[Vector2(-.25, .25), [Direction.LEFT]],
[Vector2(.25, .25), [Direction.RIGHT]],
[Vector2(-.25, 1.25), [Direction.LEFT]],
[Vector2(.25, 1.25), [Direction.RIGHT]],
[Vector2(0, 0), [Direction.LEFT, Direction.DOWN, Direction.RIGHT]],
],
UnitType.RIVAL: [ UnitType.RIVAL: [
[Vector2(0, 1.5), [Direction.LEFT, Direction.UP, Direction.RIGHT]], [Vector2(0, 1.5), [Direction.LEFT, Direction.UP, Direction.RIGHT]],
[Vector2(-.25, .25), [Direction.LEFT]], [Vector2(-.25, .25), [Direction.LEFT]],
@ -167,6 +170,22 @@ const ENV_COLLIDERS = {
# contact with ground is at (0, 0) # contact with ground is at (0, 0)
[Vector2(0, 0), [Direction.LEFT, Direction.DOWN, Direction.RIGHT]], [Vector2(0, 0), [Direction.LEFT, Direction.DOWN, Direction.RIGHT]],
], ],
UnitType.CIRNO: [
[Vector2(0, 1.5), [Direction.LEFT, Direction.UP, Direction.RIGHT]],
[Vector2(-.25, .25), [Direction.LEFT]],
[Vector2(.25, .25), [Direction.RIGHT]],
[Vector2(-.25, 1.25), [Direction.LEFT]],
[Vector2(.25, 1.25), [Direction.RIGHT]],
[Vector2(0, 0), [Direction.LEFT, Direction.DOWN, Direction.RIGHT]],
],
UnitType.SANAE: [
[Vector2(0, 1.5), [Direction.LEFT, Direction.UP, Direction.RIGHT]],
[Vector2(-.25, .25), [Direction.LEFT]],
[Vector2(.25, .25), [Direction.RIGHT]],
[Vector2(-.25, 1.25), [Direction.LEFT]],
[Vector2(.25, 1.25), [Direction.RIGHT]],
[Vector2(0, 0), [Direction.LEFT, Direction.DOWN, Direction.RIGHT]],
],
} }
const INPUT_MAP = { const INPUT_MAP = {
@ -213,27 +232,31 @@ const UNIT_SPRITES = {
SpriteClass.JUMP: [false, ["Jump1", "Jump2"]], SpriteClass.JUMP: [false, ["Jump1", "Jump2"]],
SpriteClass.RECOIL: [false, ["Recoil"]], SpriteClass.RECOIL: [false, ["Recoil"]],
}, },
UnitType.NPC: {
SpriteClass.IDLE: [false, ["Idle"]],
SpriteClass.WALK: [true, ["Walk"]],
SpriteClass.JUMP: [false, ["Jump2"]],
},
UnitType.RIVAL: { UnitType.RIVAL: {
SpriteClass.IDLE: [false, ["Idle"]], SpriteClass.IDLE: [false, ["Idle"]],
SpriteClass.WALK: [false, ["Move0", "Move-1", "Move-2", "Move+1", "Move+2"]], SpriteClass.WALK: [false, ["Move0", "Move-1", "Move-2", "Move+1", "Move+2"]],
SpriteClass.JUMP: [false, ["Move0"]], SpriteClass.JUMP: [false, ["Move0"]],
}, },
UnitType.CIRNO: {
SpriteClass.IDLE: [false, ["Idle"]],
SpriteClass.JUMP: [false, ["Idle"]],
},
UnitType.SANAE: {
SpriteClass.IDLE: [false, ["Idle"]],
SpriteClass.JUMP: [false, ["Idle"]],
},
} }
const UNIT_TYPE_MOVE_SPEEDS = { const UNIT_TYPE_MOVE_SPEEDS = {
UnitType.PLAYER: 5, UnitType.PLAYER: 5,
UnitType.NPC: 3,
UnitType.RIVAL: 5, UnitType.RIVAL: 5,
UnitType.CIRNO: 0,
UnitType.SANAE: 0,
} }
const UNIT_TYPE_JUMP_SPEEDS = { const UNIT_TYPE_JUMP_SPEEDS = {
UnitType.PLAYER: 4.5,
UnitType.RIVAL: 4.5, UnitType.RIVAL: 4.5,
UnitType.PLAYER: 4.5,
} }
const SCALE_FACTOR = 1 const SCALE_FACTOR = 1

View File

@ -13,7 +13,8 @@ export var camera_h_offset : float = 1
const Constants = preload("res://Scripts/Constants.gd") const Constants = preload("res://Scripts/Constants.gd")
const Unit = preload("res://Scripts/Unit.gd") const Unit = preload("res://Scripts/Unit.gd")
const UNIT_DIRECTORY = { const UNIT_DIRECTORY = {
Constants.UnitType.NPC: preload("res://Units/DownhillAutoscrollerNPC.tscn"), Constants.UnitType.CIRNO: preload("res://Units/DownhillAutoscrollerNPCCirno.tscn"),
Constants.UnitType.SANAE: preload("res://Units/DownhillAutoscrollerNPCSanae.tscn"),
} }
# positions to unit string # positions to unit string

View File

@ -1,5 +1,15 @@
extends NPCExample extends NPCExample
func _ready():
._ready()
facing = Constants.Direction.LEFT
func before_tick(): func before_tick():
pass pass
func reset_current_action():
# process CURRENT_ACTION
if get_current_action() == Constants.UnitCurrentAction.JUMPING:
if not actions[Constants.ActionType.JUMP]:
set_current_action(Constants.UnitCurrentAction.IDLE)

View File

@ -1,39 +0,0 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Units/DownhillAutoscrollerNPC.gd" type="Script" id=1]
[ext_resource path="res://Graphics/Units/NPC.png" type="Texture" id=2]
[ext_resource path="res://Graphics/Animations/NPCWalk.tres" type="SpriteFrames" id=3]
[ext_resource path="res://Graphics/Units/NPCJump2.png" type="Texture" id=4]
[ext_resource path="res://Graphics/Units/NPCJump1.png" type="Texture" id=5]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 6, 14 )
[node name="NPC" type="Area2D"]
collision_mask = 2
script = ExtResource( 1 )
unit_type = 1
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0, -14 )
shape = SubResource( 1 )
[node name="Idle" type="Sprite" parent="."]
visible = false
texture = ExtResource( 2 )
offset = Vector2( 0, -15 )
[node name="Jump1" type="Sprite" parent="."]
visible = false
texture = ExtResource( 5 )
offset = Vector2( 0, -15 )
[node name="Jump2" type="Sprite" parent="."]
visible = false
texture = ExtResource( 4 )
offset = Vector2( 0, -15 )
[node name="Walk" type="AnimatedSprite" parent="."]
visible = false
frames = ExtResource( 3 )
offset = Vector2( 0, -15 )

View File

@ -0,0 +1,21 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Units/DownhillAutoscrollerNPC.gd" type="Script" id=1]
[ext_resource path="res://Graphics/Units/Freestanding_Cirno.png" type="Texture" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 8, 36 )
[node name="NPC" type="Area2D"]
collision_mask = 2
script = ExtResource( 1 )
unit_type = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0, -36 )
shape = SubResource( 1 )
[node name="Idle" type="Sprite" parent="."]
visible = false
texture = ExtResource( 2 )
offset = Vector2( 0, -48 )

View File

@ -0,0 +1,21 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Units/DownhillAutoscrollerNPC.gd" type="Script" id=1]
[ext_resource path="res://Graphics/Units/Freestanding_Sanae.png" type="Texture" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 8, 36 )
[node name="NPC" type="Area2D"]
collision_mask = 2
script = ExtResource( 1 )
unit_type = 3
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0, -36 )
shape = SubResource( 1 )
[node name="Idle" type="Sprite" parent="."]
visible = false
texture = ExtResource( 2 )
offset = Vector2( 0, -48 )

View File

@ -1,11 +1,12 @@
[gd_scene load_steps=8 format=2] [gd_scene load_steps=9 format=2]
[ext_resource path="res://Scripts/Units/NPCUnit.gd" type="Script" id=1] [ext_resource path="res://Scripts/Units/NPCUnit.gd" type="Script" id=1]
[ext_resource path="res://Graphics/Units/Letty/Move0.png" type="Texture" id=2] [ext_resource path="res://Graphics/Units/Letty/Move0.png" type="Texture" id=2]
[ext_resource path="res://Graphics/Units/Letty/Move-1.png" type="Texture" id=3] [ext_resource path="res://Graphics/Units/Letty/Move+2.png" type="Texture" id=3]
[ext_resource path="res://Graphics/Units/Letty/Move+2.png" type="Texture" id=4] [ext_resource path="res://Graphics/Units/Letty/Move-2.png" type="Texture" id=4]
[ext_resource path="res://Graphics/Units/Letty/Move+1.png" type="Texture" id=5] [ext_resource path="res://Graphics/Units/Letty/Move+1.png" type="Texture" id=5]
[ext_resource path="res://Graphics/Units/Letty/Move-2.png" type="Texture" id=6] [ext_resource path="res://Graphics/Units/Mystia/Move0.png" type="Texture" id=6]
[ext_resource path="res://Graphics/Units/Letty/Move-1.png" type="Texture" id=7]
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 9, 34 ) extents = Vector2( 9, 34 )
@ -14,7 +15,7 @@ extents = Vector2( 9, 34 )
z_index = 1 z_index = 1
collision_layer = 0 collision_layer = 0
script = ExtResource( 1 ) script = ExtResource( 1 )
unit_type = 2 unit_type = 1
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0, -36 ) position = Vector2( 0, -36 )
@ -22,7 +23,7 @@ shape = SubResource( 1 )
[node name="Idle" type="Sprite" parent="."] [node name="Idle" type="Sprite" parent="."]
visible = false visible = false
texture = ExtResource( 2 ) texture = ExtResource( 6 )
offset = Vector2( 0, -48 ) offset = Vector2( 0, -48 )
[node name="Move0" type="Sprite" parent="."] [node name="Move0" type="Sprite" parent="."]
@ -37,19 +38,17 @@ offset = Vector2( 0, -48 )
[node name="Move+2" type="Sprite" parent="."] [node name="Move+2" type="Sprite" parent="."]
visible = false visible = false
texture = ExtResource( 4 ) texture = ExtResource( 3 )
offset = Vector2( 0, -48 ) offset = Vector2( 0, -48 )
[node name="Move-1" type="Sprite" parent="."] [node name="Move-1" type="Sprite" parent="."]
visible = false visible = false
texture = ExtResource( 3 ) texture = ExtResource( 7 )
offset = Vector2( 0, -48 ) offset = Vector2( 0, -48 )
[node name="Move-2" type="Sprite" parent="."] [node name="Move-2" type="Sprite" parent="."]
visible = false visible = false
texture = ExtResource( 6 ) texture = ExtResource( 4 )
offset = Vector2( 0, -48 ) offset = Vector2( 0, -48 )
script = ExtResource( 1 )
unit_type = 2
[connection signal="area_entered" from="." to="." method="_on_Player_area_entered"] [connection signal="area_entered" from="." to="." method="_on_Player_area_entered"]

View File

@ -14,7 +14,7 @@ extents = Vector2( 9, 34 )
z_index = 1 z_index = 1
collision_layer = 0 collision_layer = 0
script = ExtResource( 1 ) script = ExtResource( 1 )
unit_type = 2 unit_type = 1
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0, -36 ) position = Vector2( 0, -36 )