diff --git a/Graphics/Animations/Background.tres b/Graphics/Animations/Background.tres new file mode 100644 index 0000000..90bd0f6 --- /dev/null +++ b/Graphics/Animations/Background.tres @@ -0,0 +1,17 @@ +[gd_resource type="AnimatedTexture" load_steps=5 format=2] + +[ext_resource path="res://Graphics/Background/sprite_0.png" type="Texture" id=1] +[ext_resource path="res://Graphics/Background/sprite_2.png" type="Texture" id=2] +[ext_resource path="res://Graphics/Background/sprite_3.png" type="Texture" id=3] +[ext_resource path="res://Graphics/Background/sprite_1.png" type="Texture" id=4] + +[resource] +frames = 4 +fps = 2.0 +frame_0/texture = ExtResource( 1 ) +frame_1/texture = ExtResource( 4 ) +frame_1/delay_sec = 0.0 +frame_2/texture = ExtResource( 2 ) +frame_2/delay_sec = 0.0 +frame_3/texture = ExtResource( 3 ) +frame_3/delay_sec = 0.0 diff --git a/Graphics/Background/sprite_0.png b/Graphics/Background/sprite_0.png new file mode 100644 index 0000000..1d32001 Binary files /dev/null and b/Graphics/Background/sprite_0.png differ diff --git a/Graphics/Background/sprite_0.png.import b/Graphics/Background/sprite_0.png.import new file mode 100644 index 0000000..a19849e --- /dev/null +++ b/Graphics/Background/sprite_0.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/sprite_0.png-ff81b9ea03806575d623741ef5a30483.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Graphics/Background/sprite_0.png" +dest_files=[ "res://.import/sprite_0.png-ff81b9ea03806575d623741ef5a30483.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/Background/sprite_1.png b/Graphics/Background/sprite_1.png new file mode 100644 index 0000000..5147377 Binary files /dev/null and b/Graphics/Background/sprite_1.png differ diff --git a/Graphics/Background/sprite_1.png.import b/Graphics/Background/sprite_1.png.import new file mode 100644 index 0000000..9003083 --- /dev/null +++ b/Graphics/Background/sprite_1.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/sprite_1.png-24c02427d2ae9f728376fc013b1bd6fe.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Graphics/Background/sprite_1.png" +dest_files=[ "res://.import/sprite_1.png-24c02427d2ae9f728376fc013b1bd6fe.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/Background/sprite_2.png b/Graphics/Background/sprite_2.png new file mode 100644 index 0000000..1d32001 Binary files /dev/null and b/Graphics/Background/sprite_2.png differ diff --git a/Graphics/Background/sprite_2.png.import b/Graphics/Background/sprite_2.png.import new file mode 100644 index 0000000..b8bdf7f --- /dev/null +++ b/Graphics/Background/sprite_2.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/sprite_2.png-9a198e44f555bdd03266a60c336dfa09.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Graphics/Background/sprite_2.png" +dest_files=[ "res://.import/sprite_2.png-9a198e44f555bdd03266a60c336dfa09.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/Background/sprite_3.png b/Graphics/Background/sprite_3.png new file mode 100644 index 0000000..ac11b3b Binary files /dev/null and b/Graphics/Background/sprite_3.png differ diff --git a/Graphics/Background/sprite_3.png.import b/Graphics/Background/sprite_3.png.import new file mode 100644 index 0000000..82f3087 --- /dev/null +++ b/Graphics/Background/sprite_3.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/sprite_3.png-9e974f65603418654212e016e6c9ac60.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Graphics/Background/sprite_3.png" +dest_files=[ "res://.import/sprite_3.png-9e974f65603418654212e016e6c9ac60.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/Tile Sets/Kyouko.mdp b/Graphics/Kyouko.mdp similarity index 100% rename from Tile Sets/Kyouko.mdp rename to Graphics/Kyouko.mdp diff --git a/Graphics/Mystia.mdp b/Graphics/Mystia.mdp new file mode 100644 index 0000000..432cbe7 Binary files /dev/null and b/Graphics/Mystia.mdp differ diff --git a/Tile Sets/SnowySlopes.mdp b/Graphics/SnowySlopes.mdp similarity index 100% rename from Tile Sets/SnowySlopes.mdp rename to Graphics/SnowySlopes.mdp diff --git a/Graphics/Units/Mystia/Move+1.png b/Graphics/Units/Mystia/Move+1.png new file mode 100644 index 0000000..4b6267f Binary files /dev/null and b/Graphics/Units/Mystia/Move+1.png differ diff --git a/Graphics/Units/Mystia/Move+1.png.import b/Graphics/Units/Mystia/Move+1.png.import new file mode 100644 index 0000000..6c3b9ff --- /dev/null +++ b/Graphics/Units/Mystia/Move+1.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Move+1.png-9a236d6d39b3f34ffdc89a3ec90a5b49.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Graphics/Units/Mystia/Move+1.png" +dest_files=[ "res://.import/Move+1.png-9a236d6d39b3f34ffdc89a3ec90a5b49.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/Mystia/Move+2.png b/Graphics/Units/Mystia/Move+2.png new file mode 100644 index 0000000..36927de Binary files /dev/null and b/Graphics/Units/Mystia/Move+2.png differ diff --git a/Graphics/Units/Mystia/Move+2.png.import b/Graphics/Units/Mystia/Move+2.png.import new file mode 100644 index 0000000..04b261a --- /dev/null +++ b/Graphics/Units/Mystia/Move+2.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Move+2.png-f5f412e20b450110f9f086294b1041db.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Graphics/Units/Mystia/Move+2.png" +dest_files=[ "res://.import/Move+2.png-f5f412e20b450110f9f086294b1041db.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/Mystia/Move-1.png b/Graphics/Units/Mystia/Move-1.png new file mode 100644 index 0000000..b8c74b5 Binary files /dev/null and b/Graphics/Units/Mystia/Move-1.png differ diff --git a/Graphics/Units/Mystia/Move-1.png.import b/Graphics/Units/Mystia/Move-1.png.import new file mode 100644 index 0000000..8e565ff --- /dev/null +++ b/Graphics/Units/Mystia/Move-1.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Move-1.png-0400dd59e0a66e2a538ac84d56fe9ae6.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Graphics/Units/Mystia/Move-1.png" +dest_files=[ "res://.import/Move-1.png-0400dd59e0a66e2a538ac84d56fe9ae6.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/Mystia/Move-2.png b/Graphics/Units/Mystia/Move-2.png new file mode 100644 index 0000000..a474f3f Binary files /dev/null and b/Graphics/Units/Mystia/Move-2.png differ diff --git a/Graphics/Units/Mystia/Move-2.png.import b/Graphics/Units/Mystia/Move-2.png.import new file mode 100644 index 0000000..a3d346e --- /dev/null +++ b/Graphics/Units/Mystia/Move-2.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Move-2.png-0f04babfecb88a70ec5b8929a68cb669.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Graphics/Units/Mystia/Move-2.png" +dest_files=[ "res://.import/Move-2.png-0f04babfecb88a70ec5b8929a68cb669.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/Mystia/Move0.png b/Graphics/Units/Mystia/Move0.png new file mode 100644 index 0000000..5f09b03 Binary files /dev/null and b/Graphics/Units/Mystia/Move0.png differ diff --git a/Graphics/Units/Mystia/Move0.png.import b/Graphics/Units/Mystia/Move0.png.import new file mode 100644 index 0000000..ffb3878 --- /dev/null +++ b/Graphics/Units/Mystia/Move0.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Move0.png-8aac8254368d3791b83519b221c222e6.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Graphics/Units/Mystia/Move0.png" +dest_files=[ "res://.import/Move0.png-8aac8254368d3791b83519b221c222e6.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 9aa0629..0caf17f 100644 --- a/Scenes/DownhillAutoscroller.tscn +++ b/Scenes/DownhillAutoscroller.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://Tile Sets/SnowySlopes.tres" type="TileSet" id=1] [ext_resource path="res://Units/DownhillAutoscrollerPlayer.tscn" type="PackedScene" id=2] [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] [sub_resource type="Animation" id=1] resource_name = "PitTransition" @@ -64,6 +66,14 @@ Vector2( 80, -7 ): "NPC", Vector2( 218, -29 ): "NPC" } +[node name="CanvasLayerBG" type="CanvasLayer" parent="."] +layer = -1 + +[node name="TextureRect" type="TextureRect" parent="CanvasLayerBG"] +anchor_right = 1.0 +anchor_bottom = 1.0 +texture = ExtResource( 4 ) + [node name="Stage" type="TileMap" parent="."] tile_set = ExtResource( 1 ) cell_size = Vector2( 48, 48 ) @@ -89,6 +99,9 @@ offset = Vector2( 0, -15 ) [node name="SpectatorCam" type="Camera2D" parent="."] offset = Vector2( 0, -15 ) +[node name="Rival" parent="." instance=ExtResource( 6 )] +position = Vector2( 91, -197 ) + [node name="CanvasLayer" type="CanvasLayer" parent="."] [node name="ColorRect" type="ColorRect" parent="CanvasLayer"] diff --git a/Scripts/Constants.gd b/Scripts/Constants.gd index 51737e3..f9ddb2a 100644 --- a/Scripts/Constants.gd +++ b/Scripts/Constants.gd @@ -1,6 +1,7 @@ enum UnitType { PLAYER, NPC, + RIVAL, } enum ActionType { @@ -76,6 +77,10 @@ const UNIT_TYPE_ACTIONS = { UnitType.NPC: [ ActionType.MOVE, ], + UnitType.RIVAL: [ + ActionType.JUMP, + ActionType.MOVE, + ], } const UNIT_TYPE_CURRENT_ACTIONS = { @@ -88,6 +93,10 @@ const UNIT_TYPE_CURRENT_ACTIONS = { UnitType.NPC: [ UnitCurrentAction.IDLE, ], + UnitType.RIVAL: [ + UnitCurrentAction.IDLE, + UnitCurrentAction.JUMPING, + ], } # default conditions @@ -103,6 +112,11 @@ const UNIT_TYPE_CONDITIONS = { UnitCondition.IS_ON_GROUND: false, UnitCondition.MOVING_STATUS: UnitMovingStatus.IDLE, }, + UnitType.RIVAL: { + UnitCondition.CURRENT_ACTION: UnitCurrentAction.IDLE, + UnitCondition.IS_ON_GROUND: false, + UnitCondition.MOVING_STATUS: UnitMovingStatus.IDLE, + }, } # in seconds @@ -111,6 +125,9 @@ const CURRENT_ACTION_TIMERS = { UnitCurrentAction.JUMPING: 0.4, UnitCurrentAction.RECOILING: 0.67, }, + UnitType.NPC: { + UnitCurrentAction.JUMPING: 0.4, + }, } const UNIT_CONDITION_TIMERS = { @@ -119,6 +136,7 @@ const UNIT_CONDITION_TIMERS = { UnitCondition.IS_INVINCIBLE: [2.5, true, false], }, UnitType.NPC: {}, + UnitType.RIVAL: {}, } # Position relative to player's origin, list of directions to check for collision @@ -140,6 +158,15 @@ const ENV_COLLIDERS = { [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]], + [Vector2(.25, .25), [Direction.RIGHT]], + [Vector2(-.25, 1.25), [Direction.LEFT]], + [Vector2(.25, 1.25), [Direction.RIGHT]], + # contact with ground is at (0, 0) + [Vector2(0, 0), [Direction.LEFT, Direction.DOWN, Direction.RIGHT]], + ], } const INPUT_MAP = { @@ -191,15 +218,22 @@ const UNIT_SPRITES = { 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"]], + }, } const UNIT_TYPE_MOVE_SPEEDS = { UnitType.PLAYER: 5, UnitType.NPC: 3, + UnitType.RIVAL: 5, } const UNIT_TYPE_JUMP_SPEEDS = { UnitType.PLAYER: 4.5, + UnitType.RIVAL: 4.5, } const SCALE_FACTOR = 1 diff --git a/Scripts/GameScene.gd b/Scripts/GameScene.gd index 6ec7b21..930d86a 100644 --- a/Scripts/GameScene.gd +++ b/Scripts/GameScene.gd @@ -60,6 +60,9 @@ func _ready(): player_cam = player.get_node("Camera2D") player_cam.make_current() + units.append(get_node("Rival")) + get_node("Rival").init_unit_w_scene(self) + stage_env = load("res://Scripts/StageEnvironment.gd").new(self) player.get_node("Camera2D").make_current() for spawning_key in spawning: diff --git a/Scripts/Unit.gd b/Scripts/Unit.gd index 69e8c89..49b4669 100644 --- a/Scripts/Unit.gd +++ b/Scripts/Unit.gd @@ -80,6 +80,8 @@ func get_condition(condition_num : int, default): return default func is_current_action_timer_done(current_action : int): + if Constants.CURRENT_ACTION_TIMERS[unit_type].keys().find(current_action) == -1: + print(Constants.UnitType.keys()[unit_type] + " " + Constants.UnitCurrentAction.keys()[current_action]) assert(current_action in Constants.CURRENT_ACTION_TIMERS[unit_type].keys()) return current_action_time_elapsed >= Constants.CURRENT_ACTION_TIMERS[unit_type][current_action] diff --git a/Units/DownhillAutoscrollerRival.tscn b/Units/DownhillAutoscrollerRival.tscn new file mode 100644 index 0000000..2eeba4a --- /dev/null +++ b/Units/DownhillAutoscrollerRival.tscn @@ -0,0 +1,53 @@ +[gd_scene load_steps=8 format=2] + +[ext_resource path="res://Scripts/Units/NPCUnit.gd" type="Script" id=1] +[ext_resource path="res://Graphics/Units/Mystia/Move-1.png" type="Texture" id=3] +[ext_resource path="res://Graphics/Units/Mystia/Move+2.png" type="Texture" id=4] +[ext_resource path="res://Graphics/Units/Mystia/Move+1.png" type="Texture" id=5] +[ext_resource path="res://Graphics/Units/Mystia/Move0.png" type="Texture" id=6] +[ext_resource path="res://Graphics/Units/Mystia/Move-2.png" type="Texture" id=7] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 9, 34 ) + +[node name="Rival" type="Area2D"] +z_index = 1 +collision_layer = 0 +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( 6 ) +offset = Vector2( 0, -48 ) + +[node name="Move0" type="Sprite" parent="."] +visible = false +texture = ExtResource( 6 ) +offset = Vector2( 0, -48 ) + +[node name="Move+1" type="Sprite" parent="."] +visible = false +texture = ExtResource( 5 ) +offset = Vector2( 0, -48 ) + +[node name="Move+2" type="Sprite" parent="."] +visible = false +texture = ExtResource( 4 ) +offset = Vector2( 0, -48 ) + +[node name="Move-1" type="Sprite" parent="."] +visible = false +texture = ExtResource( 3 ) +offset = Vector2( 0, -48 ) + +[node name="Move-2" type="Sprite" parent="."] +visible = false +texture = ExtResource( 7 ) +offset = Vector2( 0, -48 ) + +[connection signal="area_entered" from="." to="." method="_on_Player_area_entered"] diff --git a/default_env.tres b/default_env.tres index 20207a4..3e42e6f 100644 Binary files a/default_env.tres and b/default_env.tres differ diff --git a/project.godot b/project.godot index 8780b39..a44d36b 100644 --- a/project.godot +++ b/project.godot @@ -99,4 +99,3 @@ common/enable_pause_aware_picking=true [rendering] 2d/snapping/use_gpu_pixel_snap=true -environment/default_environment="res://default_env.tres"