Compare commits

..

No commits in common. "9a9eabd33124f3619348cb21c7f0aadf87bf8ef2" and "f0a60217bc6ba75124eb5861d8047fae7c5a71cf" have entirely different histories.

34 changed files with 27 additions and 390 deletions

View File

@ -18,5 +18,3 @@ __meta__ = {
position = Vector2( 112, 56 ) position = Vector2( 112, 56 )
[node name="UI_Layer" parent="." instance=ExtResource( 3 )] [node name="UI_Layer" parent="." instance=ExtResource( 3 )]
[node name="MusicPlayer" type="AudioStreamPlayer" parent="."]

Binary file not shown.

View File

@ -1,15 +0,0 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/summer nights.ogg-5ab1bf5ee50e01e8c790382e18d8d7ae.oggstr"
[deps]
source_file="res://assets_tmp/Music/summer nights.ogg"
dest_files=[ "res://.import/summer nights.ogg-5ab1bf5ee50e01e8c790382e18d8d7ae.oggstr" ]
[params]
loop=true
loop_offset=0

Binary file not shown.

View File

@ -1,23 +0,0 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/door_a.wav-af28d3164b6ea77805c19713d04436f1.sample"
[deps]
source_file="res://assets_tmp/SE/door_a.wav"
dest_files=[ "res://.import/door_a.wav-af28d3164b6ea77805c19713d04436f1.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

View File

@ -1,23 +0,0 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/hit_a.wav-54645552806f5ce18a4e26344d3be4b8.sample"
[deps]
source_file="res://assets_tmp/SE/hit_a.wav"
dest_files=[ "res://.import/hit_a.wav-54645552806f5ce18a4e26344d3be4b8.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

View File

@ -1,23 +0,0 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/land.wav-387003e3c9887380132c51d2d20620cc.sample"
[deps]
source_file="res://assets_tmp/SE/land.wav"
dest_files=[ "res://.import/land.wav-387003e3c9887380132c51d2d20620cc.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

View File

@ -1,23 +0,0 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/pop.wav-233ae352faded754a591c4a44a5f258a.sample"
[deps]
source_file="res://assets_tmp/SE/pop.wav"
dest_files=[ "res://.import/pop.wav-233ae352faded754a591c4a44a5f258a.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

View File

@ -1,23 +0,0 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/shot_a.wav-469c6d42db3f1549bc725112dbad0c8b.sample"
[deps]
source_file="res://assets_tmp/SE/shot_a.wav"
dest_files=[ "res://.import/shot_a.wav-469c6d42db3f1549bc725112dbad0c8b.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

View File

@ -1,23 +0,0 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/tap.wav-0b54164b5e92fd14172eaf1f67101351.sample"
[deps]
source_file="res://assets_tmp/SE/tap.wav"
dest_files=[ "res://.import/tap.wav-0b54164b5e92fd14172eaf1f67101351.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

View File

@ -1,23 +0,0 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/tick.wav-288f2e396cfd3edb94d732bdcee848e3.sample"
[deps]
source_file="res://assets_tmp/SE/tick.wav"
dest_files=[ "res://.import/tick.wav-288f2e396cfd3edb94d732bdcee848e3.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

View File

@ -1,23 +0,0 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/tick2.wav-725cdabf8b024aed7e5833aa4f009df7.sample"
[deps]
source_file="res://assets_tmp/SE/tick2.wav"
dest_files=[ "res://.import/tick2.wav-725cdabf8b024aed7e5833aa4f009df7.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

View File

@ -1,23 +0,0 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/tink.wav-edd569613ac2bf93a8f5fef1375d2203.sample"
[deps]
source_file="res://assets_tmp/SE/tink.wav"
dest_files=[ "res://.import/tink.wav-edd569613ac2bf93a8f5fef1375d2203.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

View File

@ -1,23 +0,0 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/whiff.wav-14d346818caf5200cee06d66813e1406.sample"
[deps]
source_file="res://assets_tmp/SE/whiff.wav"
dest_files=[ "res://.import/whiff.wav-14d346818caf5200cee06d66813e1406.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -11,7 +11,7 @@ export var debug_actor: bool = false
#onready var movement_animations: AnimatedSprite = $AnimatedSprite #onready var movement_animations: AnimatedSprite = $AnimatedSprite
onready var sound_effect_player: AudioStreamPlayer = $AudioStreamPlayer_StateReceiver onready var sound_effect_player: AudioStreamPlayer = $SE_Player
#onready var movement_component: MovementComponent = $movement_component #onready var movement_component: MovementComponent = $movement_component
onready var movement_component: Movement_StateReceiver = $Movement_StateReceiver onready var movement_component: Movement_StateReceiver = $Movement_StateReceiver

View File

@ -7,7 +7,7 @@ var request_state_change: FuncRef
export(Array, Resource) var sound_effects export(Array, Resource) var sound_effects
onready var current_state :StateAnimatedActor onready var current_state = StateAnimatedActor.new()
# Declare member variables here. Examples: # Declare member variables here. Examples:
# var a = 2 # var a = 2
@ -28,9 +28,7 @@ var sound_effects_dict: Dictionary
func _ready(): func _ready():
# Trying something new with a custom resourse. # Trying something new with a custom resourse.
for i in sound_effects: for i in sound_effects:
if i is SE_StateFrame: sound_effects_dict[i.animation_name + str(i.frame_number)] = i.sound
sound_effects_dict[i.state_name + str(i.frame_number)] = i
if debug_component:
print (sound_effects_dict) print (sound_effects_dict)
request_state_change = funcref(get_node(callable_state_machine), 'change_to_known_state') request_state_change = funcref(get_node(callable_state_machine), 'change_to_known_state')
@ -45,45 +43,22 @@ func _ready():
#print(sounds.sounds["pew"]) #print(sounds.sounds["pew"])
#sound_effects.play() #sound_effects.play()
#var last_sound_frame_animation: String = '' var last_sound_frame_animation: String = ''
#var last_sound_frame: int = -1 var last_sound_frame: int = -1
#func play_sound_frame(animation: String, frame: int ): func play_sound_frame(animation: String, frame: int ):
# ##DEBUG: ##DEBUG:
# #if animation == 'run' and frame == 6: #if animation == 'run' and frame == 6:
# # print("Do the thign! (", animation + str(frame), ")", " (", last_sound_frame_animation + str(last_sound_frame), ")") # print("Do the thign! (", animation + str(frame), ")", " (", last_sound_frame_animation + str(last_sound_frame), ")")
# if animation != last_sound_frame_animation or frame != last_sound_frame: if animation != last_sound_frame_animation or frame != last_sound_frame:
# last_sound_frame = frame last_sound_frame = frame
# last_sound_frame_animation = animation last_sound_frame_animation = animation
# var sound_index = animation + str(frame) var sound_index = animation + str(frame)
# if sound_effects_dict.has(sound_index): if sound_effects_dict.has(sound_index):
# stream = sound_effects_dict[sound_index] stream = sound_effects_dict[sound_index]
# play()
# print(self.name, " Playing SE: ", sound_index)
var current_se_index :String
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var sound_index = current_state.name + str(current_state.animation_frame)
if current_se_index != sound_index and sound_effects_dict.has(sound_index):
print("Play sound: ", current_state.name, current_state.animation_frame)
current_se_index = sound_index
##TODO: Better to do an is check here or a cast
## We already assure these are SE_StateFrames
var se_resource :SE_StateFrame = sound_effects_dict[sound_index]
stream = se_resource.sound
#var this_sound :AudioStreamSample
play() play()
# Not sure what should be called first here. print(self.name, " Playing SE: ", sound_index)
if has_method('_state_process_' + current_state.name):
call('_state_process_' + current_state.name)
func _on_state_change(old_state_name:String, new_state :State):
###### State machine # Called every frame. 'delta' is the elapsed time since the previous frame.
if new_state is StateAnimatedActor: #Testing this. Update: It works #func _process(delta):
current_state = new_state # pass
if has_method('_on_state_change_' + current_state.name):
call('_on_state_change_' + current_state.name)
else:
push_warning("Received non animated Actor state.")
#current_state = new_state

View File

@ -3,9 +3,5 @@ extends Resource
export (String) var state_name export (String) var state_name
export(int) var frame_number = 0 export(int) var frame_number
## Editor will enumerate
enum TYPE {FRAME_ONE_SHOT, LOOPING, NONE = -1}
export(TYPE) var sound_effect_type = TYPE.FRAME_ONE_SHOT
export (AudioStreamSample) var sound export (AudioStreamSample) var sound

View File

@ -7,26 +7,6 @@ extends Node
##TODO: Should be based on screen position for starter ##TODO: Should be based on screen position for starter
onready var player_start_position := Vector2(50,50) onready var player_start_position := Vector2(50,50)
onready var current_music_track :AudioStream
func change_music_track(_music_track :AudioStream ):
if current_music_track != _music_track:
current_music_track = _music_track
var juke_box: AudioStreamPlayer = get_node("/root/Main/MusicPlayer")
if juke_box:
if juke_box.playing:
juke_box.stop()
juke_box.stream = current_music_track
juke_box.play()
else:
push_warning("Music Player '/root/Main/MusicPlayer' not found.")
func stop_music():
var juke_box: AudioStreamPlayer = get_node("/root/Main/MusicPlayer")
if juke_box:
if juke_box.playing:
juke_box.stop()
func change_level(_level_name :String, _position_name :String): func change_level(_level_name :String, _position_name :String):
print("res://src/levels/" + _level_name + ".tscn" ) print("res://src/levels/" + _level_name + ".tscn" )
var SceneTransition = get_node("/root/Main/SceneTransition") var SceneTransition = get_node("/root/Main/SceneTransition")

View File

@ -37,3 +37,4 @@ callable_state_machine = NodePath("../Movement_StateMachine")
[node name="AudioStreamPlayer_StateReceiver" type="AudioStreamPlayer" parent="."] [node name="AudioStreamPlayer_StateReceiver" type="AudioStreamPlayer" parent="."]
script = ExtResource( 3 ) script = ExtResource( 3 )
callable_state_machine = NodePath("../Movement_StateMachine") callable_state_machine = NodePath("../Movement_StateMachine")
sound_effects = [ null ]

View File

@ -171,12 +171,9 @@ func _state_process_physics_roll():
request_state_change.call_func('fall') request_state_change.call_func('fall')
var level_transition_latch: bool var level_transition_latch: bool
var level_enter_dir: float
func _on_state_change_enter_right(): func _on_state_change_enter_right():
#desired_movement_vector.x = RIGHT #desired_movement_vector.x = RIGHT
## Trying to do this in actor now. parent.transform.x.x = RIGHT
#parent.transform.x.x = RIGHT
level_enter_dir = parent.transform.x.x
level_transition_latch = false level_transition_latch = false
func _state_process_physics_enter_right(): func _state_process_physics_enter_right():

View File

@ -37,11 +37,6 @@ func touch_the_thing(the_thing: Interactable) -> bool:
if the_thing is LevelTransition: if the_thing is LevelTransition:
if movement_state_machine.current_state.name != 'enter_right': if movement_state_machine.current_state.name != 'enter_right':
if the_thing._transition_type == 'door_right': if the_thing._transition_type == 'door_right':
# Make sure we're facing right.
transform.x.x = movement_component.RIGHT
movement_state_machine.change_to_known_state('enter_right')
elif the_thing._transition_type == 'door_left':
transform.x.x = movement_component.LEFT
movement_state_machine.change_to_known_state('enter_right') movement_state_machine.change_to_known_state('enter_right')
the_thing.trigger_interaction() the_thing.trigger_interaction()
return true return true

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=33 format=2] [gd_scene load_steps=27 format=2]
[ext_resource path="res://lib/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1] [ext_resource path="res://lib/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/actors/players/playerE/PlayerE_SpriteFrames.tres" type="SpriteFrames" id=2] [ext_resource path="res://assets/actors/players/playerE/PlayerE_SpriteFrames.tres" type="SpriteFrames" id=2]
@ -23,9 +23,6 @@
[ext_resource path="res://lib/templates/Interactable/Interactable_Receiver.gd" type="Script" id=21] [ext_resource path="res://lib/templates/Interactable/Interactable_Receiver.gd" type="Script" id=21]
[ext_resource path="res://src/actors/players/playerE/states/enter_right.tres" type="Resource" id=22] [ext_resource path="res://src/actors/players/playerE/states/enter_right.tres" type="Resource" id=22]
[ext_resource path="res://src/actors/players/playerE/states/climb.tres" type="Resource" id=23] [ext_resource path="res://src/actors/players/playerE/states/climb.tres" type="Resource" id=23]
[ext_resource path="res://lib/classes/sound_effect_state_frame.gd" type="Script" id=24]
[ext_resource path="res://assets_tmp/SE/tap.wav" type="AudioStream" id=25]
[ext_resource path="res://assets_tmp/SE/land.wav" type="AudioStream" id=26]
[sub_resource type="Resource" id=3] [sub_resource type="Resource" id=3]
resource_local_to_scene = true resource_local_to_scene = true
@ -41,30 +38,6 @@ horizontal_speed_offset_acceleration = 0.0
jerk_factor = 0.0 jerk_factor = 0.0
animation_sequence = [ "hurt" ] animation_sequence = [ "hurt" ]
[sub_resource type="Resource" id=4]
resource_name = "move_0"
script = ExtResource( 24 )
state_name = "move"
frame_number = 0
sound_effect_type = 0
sound = ExtResource( 25 )
[sub_resource type="Resource" id=5]
resource_name = "move_4"
script = ExtResource( 24 )
state_name = "move"
frame_number = 4
sound_effect_type = 0
sound = ExtResource( 25 )
[sub_resource type="Resource" id=6]
resource_name = "land_0"
script = ExtResource( 24 )
state_name = "land"
frame_number = 0
sound_effect_type = 0
sound = ExtResource( 26 )
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 7, 14 ) extents = Vector2( 7, 14 )
@ -121,9 +94,6 @@ collision_mask = 1024
collide_with_areas = true collide_with_areas = true
collide_with_bodies = false collide_with_bodies = false
[node name="AudioStreamPlayer_StateReceiver" parent="." index="6"]
sound_effects = [ SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ]
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="7"] [node name="CollisionShape2D" type="CollisionShape2D" parent="." index="7"]
position = Vector2( 0, 2 ) position = Vector2( 0, 2 )
shape = SubResource( 1 ) shape = SubResource( 1 )

View File

@ -6,21 +6,12 @@ extends Node2D
# var a = 2 # var a = 2
# var b = "text" # var b = "text"
export var music_track :AudioStream
## if no music_track specified, LevelInfo will keep
## the last running track playing
export var keep_last_music_track: bool = false
onready var player_start = $PlayerStart onready var player_start = $PlayerStart
var entrances:Dictionary var entrances:Dictionary
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
LevelInfo.player_start_position = player_start.transform.origin LevelInfo.player_start_position = player_start.transform.origin
if music_track:
LevelInfo.change_music_track(music_track)
elif keep_last_music_track == false:
LevelInfo.stop_music()
for ent in get_children(): for ent in get_children():
if ent is Position2D: if ent is Position2D:

View File

@ -1,15 +1,12 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=5 format=2]
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1] [ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2] [ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
[ext_resource path="res://lib/components/Hitbox_Component.tscn" type="PackedScene" id=3] [ext_resource path="res://lib/components/Hitbox_Component.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/Interactables/LevelTransition.tscn" type="PackedScene" id=4]
[sub_resource type="CircleShape2D" id=1] [sub_resource type="CircleShape2D" id=1]
radius = 5.09902 radius = 5.09902
[sub_resource type="RectangleShape2D" id=2]
[node name="CloneBox" instance=ExtResource( 1 )] [node name="CloneBox" instance=ExtResource( 1 )]
[node name="TileMap Collision" parent="." index="1"] [node name="TileMap Collision" parent="." index="1"]
@ -42,16 +39,3 @@ shape = SubResource( 1 )
[node name="EnterLeft" type="Position2D" parent="." index="5"] [node name="EnterLeft" type="Position2D" parent="." index="5"]
position = Vector2( -13, 28 ) position = Vector2( -13, 28 )
[node name="LevelTransition" parent="." index="6" instance=ExtResource( 4 )]
position = Vector2( -12, 31 )
_transition_type = "door_left"
_destination_level_name = "TestBox"
_destination_position_name = "EnterRight"
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition" index="0"]
modulate = Color( 1, 0, 1, 1 )
shape = SubResource( 2 )
__meta__ = {
"_edit_lock_": true
}

View File

@ -1,10 +1,9 @@
[gd_scene load_steps=9 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1] [ext_resource path="res://src/templates/level_templates/LevelTemplate.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2] [ext_resource path="res://assets/levels/LegacyFantasy-High_Forest/tileset.tres" type="TileSet" id=2]
[ext_resource path="res://lib/components/Hitbox_Component.tscn" type="PackedScene" id=3] [ext_resource path="res://lib/components/Hitbox_Component.tscn" type="PackedScene" id=3]
[ext_resource path="res://src/Interactables/LevelTransition.tscn" type="PackedScene" id=4] [ext_resource path="res://src/Interactables/LevelTransition.tscn" type="PackedScene" id=4]
[ext_resource path="res://assets_tmp/Music/summer nights.ogg" type="AudioStream" id=5]
[sub_resource type="CircleShape2D" id=1] [sub_resource type="CircleShape2D" id=1]
radius = 5.09902 radius = 5.09902
@ -16,7 +15,6 @@ extents = Vector2( 4.5, 10 )
extents = Vector2( 8, 40 ) extents = Vector2( 8, 40 )
[node name="TestBox" instance=ExtResource( 1 )] [node name="TestBox" instance=ExtResource( 1 )]
music_track = ExtResource( 5 )
[node name="TileMap Collision" parent="." index="1"] [node name="TileMap Collision" parent="." index="1"]
tile_set = ExtResource( 2 ) tile_set = ExtResource( 2 )
@ -52,7 +50,7 @@ _destination_position_name = "EnterLeft"
[node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition" index="0"] [node name="CollisionShape2D" type="CollisionShape2D" parent="LevelTransition" index="0"]
modulate = Color( 1, 0, 1, 1 ) modulate = Color( 1, 0, 1, 1 )
position = Vector2( 325, 121 ) position = Vector2( 316, 121 )
shape = SubResource( 2 ) shape = SubResource( 2 )
[node name="Ladder" type="Area2D" parent="." index="6"] [node name="Ladder" type="Area2D" parent="." index="6"]
@ -74,6 +72,3 @@ color = Color( 0.45098, 0.192157, 0.192157, 1 )
__meta__ = { __meta__ = {
"_edit_lock_": true "_edit_lock_": true
} }
[node name="EnterRight" type="Position2D" parent="." index="7"]
position = Vector2( 325, 127 )