A bit more polish on lighing + started a level

This commit is contained in:
Sagi Dayan 2020-10-31 23:16:29 -04:00
parent 1c62db1cf8
commit 4b9d3a0b1b
23 changed files with 347 additions and 39 deletions

Binary file not shown.

View file

@ -0,0 +1,21 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/player_dash.wav-56d848081a164fd1f2e81cf57f5e9e3f.sample"
[deps]
source_file="res://assets/Audio/SFX/player_dash.wav"
dest_files=[ "res://.import/player_dash.wav-56d848081a164fd1f2e81cf57f5e9e3f.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=false
compress/mode=0

Binary file not shown.

View file

@ -0,0 +1,21 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/player_die.wav-35c83faf78fabff2e0aa3ad9f1c3bb9f.sample"
[deps]
source_file="res://assets/Audio/SFX/player_die.wav"
dest_files=[ "res://.import/player_die.wav-35c83faf78fabff2e0aa3ad9f1c3bb9f.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=false
compress/mode=0

Binary file not shown.

View file

@ -0,0 +1,21 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/player_land.wav-b4b70c8952e1eedcd08e873119d693c9.sample"
[deps]
source_file="res://assets/Audio/SFX/player_land.wav"
dest_files=[ "res://.import/player_land.wav-b4b70c8952e1eedcd08e873119d693c9.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=false
compress/mode=0

BIN
assets/HUD/orb_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/orb_icon.png-26ab81248f02e5c30a867c990e14c085.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/HUD/orb_icon.png"
dest_files=[ "res://.import/orb_icon.png-26ab81248f02e5c30a867c990e14c085.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
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -51,7 +51,8 @@
1/z_index = 0
[node name="SemiSolidsTileMap" type="TileMap"]
light_mask = 1024
tile_set = SubResource( 1 )
cell_size = Vector2( 16, 16 )
occluder_light_mask = 8
occluder_light_mask = 0
format = 1

View file

@ -506,9 +506,18 @@ tracks/6/keys = {
}
[node name="Goblin" type="KinematicBody2D"]
light_mask = 2
collision_layer = 2147483650
collision_mask = 15
script = ExtResource( 2 )
num_of_hits = 3
walking_speed = 20.0
attack_cool_down = 0.1
patroler = true
idle_interval = 0.5
idle_time = 0.2
dont_fall_patrol = true
gravity = 500.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
visible = false

View file

@ -23,7 +23,6 @@ signal jumping
signal died
var _velocity: Vector2 = Vector2.ZERO
var _landing_position:Vector2 = Vector2.ZERO
var _is_wall_jumping := false
var _alive := true
var _can_dash := true
@ -134,7 +133,9 @@ func _on_landed():
dust.position = position
get_parent().add_child(dust)
var fall_distance = position.y - _falling_start_position
if fall_distance > 150: $Camera.start_shake()
if fall_distance > 150:
AudioManager.play_sfx(AudioManager.Sfx.PLAYER_LAND)
$Camera.start_shake()
_falling_start_position = position.y
emit_signal("landed", position)
@ -159,6 +160,7 @@ func _get_direction() -> void:
)
func _check_dash():
if Input.is_action_just_pressed("dash") and _can_dash and abilities.dash:
AudioManager.play_sfx(AudioManager.Sfx.PLAYER_DASH)
var dash_velocity := Vector2($Sprite.scale.x * dash_thrust,0)
$Camera.start_shake(.1, 15, 2)
_can_dash = false
@ -187,18 +189,21 @@ func calculate_move_velocity(direction:Vector2, is_jump_canceled:bool, delta:fl
if direction.y == -1.0: # we are jumping
var wall_jump := false
if _state == States.WALL_SLIDING and abilities.wall_jump:
# wall jump
wall_jump = true
var walljump__x_direction = -1 * direction.x
var desired = (run_speed * wall_jump_speed_factor.x * walljump__x_direction)
output.x = desired
output.y = jump_power * wall_jump_speed_factor.y * direction.y
if _state == States.WALL_SLIDING:
if abilities.wall_jump:
# wall jump
wall_jump = true
var walljump__x_direction = -1 * direction.x
var desired = (run_speed * wall_jump_speed_factor.x * walljump__x_direction)
output.x = desired
output.y = jump_power * wall_jump_speed_factor.y * direction.y
_update_state(States.IN_AIR)
_on_jump(wall_jump)
else:
#jump
output.y = jump_power * direction.y
_update_state(States.IN_AIR)
_on_jump(wall_jump)
_update_state(States.IN_AIR)
_on_jump(wall_jump)
else:
if is_jump_canceled:
output.y = 0
@ -269,11 +274,13 @@ func _on_die_animation_done():
_revive()
func die():
emit_signal("died")
_alive = false
$AnimationPlayer.play("die")
$Camera.start_shake()
GameState.player_died()
if _alive:
AudioManager.play_sfx(AudioManager.Sfx.PLAYER_DIE)
emit_signal("died")
_alive = false
$AnimationPlayer.play("die")
$Camera.start_shake()
GameState.player_died()
func set_ability(ability:String, enabled:bool=false):
if ability == 'dash':

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=2]
[gd_scene load_steps=19 format=2]
[ext_resource path="res://src/Actors/DashParticles_right.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/Actors/Player.gd" type="Script" id=2]
@ -410,6 +410,70 @@ tracks/4/keys = {
"values": [ true ]
}
[sub_resource type="Animation" id=12]
resource_name = "land"
length = 0.1
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 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 73 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:vframes")
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": [ 13 ]
}
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 ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite:position")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 0, -8 ) ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite/SordRange/CollisionShape2D:disabled")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
[sub_resource type="Animation" id=9]
length = 0.1
tracks/0/type = "value"
@ -619,7 +683,7 @@ texture = ExtResource( 7 )
texture_scale = 3.07
color = Color( 0.87451, 0.976471, 0.984314, 1 )
range_height = -2048.0
range_item_cull_mask = 15
range_item_cull_mask = 7
shadow_enabled = true
shadow_item_cull_mask = 15
@ -629,7 +693,7 @@ position = Vector2( 0, -8 )
texture = ExtResource( 8 )
vframes = 13
hframes = 8
frame = 33
frame = 73
[node name="SordRange" type="Area2D" parent="Sprite"]
position = Vector2( -8, 8 )
@ -651,6 +715,7 @@ anims/die = SubResource( 5 )
anims/fall = SubResource( 6 )
anims/idle = SubResource( 7 )
anims/jump = SubResource( 8 )
anims/land = SubResource( 12 )
anims/pre_jump = SubResource( 9 )
anims/run = SubResource( 10 )
anims/wall_slide = SubResource( 11 )

View file

@ -4,9 +4,10 @@ extends Node2D
var LIGHTS = {
"DAY": Color(1, 1, 1, 1),
"NIGHT": Color(0.678431, 0.576471, 0.576471),
"AREA1": Color(0.639216, 0.666667, 0.635294)
}
var _current_light = 'DAY'
export var _current_light = 'DAY'
func change_light(light: String) -> void:
if _current_light != light:

View file

@ -8,7 +8,7 @@ var _level_resources := {
"hub" : load("res://src/GameWorld/Levels/WorldHub.tscn"),
"zones": {
1: [
load("res://src/GameWorld/Levels/Area1/Area11.tscn")
],
2: [
@ -21,7 +21,7 @@ var _level_resources := {
var _levels = [
[_level_resources.pre_game, _level_resources.hub],
[load("res://src/GameWorld/Levels/FirstLevels/TMP.tscn")],
[_level_resources.zones[1][0]],
[load("res://src/GameWorld/Levels/FirstLevels/TMP2.tscn")]
]

View file

@ -0,0 +1,4 @@
extends Level
func ready() -> void:
$AmbiantLighting.change_light("AREA1")

File diff suppressed because one or more lines are too long

View file

@ -2,6 +2,7 @@ extends Level
func _ready() -> void:
_player.set_ability("dash", true)
print("TMP ready")

View file

@ -2,9 +2,12 @@ extends Level
func _ready() -> void:
$AmbiantLighting.change_light("NIGHT")
_player.set_ability("dash", false)
_player.set_ability("wall_jump", true)
pass
func _enter_tree() -> void:
AudioManager.play_music(AudioManager.Music.PreGame)
$AmbiantLighting.change_light("NIGHT")

View file

@ -22,6 +22,9 @@ func _physics_process(delta: float) -> void:
"coins":
$UI/CoinLabel.text = str(fresh_data.coins)
_play_update_label_animation($UI/CoinLabel/AnimationPlayer)
"orbs":
$UI/OrbsLable.text = str(fresh_data.coins)
_play_update_label_animation($UI/OrbsLable/AnimationPlayer)
"deaths":
$UI/DeathsLabel.text = str(fresh_data.deaths)
_play_update_label_animation($UI/DeathsLabel/AnimationPlayer)

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=11 format=2]
[ext_resource path="res://src/HUD/HUD.gd" type="Script" id=1]
[ext_resource path="res://src/Menu/PauseMenu.tscn" type="PackedScene" id=2]
@ -6,6 +6,7 @@
[ext_resource path="res://assets/HUD/coins_hud.png" type="Texture" id=4]
[ext_resource path="res://assets/HUD/lifes_icon.png" type="Texture" id=5]
[ext_resource path="res://assets/HUD/time_hud.png" type="Texture" id=6]
[ext_resource path="res://assets/HUD/orb_icon.png" type="Texture" id=7]
[sub_resource type="Animation" id=1]
resource_name = "updated"
@ -39,6 +40,22 @@ tracks/0/keys = {
"values": [ Vector2( 2, 2 ), Vector2( 1, 1 ) ]
}
[sub_resource type="Animation" id=3]
resource_name = "updated"
length = 0.2
tracks/0/type = "value"
tracks/0/path = NodePath(".:rect_scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.2 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector2( 2, 2 ), Vector2( 1, 1 ) ]
}
[node name="HUD" type="CanvasLayer"]
script = ExtResource( 1 )
PauseMenu = ExtResource( 2 )
@ -76,8 +93,8 @@ __meta__ = {
anims/updated = SubResource( 1 )
[node name="Deaths" type="TextureRect" parent="UI"]
margin_left = 80.0
margin_top = 4.0
margin_left = 83.0
margin_top = 7.0
margin_right = 102.0
margin_bottom = 26.0
texture = ExtResource( 5 )
@ -97,10 +114,35 @@ __meta__ = {
[node name="AnimationPlayer" type="AnimationPlayer" parent="UI/DeathsLabel"]
anims/updated = SubResource( 2 )
[node name="Time" type="TextureRect" parent="UI"]
margin_left = 152.0
[node name="Orbs" type="TextureRect" parent="UI"]
margin_left = 150.0
margin_top = 8.0
margin_right = 167.0
margin_right = 164.0
margin_bottom = 22.0
texture = ExtResource( 7 )
expand = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="OrbsLable" type="Label" parent="UI"]
margin_left = 171.0
margin_top = 13.0
margin_right = 211.0
margin_bottom = 27.0
theme = ExtResource( 3 )
text = "0"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="AnimationPlayer" type="AnimationPlayer" parent="UI/OrbsLable"]
anims/updated = SubResource( 3 )
[node name="Time" type="TextureRect" parent="UI"]
margin_left = 412.0
margin_top = 8.0
margin_right = 427.0
margin_bottom = 23.0
texture = ExtResource( 6 )
expand = true
@ -109,9 +151,9 @@ __meta__ = {
}
[node name="TimeLabel" type="Label" parent="UI"]
margin_left = 174.0
margin_left = 434.0
margin_top = 13.0
margin_right = 214.0
margin_right = 474.0
margin_bottom = 27.0
theme = ExtResource( 3 )
text = "0"

View file

@ -225,6 +225,7 @@ frame = 2
texture = ExtResource( 4 )
texture_scale = 1.5
color = Color( 1, 0.976471, 0.878431, 1 )
range_item_cull_mask = 1025
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
visible = false

View file

@ -79,9 +79,10 @@ tracks/0/keys = {
[node name="Torch" type="Node2D"]
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
light_mask = 8
position = Vector2( 0, -12 )
frames = SubResource( 13 )
frame = 10
frame = 5
playing = true
[node name="Light2D" type="Light2D" parent="AnimatedSprite"]
@ -89,9 +90,9 @@ position = Vector2( 0, -5 )
texture = ExtResource( 2 )
texture_scale = 5.285
color = Color( 0.945098, 0.419608, 0.160784, 1 )
range_item_cull_mask = 9
range_item_cull_mask = 1033
shadow_enabled = true
shadow_item_cull_mask = 9
shadow_item_cull_mask = 1038
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "halo"

View file

@ -35,10 +35,10 @@ enum Sfx{
var _sfx_files := {
Sfx.COIN_COLLECTION : load("res://assets/Audio/SFX/coin.wav"),
Sfx.PLAYER_JUMP : load("res://assets/Audio/SFX/player_jump.wav"),
Sfx.PLAYER_LAND : '',
Sfx.PLAYER_DASH : '',
Sfx.PLAYER_LAND : load("res://assets/Audio/SFX/player_land.wav"),
Sfx.PLAYER_DASH : load("res://assets/Audio/SFX/player_dash.wav"),
Sfx.PLAYER_ATTACK : load("res://assets/Audio/SFX/player_attack.wav"),
Sfx.PLAYER_DIE : '',
Sfx.PLAYER_DIE : load("res://assets/Audio/SFX/player_die.wav"),
Sfx.UI_MOVE : load("res://assets/Audio/UI_Sounds/menu_move_sound.wav"),
Sfx.UI_SELECT : '',
}