diff --git a/Graphics/Letty.mdp b/Graphics/Letty.mdp index 38b6cd2..ab4ba7d 100644 Binary files a/Graphics/Letty.mdp and b/Graphics/Letty.mdp differ diff --git a/Graphics/ObstacleNPC.mdp b/Graphics/ObstacleNPC.mdp new file mode 100644 index 0000000..9ca7129 Binary files /dev/null and b/Graphics/ObstacleNPC.mdp differ diff --git a/Graphics/Units/Freestanding_Cirno.png b/Graphics/Units/Freestanding_Cirno.png new file mode 100644 index 0000000..a9573fb Binary files /dev/null and b/Graphics/Units/Freestanding_Cirno.png differ diff --git a/Graphics/Units/Freestanding_Cirno.png.import b/Graphics/Units/Freestanding_Cirno.png.import new file mode 100644 index 0000000..3feb1e1 --- /dev/null +++ b/Graphics/Units/Freestanding_Cirno.png.import @@ -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 diff --git a/Graphics/Units/Freestanding_Sanae.png b/Graphics/Units/Freestanding_Sanae.png new file mode 100644 index 0000000..7877583 Binary files /dev/null and b/Graphics/Units/Freestanding_Sanae.png differ diff --git a/Graphics/Units/Freestanding_Sanae.png.import b/Graphics/Units/Freestanding_Sanae.png.import new file mode 100644 index 0000000..0c8f6ac --- /dev/null +++ b/Graphics/Units/Freestanding_Sanae.png.import @@ -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 diff --git a/Scenes/DownhillAutoscroller.tscn b/Scenes/DownhillAutoscroller.tscn index 0caf17f..2b68397 100644 --- a/Scenes/DownhillAutoscroller.tscn +++ b/Scenes/DownhillAutoscroller.tscn @@ -5,7 +5,7 @@ [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://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] resource_name = "PitTransition" @@ -61,9 +61,9 @@ __meta__ = { tile_set_name = "SnowySlopes" camera_h_offset = 2.5 spawning = { -Vector2( 45, -6 ): "NPC", -Vector2( 80, -7 ): "NPC", -Vector2( 218, -29 ): "NPC" +Vector2( 45, -6 ): "CIRNO", +Vector2( 80, -7 ): "SANAE", +Vector2( 218, -29 ): "CIRNO" } [node name="CanvasLayerBG" type="CanvasLayer" parent="."] diff --git a/Scripts/Constants.gd b/Scripts/Constants.gd index f9ddb2a..36ee686 100644 --- a/Scripts/Constants.gd +++ b/Scripts/Constants.gd @@ -1,7 +1,8 @@ enum UnitType { PLAYER, - NPC, RIVAL, + CIRNO, + SANAE, } enum ActionType { @@ -74,13 +75,12 @@ const UNIT_TYPE_ACTIONS = { ActionType.RECOIL, ActionType.SPIN, ], - UnitType.NPC: [ - ActionType.MOVE, - ], UnitType.RIVAL: [ ActionType.JUMP, ActionType.MOVE, ], + UnitType.CIRNO: [], + UnitType.SANAE: [], } const UNIT_TYPE_CURRENT_ACTIONS = { @@ -90,13 +90,16 @@ const UNIT_TYPE_CURRENT_ACTIONS = { UnitCurrentAction.RECOILING, UnitCurrentAction.SPINNING, ], - UnitType.NPC: [ - UnitCurrentAction.IDLE, - ], UnitType.RIVAL: [ UnitCurrentAction.IDLE, UnitCurrentAction.JUMPING, ], + UnitType.CIRNO: [ + UnitCurrentAction.IDLE, + ], + UnitType.SANAE: [ + UnitCurrentAction.IDLE, + ], } # default conditions @@ -107,12 +110,17 @@ const UNIT_TYPE_CONDITIONS = { UnitCondition.MOVING_STATUS: UnitMovingStatus.IDLE, UnitCondition.IS_INVINCIBLE: false, }, - UnitType.NPC: { + UnitType.RIVAL: { UnitCondition.CURRENT_ACTION: UnitCurrentAction.IDLE, UnitCondition.IS_ON_GROUND: false, 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.IS_ON_GROUND: false, UnitCondition.MOVING_STATUS: UnitMovingStatus.IDLE, @@ -125,9 +133,11 @@ const CURRENT_ACTION_TIMERS = { UnitCurrentAction.JUMPING: 0.4, UnitCurrentAction.RECOILING: 0.67, }, - UnitType.NPC: { + UnitType.RIVAL: { UnitCurrentAction.JUMPING: 0.4, }, + UnitType.CIRNO: {}, + UnitType.SANAE: {}, } const UNIT_CONDITION_TIMERS = { @@ -135,8 +145,9 @@ const UNIT_CONDITION_TIMERS = { UnitType.PLAYER: { UnitCondition.IS_INVINCIBLE: [2.5, true, false], }, - UnitType.NPC: {}, UnitType.RIVAL: {}, + UnitType.CIRNO: {}, + UnitType.SANAE: {}, } # 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) [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: [ [Vector2(0, 1.5), [Direction.LEFT, Direction.UP, Direction.RIGHT]], [Vector2(-.25, .25), [Direction.LEFT]], @@ -167,6 +170,22 @@ const ENV_COLLIDERS = { # contact with ground is at (0, 0) [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 = { @@ -213,27 +232,31 @@ const UNIT_SPRITES = { SpriteClass.JUMP: [false, ["Jump1", "Jump2"]], SpriteClass.RECOIL: [false, ["Recoil"]], }, - UnitType.NPC: { - SpriteClass.IDLE: [false, ["Idle"]], - SpriteClass.WALK: [true, ["Walk"]], - SpriteClass.JUMP: [false, ["Jump2"]], - }, UnitType.RIVAL: { SpriteClass.IDLE: [false, ["Idle"]], SpriteClass.WALK: [false, ["Move0", "Move-1", "Move-2", "Move+1", "Move+2"]], 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 = { UnitType.PLAYER: 5, - UnitType.NPC: 3, UnitType.RIVAL: 5, + UnitType.CIRNO: 0, + UnitType.SANAE: 0, } const UNIT_TYPE_JUMP_SPEEDS = { - UnitType.PLAYER: 4.5, UnitType.RIVAL: 4.5, + UnitType.PLAYER: 4.5, } const SCALE_FACTOR = 1 diff --git a/Scripts/GameScene.gd b/Scripts/GameScene.gd index 930d86a..06b8822 100644 --- a/Scripts/GameScene.gd +++ b/Scripts/GameScene.gd @@ -13,7 +13,8 @@ export var camera_h_offset : float = 1 const Constants = preload("res://Scripts/Constants.gd") const Unit = preload("res://Scripts/Unit.gd") 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 diff --git a/Units/DownhillAutoscrollerNPC.gd b/Units/DownhillAutoscrollerNPC.gd index f4e7bbb..388aa6f 100644 --- a/Units/DownhillAutoscrollerNPC.gd +++ b/Units/DownhillAutoscrollerNPC.gd @@ -1,5 +1,15 @@ extends NPCExample +func _ready(): + ._ready() + facing = Constants.Direction.LEFT + func before_tick(): 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) diff --git a/Units/DownhillAutoscrollerNPC.tscn b/Units/DownhillAutoscrollerNPC.tscn deleted file mode 100644 index 2e9b016..0000000 --- a/Units/DownhillAutoscrollerNPC.tscn +++ /dev/null @@ -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 ) diff --git a/Units/DownhillAutoscrollerNPCCirno.tscn b/Units/DownhillAutoscrollerNPCCirno.tscn new file mode 100644 index 0000000..e093a08 --- /dev/null +++ b/Units/DownhillAutoscrollerNPCCirno.tscn @@ -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 ) diff --git a/Units/DownhillAutoscrollerNPCSanae.tscn b/Units/DownhillAutoscrollerNPCSanae.tscn new file mode 100644 index 0000000..7dec760 --- /dev/null +++ b/Units/DownhillAutoscrollerNPCSanae.tscn @@ -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 ) diff --git a/Units/DownhillAutoscrollerRival2.tscn b/Units/DownhillAutoscrollerRivalLetty.tscn similarity index 90% rename from Units/DownhillAutoscrollerRival2.tscn rename to Units/DownhillAutoscrollerRivalLetty.tscn index 786e4f2..34f3f53 100644 --- a/Units/DownhillAutoscrollerRival2.tscn +++ b/Units/DownhillAutoscrollerRivalLetty.tscn @@ -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://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=4] +[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+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] extents = Vector2( 9, 34 ) @@ -14,7 +15,7 @@ extents = Vector2( 9, 34 ) z_index = 1 collision_layer = 0 script = ExtResource( 1 ) -unit_type = 2 +unit_type = 1 [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2( 0, -36 ) @@ -22,7 +23,7 @@ shape = SubResource( 1 ) [node name="Idle" type="Sprite" parent="."] visible = false -texture = ExtResource( 2 ) +texture = ExtResource( 6 ) offset = Vector2( 0, -48 ) [node name="Move0" type="Sprite" parent="."] @@ -37,19 +38,17 @@ offset = Vector2( 0, -48 ) [node name="Move+2" type="Sprite" parent="."] visible = false -texture = ExtResource( 4 ) +texture = ExtResource( 3 ) offset = Vector2( 0, -48 ) [node name="Move-1" type="Sprite" parent="."] visible = false -texture = ExtResource( 3 ) +texture = ExtResource( 7 ) offset = Vector2( 0, -48 ) [node name="Move-2" type="Sprite" parent="."] visible = false -texture = ExtResource( 6 ) +texture = ExtResource( 4 ) offset = Vector2( 0, -48 ) -script = ExtResource( 1 ) -unit_type = 2 [connection signal="area_entered" from="." to="." method="_on_Player_area_entered"] diff --git a/Units/DownhillAutoscrollerRival.tscn b/Units/DownhillAutoscrollerRivalMystia.tscn similarity index 99% rename from Units/DownhillAutoscrollerRival.tscn rename to Units/DownhillAutoscrollerRivalMystia.tscn index 2eeba4a..0f8dc16 100644 --- a/Units/DownhillAutoscrollerRival.tscn +++ b/Units/DownhillAutoscrollerRivalMystia.tscn @@ -14,7 +14,7 @@ extents = Vector2( 9, 34 ) z_index = 1 collision_layer = 0 script = ExtResource( 1 ) -unit_type = 2 +unit_type = 1 [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2( 0, -36 )