Compare commits

...

4 Commits

Author SHA1 Message Date
Ervan Lefevre cc186e382f 💅: Better visual of level 2 years ago
Ervan Lefevre 6e99fdf5e6 Adds a "tutorial" 2 years ago
Ervan Lefevre 838fd204a5 🍻 Animated the wings 2 years ago
Ervan Lefevre 6d50f50403 🎉 FFS I DID IT, IT IS ANIMATED 2 years ago
  1. BIN
      assets/tilesets/cave_tileset.png
  2. BIN
      nodes/npc/npc.png
  3. 6
      nodes/npc_factory/npc_factory.tscn
  4. BIN
      nodes/npc_factory/visual.png
  5. 34
      nodes/npc_factory/visual.png.import
  6. BIN
      nodes/obstacle/rock.png
  7. BIN
      nodes/player/leg.png
  8. 34
      nodes/player/leg.png.import
  9. 74
      nodes/player/player.gd
  10. 1949
      nodes/player/player.tscn
  11. BIN
      nodes/player/temp.png
  12. BIN
      nodes/player/wing.png
  13. 34
      nodes/player/wing.png.import
  14. 56
      nodes/ui/ui.tscn
  15. 1
      scenes/lose_screen.tscn
  16. 156
      scenes/poc.tscn
  17. 1
      scenes/win_screen.tscn
  18. 2
      scripts/gameplay/rising_level.gd
  19. 3
      scripts/ia/fsm.gd

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://b2hu7kxvxvgc1"]
[gd_scene load_steps=5 format=3 uid="uid://b2hu7kxvxvgc1"]
[ext_resource type="Script" path="res://nodes/npc_factory/npc_factory.gd" id="1_p5cuf"]
[ext_resource type="PackedScene" uid="uid://dvx48q5ecyxjs" path="res://nodes/npc/npc.tscn" id="2_exj6u"]
[ext_resource type="Texture2D" uid="uid://1k2r1cdf2a4m" path="res://nodes/npc_factory/visual.png" id="3_ryp62"]
[sub_resource type="CircleShape2D" id="CircleShape2D_nl4mj"]
@ -15,3 +16,6 @@ monitoring = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="factory_death"]
shape = SubResource("CircleShape2D_nl4mj")
[node name="sprite" type="Sprite2D" parent="factory_death"]
texture = ExtResource("3_ryp62")

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://1k2r1cdf2a4m"
path="res://.godot/imported/visual.png-c50380986acdd97d6d89325bad04a64f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://nodes/npc_factory/visual.png"
dest_files=["res://.godot/imported/visual.png-c50380986acdd97d6d89325bad04a64f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bmwr4rg64i653"
path="res://.godot/imported/leg.png-a9d362e34cfbec5efab131933df0b7af.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://nodes/player/leg.png"
dest_files=["res://.godot/imported/leg.png-a9d362e34cfbec5efab131933df0b7af.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

@ -6,6 +6,11 @@ class_name Player
@onready var sound_player = $sound_player
@onready var gliding_player = $gliding_player
@onready var animator = $animator
@onready var wings_animator = $wings_animator
@onready var body = $oriented_container/body
@onready var grab_ray = get_node('oriented_container/body/grab_ray')
@onready var sprite = get_node('oriented_container/body')
const SPEED = 100.0
const JUMP_VELOCITY = 200.0
@ -38,7 +43,7 @@ var can_grab_obstacles = {
"climb": true,
"die": false,
"idle": true,
"jump": false,
"jump": true,
"spawn": false,
"walk": true,
"swim": true
@ -48,13 +53,10 @@ const SOUNDS = {
"death": {"asset": preload("res://assets/sounds/player_death.wav"), "volume": 0.5},
"jump": {"asset": preload("res://assets/sounds/jump.wav"), "volume": 0.5},
"grab": {"asset": preload("res://assets/sounds/grab.wav"), "volume": 0.5},
"gliding": {"asset": preload("res://assets/sounds/gliding.wav"), "volume": -40},
"gliding": {"asset": preload("res://assets/sounds/gliding.wav"), "volume": -20},
}
@onready var grab_ray = get_node('oriented_container/grab_ray')
@onready var sprite = get_node('oriented_container/sprite')
# Get the gravity from the project settings to be synced with RigidBody nodes.
var WORLD_GRAVITY = ProjectSettings.get_setting("physics/2d/default_gravity")
var gravity = WORLD_GRAVITY
@ -62,6 +64,7 @@ var gravity = WORLD_GRAVITY
var grabbed_obstacle = null
func _ready():
wings_animator.speed_scale = 0
$fsm.set_states(STATES)
add_to_group("player")
g_game_state.restore_checkpoint.connect(on_restore_checkpoint)
@ -172,8 +175,10 @@ func after_state(delta):
func handle_glide():
if Input.is_action_just_pressed('player_jump'):
gliding_player.play_sound(SOUNDS["gliding"])
wings_animator.speed_scale = 1
if Input.is_action_just_released('player_jump'):
gliding_player.stop_sound()
wings_animator.speed_scale = 0
func handle_gravity(delta):
var gravity_delta = gravity
@ -214,30 +219,62 @@ func drop_obstacle():
grabbed_obstacle = null
func handle_sprite_orientation():
if is_on_wall_only():
if velocity.y != 0:
$oriented_container.rotation = PI/2 if (velocity.y > 0) else - PI / 2
var wall_position = get_slide_collision(0).get_position().x
var player_position = $oriented_container.get_global_position().x
var should_flip_with_wall_left = (wall_position > player_position) && (velocity.y > 0)
var should_flip_with_wall_right = (wall_position < player_position) && (velocity.y < 0)
sprite.flip_v = should_flip_with_wall_left || should_flip_with_wall_right
sprite.flip_h = false
var is_wall_right = wall_position > player_position
if is_wall_right && velocity.y > 0:
body.look_down_on_right_wall()
wings_animator.play('wing_left')
put_grabbed_object_at(Vector2(0, 35))
if is_wall_right && velocity.y < 0:
body.look_up_on_right_wall()
wings_animator.play('wing_right')
put_grabbed_object_at(Vector2(0, -35))
if !is_wall_right && velocity.y > 0:
body.look_down_on_left_wall()
wings_animator.play('wing_right')
put_grabbed_object_at(Vector2(0, 35))
if !is_wall_right && velocity.y < 0:
body.look_up_on_left_wall()
wings_animator.play('wing_left')
put_grabbed_object_at(Vector2(0, -35))
elif is_on_ceiling_only():
if velocity.x != 0:
$oriented_container.rotation = 0.0 if (velocity.x > 0) else PI
sprite.flip_v = velocity.x > 0
sprite.flip_h = false
if velocity.x > 0:
body.look_right_on_ceiling()
wings_animator.play('wing_left')
put_grabbed_object_at(Vector2(35, 0))
else:
body.look_left_on_ceiling()
wings_animator.play('wing_right')
put_grabbed_object_at(Vector2(-35, 0))
else:
if velocity.x != 0:
$oriented_container.rotation = 0.0 if (velocity.x > 0) else PI
sprite.flip_v = velocity.x < 0
sprite.flip_h = false
if velocity.x > 0:
body.look_right()
wings_animator.play('wing_right')
put_grabbed_object_at(Vector2(35, 0))
else:
body.look_left()
wings_animator.play('wing_left')
put_grabbed_object_at(Vector2(-35, 0))
func put_grabbed_object_at(at):
if grabbed_obstacle:
grabbed_obstacle.position = at
func on_enter_swim_state():
sprite.modulate = Color(0, 0, 1)
sprite.modulate = Color(0, 0, 1) # TODO : light effect
gravity = WORLD_GRAVITY / 2
func swim_state(_delta):
@ -292,3 +329,6 @@ func on_restore_checkpoint(_level_rising):
func on_gliding_sound_finished():
if Input.is_action_pressed('player_jump'):
gliding_player.play_sound(SOUNDS["gliding"])
func on_state_changed(_previous, current):
animator.play(current)

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dpc4onvoal7n0"
path="res://.godot/imported/wing.png-61403f787b78c253753186936febfbb2.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://nodes/player/wing.png"
dest_files=["res://.godot/imported/wing.png-61403f787b78c253753186936febfbb2.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

@ -2,34 +2,6 @@
[ext_resource type="Script" path="res://nodes/ui/ui.gd" id="1_1svns"]
[sub_resource type="Animation" id="Animation_6cer2"]
resource_name = "splash"
length = 6.0
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("panel:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 2, 4, 6),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("panel:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 6),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [true, false]
}
[sub_resource type="Animation" id="Animation_4v8h2"]
length = 0.001
tracks/0/type = "value"
@ -72,6 +44,34 @@ tracks/0/keys = {
"values": [false]
}
[sub_resource type="Animation" id="Animation_6cer2"]
resource_name = "splash"
length = 6.0
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("panel:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 2, 4, 6),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("panel:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 6),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [true, false]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_iii80"]
_data = {
"RESET": SubResource("Animation_4v8h2"),

@ -46,6 +46,7 @@ script = ExtResource("2_vu7kg")
GAME_SCENE = "res://scenes/poc.tscn"
[node name="quit" type="Button" parent="Panel"]
layout_mode = 0
offset_left = 629.0
offset_top = 875.0
offset_right = 1284.0

File diff suppressed because one or more lines are too long

@ -35,6 +35,7 @@ script = ExtResource("1_ajo3i")
TARGET_SCENE = "res://scenes/main_menu.tscn"
[node name="quit" type="Button" parent="Panel"]
layout_mode = 0
offset_left = 629.0
offset_top = 875.0
offset_right = 1284.0

@ -22,7 +22,7 @@ func _exit_tree():
g_game_state.restore_checkpoint.disconnect(on_restore_checkpoint)
func _physics_process(delta):
if $sound.is_playing() == false:
if $audio.is_playing() == false:
$audio.play()
$shape.position.y -= RISING_SPEED * delta

@ -48,6 +48,9 @@ func _transition():
if on_exit_state_method in root:
root.call(on_exit_state_method)
if "on_state_changed" in root:
root.call("on_state_changed", previous_state, current_state)
state_duration = 0
var on_enter_state_method = "on_enter_" + current_state + "_state"
if on_enter_state_method in root:

Loading…
Cancel
Save