This commit is contained in:
Diego 2020-07-22 17:31:31 -05:00
parent c6ece4fc2a
commit d4c2d49ff3
10 changed files with 299 additions and 19 deletions

View file

@ -5,7 +5,7 @@ resource_name = "Skeleton Hit"
length = 0.1
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Skeleton:modulate")
tracks/0/path = NodePath("../Skeleton Enemy/Skeleton:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false

BIN
art/Black.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

BIN
art/Black.psd Normal file

Binary file not shown.

7
levels/Area2D.gd Normal file
View file

@ -0,0 +1,7 @@
extends Area2D
#func _process(delta):
# if get_overlapping_bodies().size() != 0:
# if Input.is_action_pressed("up"):
# Player.current_scene = "res://levels/Level 1.tscn"
# get_tree().change_scene("res://levels/Level 1.tscn")

16
levels/Ladder.gd Normal file
View file

@ -0,0 +1,16 @@
extends Node
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View file

@ -49,7 +49,7 @@ hframes = 2
tile_set = ExtResource( 1 )
cell_size = Vector2( 16, 16 )
format = 1
tile_data = PoolIntArray( 65535, 0, 8, 0, 0, 10, 1, 0, 10, 2, 0, 10, 3, 0, 10, 4, 0, 10, 5, 0, 10, 6, 0, 10, 7, 0, 10, 8, 0, 10, 9, 0, 10, 10, 0, 10, 11, 0, 10, 12, 0, 10, 13, 0, 10, 14, 0, 10, 15, 0, 10, 16, 0, 10, 17, 0, 10, 18, 0, 10, 19, 0, 10, 20, 0, 10, 21, 0, 10, 22, 0, 10, 23, 0, 10, 24, 0, 10, 25, 0, 10, 26, 0, 10, 27, 0, 10, 28, 0, 10, 29, 0, 10, 30, 0, 10, 31, 0, 10, 32, 0, 10, 33, 0, 10, 34, 0, 10, 35, 0, 10, 36, 0, 10, 37, 0, 10, 38, 0, 10, 39, 0, 10, 40, 0, 10, 41, 0, 10, 42, 0, 10, 43, 0, 10, 44, 0, 10, 45, 0, 10, 46, 0, 10, 47, 0, 10, 48, 0, 10, 49, 0, 10, 50, 0, 10, 51, 0, 11, 131071, 0, 65544, 65536, 0, 131078, 65537, 0, 196617, 65538, 0, 196617, 65539, 0, 196617, 65540, 0, 196617, 65541, 0, 196617, 65542, 0, 196617, 65543, 0, 196617, 65544, 0, 196617, 65545, 0, 196617, 65546, 0, 196617, 65547, 0, 196617, 65548, 0, 196617, 65549, 0, 196617, 65550, 0, 196617, 65551, 0, 196617, 65552, 0, 196617, 65553, 0, 196617, 65554, 0, 196617, 65555, 0, 196617, 65556, 0, 196617, 65557, 0, 196617, 65558, 0, 196617, 65559, 0, 196617, 65560, 0, 196617, 65561, 0, 196617, 65562, 0, 196617, 65563, 0, 196617, 65564, 0, 196617, 65565, 0, 196617, 65566, 0, 196617, 65567, 0, 196617, 65568, 0, 196617, 65569, 0, 196617, 65570, 0, 196617, 65571, 0, 196617, 65572, 0, 196617, 65573, 0, 196617, 65574, 0, 196617, 65575, 0, 196617, 65576, 0, 196617, 65577, 0, 196617, 65578, 0, 196617, 65579, 0, 196617, 65580, 0, 196617, 65581, 0, 196617, 65582, 0, 196617, 65583, 0, 196617, 65584, 0, 196617, 65585, 0, 196617, 65586, 0, 131077, 65587, 0, 131083, 196607, 0, 65544, 131072, 0, 131083, 131122, 0, 65544, 131123, 0, 131083, 262143, 0, 65544, 196608, 0, 131083, 196658, 0, 65544, 196659, 0, 131083, 327679, 0, 65544, 262144, 0, 131083, 262194, 0, 65544, 262195, 0, 131083, 393215, 0, 65544, 327680, 0, 131083, 327730, 0, 65544, 327731, 0, 131083, 458751, 0, 65544, 393216, 0, 131083, 393266, 0, 65544, 393267, 0, 131083, 524287, 0, 65544, 458752, 0, 131083, 458802, 0, 65544, 458803, 0, 131083, 589823, 0, 65544, 524288, 0, 131083, 524308, 0, 196608, 524338, 0, 65544, 524339, 0, 131083, 655359, 0, 65544, 589824, 0, 131083, 589874, 0, 65544, 589875, 0, 131083, 720895, 0, 65544, 655360, 0, 131083, 655374, 0, 0, 655386, 0, 0, 655410, 0, 65544, 655411, 0, 131083, 786431, 0, 65544, 720896, 0, 65542, 720897, 0, 10, 720898, 0, 10, 720899, 0, 10, 720900, 0, 10, 720901, 0, 10, 720902, 0, 10, 720903, 0, 10, 720904, 0, 10, 720905, 0, 10, 720906, 0, 10, 720907, 0, 10, 720908, 0, 10, 720909, 0, 10, 720910, 0, 9, 720911, 0, 10, 720912, 0, 10, 720913, 0, 10, 720914, 0, 10, 720915, 0, 10, 720916, 0, 10, 720917, 0, 10, 720918, 0, 10, 720919, 0, 10, 720920, 0, 10, 720921, 0, 10, 720922, 0, 9, 720923, 0, 10, 720924, 0, 10, 720925, 0, 10, 720926, 0, 10, 720927, 0, 10, 720928, 0, 10, 720929, 0, 10, 720930, 0, 10, 720931, 0, 10, 720932, 0, 10, 720933, 0, 11, 720941, 0, 8, 720942, 0, 10, 720943, 0, 10, 720944, 0, 10, 720945, 0, 10, 720946, 0, 65541, 720947, 0, 131083, 851967, 0, 196616, 786432, 0, 196617, 786433, 0, 196617, 786434, 0, 196617, 786435, 0, 196617, 786436, 0, 196617, 786437, 0, 196617, 786438, 0, 196617, 786439, 0, 196617, 786440, 0, 196617, 786441, 0, 196617, 786442, 0, 196617, 786443, 0, 196617, 786444, 0, 196617, 786445, 0, 196617, 786446, 0, 196617, 786447, 0, 196617, 786448, 0, 196617, 786449, 0, 196617, 786450, 0, 196617, 786451, 0, 196617, 786452, 0, 196617, 786453, 0, 196617, 786454, 0, 196617, 786455, 0, 196617, 786456, 0, 196617, 786457, 0, 196617, 786458, 0, 196617, 786459, 0, 196617, 786460, 0, 196617, 786461, 0, 196617, 786462, 0, 196617, 786463, 0, 196617, 786464, 0, 196617, 786465, 0, 196617, 786466, 0, 196617, 786467, 0, 196617, 786468, 0, 196617, 786469, 0, 196619, 786477, 0, 196616, 786478, 0, 196617, 786479, 0, 196617, 786480, 0, 196617, 786481, 0, 196617, 786482, 0, 196617, 786483, 0, 196619 )
tile_data = PoolIntArray( 65535, 0, 8, 0, 0, 10, 1, 0, 10, 2, 0, 10, 3, 0, 10, 4, 0, 10, 5, 0, 10, 6, 0, 10, 7, 0, 10, 8, 0, 10, 9, 0, 10, 10, 0, 10, 11, 0, 10, 12, 0, 10, 13, 0, 10, 14, 0, 10, 15, 0, 10, 16, 0, 10, 17, 0, 10, 18, 0, 10, 19, 0, 10, 20, 0, 10, 21, 0, 10, 22, 0, 10, 23, 0, 10, 24, 0, 10, 25, 0, 10, 26, 0, 10, 27, 0, 10, 28, 0, 10, 29, 0, 10, 30, 0, 10, 31, 0, 10, 32, 0, 10, 33, 0, 10, 34, 0, 10, 35, 0, 10, 36, 0, 10, 37, 0, 10, 38, 0, 10, 39, 0, 10, 40, 0, 10, 41, 0, 10, 42, 0, 10, 43, 0, 10, 44, 0, 10, 45, 0, 10, 46, 0, 10, 47, 0, 10, 48, 0, 10, 49, 0, 10, 50, 0, 10, 51, 0, 11, 131071, 0, 65544, 65536, 0, 131078, 65537, 0, 196617, 65538, 0, 196617, 65539, 0, 196617, 65540, 0, 196617, 65541, 0, 196617, 65542, 0, 196617, 65543, 0, 196617, 65544, 0, 196617, 65545, 0, 196617, 65546, 0, 196617, 65547, 0, 196617, 65548, 0, 196617, 65549, 0, 196617, 65550, 0, 196617, 65551, 0, 196617, 65552, 0, 196617, 65553, 0, 196617, 65554, 0, 196617, 65555, 0, 196617, 65556, 0, 196617, 65557, 0, 196617, 65558, 0, 196617, 65559, 0, 196617, 65560, 0, 196617, 65561, 0, 196617, 65562, 0, 196617, 65563, 0, 196617, 65564, 0, 196617, 65565, 0, 196617, 65566, 0, 196617, 65567, 0, 196617, 65568, 0, 196617, 65569, 0, 196617, 65570, 0, 196617, 65571, 0, 196617, 65572, 0, 196617, 65573, 0, 196617, 65574, 0, 196617, 65575, 0, 196617, 65576, 0, 196617, 65577, 0, 196617, 65578, 0, 196617, 65579, 0, 196617, 65580, 0, 196617, 65581, 0, 131077, 65582, 0, 131081, 65583, 0, 131081, 65584, 0, 131081, 65585, 0, 131081, 65586, 0, 131081, 65587, 0, 131083, 196607, 0, 65544, 131072, 0, 131083, 131117, 0, 65544, 131118, 0, 131081, 131119, 0, 131081, 131120, 0, 131081, 131121, 0, 131081, 131122, 0, 131081, 131123, 0, 131083, 262143, 0, 65544, 196608, 0, 131083, 196653, 0, 65544, 196654, 0, 131081, 196655, 0, 131081, 196656, 0, 131081, 196657, 0, 131081, 196658, 0, 131081, 196659, 0, 131083, 327679, 0, 65544, 262144, 0, 131083, 262189, 0, 65544, 262190, 0, 131081, 262191, 0, 131081, 262192, 0, 131081, 262193, 0, 131081, 262194, 0, 131081, 262195, 0, 131083, 393215, 0, 65544, 327680, 0, 131083, 327725, 0, 65544, 327726, 0, 131081, 327727, 0, 131081, 327728, 0, 131081, 327729, 0, 131081, 327730, 0, 131081, 327731, 0, 131083, 458751, 0, 65544, 393216, 0, 131083, 393261, 0, 65544, 393262, 0, 131081, 393263, 0, 131081, 393264, 0, 131081, 393265, 0, 131081, 393266, 0, 131081, 393267, 0, 131083, 524287, 0, 65544, 458752, 0, 131083, 458797, 0, 65544, 458798, 0, 131081, 458799, 0, 131081, 458800, 0, 131081, 458801, 0, 131081, 458802, 0, 131081, 458803, 0, 131083, 589823, 0, 65544, 524288, 0, 131083, 524308, 0, 196608, 524333, 0, 65544, 524334, 0, 131081, 524335, 0, 131081, 524336, 0, 131081, 524337, 0, 131081, 524338, 0, 131081, 524339, 0, 131083, 655359, 0, 65544, 589824, 0, 131083, 589869, 0, 65544, 589870, 0, 131081, 589871, 0, 131081, 589872, 0, 131081, 589873, 0, 131081, 589874, 0, 131081, 589875, 0, 131083, 720895, 0, 65544, 655360, 0, 131083, 655374, 0, 0, 655386, 0, 0, 655405, 0, 65544, 655406, 0, 131081, 655407, 0, 131081, 655408, 0, 131081, 655409, 0, 131081, 655410, 0, 131081, 655411, 0, 131083, 786431, 0, 65544, 720896, 0, 65542, 720897, 0, 10, 720898, 0, 10, 720899, 0, 10, 720900, 0, 10, 720901, 0, 10, 720902, 0, 10, 720903, 0, 10, 720904, 0, 10, 720905, 0, 10, 720906, 0, 10, 720907, 0, 10, 720908, 0, 10, 720909, 0, 10, 720910, 0, 9, 720911, 0, 10, 720912, 0, 10, 720913, 0, 10, 720914, 0, 10, 720915, 0, 10, 720916, 0, 10, 720917, 0, 10, 720918, 0, 10, 720919, 0, 10, 720920, 0, 10, 720921, 0, 10, 720922, 0, 9, 720923, 0, 10, 720924, 0, 10, 720925, 0, 10, 720926, 0, 10, 720927, 0, 10, 720928, 0, 10, 720929, 0, 10, 720930, 0, 10, 720931, 0, 10, 720932, 0, 10, 720933, 0, 11, 720941, 0, 65544, 720942, 0, 131081, 720943, 0, 131081, 720944, 0, 131081, 720945, 0, 131081, 720946, 0, 131081, 720947, 0, 131083, 851967, 0, 196616, 786432, 0, 196617, 786433, 0, 196617, 786434, 0, 196617, 786435, 0, 196617, 786436, 0, 196617, 786437, 0, 196617, 786438, 0, 196617, 786439, 0, 196617, 786440, 0, 196617, 786441, 0, 196617, 786442, 0, 196617, 786443, 0, 196617, 786444, 0, 196617, 786445, 0, 196617, 786446, 0, 196617, 786447, 0, 196617, 786448, 0, 196617, 786449, 0, 196617, 786450, 0, 196617, 786451, 0, 196617, 786452, 0, 196617, 786453, 0, 196617, 786454, 0, 196617, 786455, 0, 196617, 786456, 0, 196617, 786457, 0, 196617, 786458, 0, 196617, 786459, 0, 196617, 786460, 0, 196617, 786461, 0, 196617, 786462, 0, 196617, 786463, 0, 196617, 786464, 0, 196617, 786465, 0, 196617, 786466, 0, 196617, 786467, 0, 196617, 786468, 0, 196617, 786469, 0, 196619, 786477, 0, 196616, 786478, 0, 196617, 786479, 0, 196617, 786480, 0, 196617, 786481, 0, 196617, 786482, 0, 196617, 786483, 0, 196619 )
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
@ -92,9 +92,9 @@ centered = false
[node name="Label" type="Label" parent="CanvasLayer"]
margin_left = 35.0
margin_top = 90.0
margin_top = 78.0
margin_right = 204.0
margin_bottom = 106.0
margin_bottom = 94.0
rect_scale = Vector2( 1.5, 1.5 )
custom_fonts/font = SubResource( 3 )
text = "Leap of Faith"
@ -110,7 +110,7 @@ position = Vector2( 357, 167 )
wait_time = 4.386
one_shot = true
script = ExtResource( 13 )
[connection signal="body_entered" from="Leap" to="AnimationPlayer2" method="_on_Leap_body_entered"]
[connection signal="body_entered" from="Leap" to="AnimationPlayer" method="_on_Leap_body_entered"]
[connection signal="body_entered" from="Leap" to="Timer" method="_on_Leap_body_entered"]
[connection signal="body_entered" from="Leap" to="AnimationPlayer2" method="_on_Leap_body_entered"]
[connection signal="timeout" from="Timer" to="Timer" method="_on_Timer_timeout"]

View file

@ -2,3 +2,4 @@ extends Node
func _ready():
Player.current_scene = ("res://levels/Level 1a.tscn")
print(Player.current_scene)

File diff suppressed because one or more lines are too long

View file

@ -463,5 +463,5 @@ texture = ExtResource( 9 )
position = Vector2( 1581.08, 38.1216 )
scale = Vector2( 2.66787, 2.66787 )
texture = ExtResource( 12 )
[connection signal="body_entered" from="Area2D" to="Player" method="_on_Area2D_body_entered"]
[connection signal="body_entered" from="Area2D" to="text/Text2" method="_on_body_entered"]
[connection signal="body_entered" from="Area2D" to="Player" method="_on_Area2D_body_entered"]

117
script/player.gd Normal file
View file

@ -0,0 +1,117 @@
extends KinematicBody2D
signal grounded_updated(is_grounded)
signal health_updated(new_health)
signal energy_updated(new_energy)
var velocity = Vector2()
var input_direction: int = 0
var speed = 10 * 16
var gravity
var max_jump_velocity
var min_jump_velocity
var walljump_velocity
var max_jump_height = 2.75 * 16
var min_jump_height = 0.6 * 16
var walljump_height = 2.25 * 16
var jump_duration = 0.35
var is_grounded
var touching_wall = 0
onready var Spr: Sprite = $Sprite
onready var Occluder: LightOccluder2D = $Sprite/LightOccluder2D
onready var Anim: AnimationPlayer = $AnimationPlayer
onready var CoyoteTimer: Timer = $CoyoteTimer
onready var ShootDelay: Timer = $ShootDelay
onready var StateMachine: Node = $PlayerStateMachine
onready var WandPosition: Node2D = $WandPosition
onready var ProjectileSpawn: Node2D = $HoldPosition/ProjectileSpawn
onready var Inventory: CanvasLayer = $Inventory
onready var Stats = $Stats
onready var HitSound: AudioStreamPlayer2D = $"Enemy Hit"
onready var health = Stats.health setget set_health, get_health
onready var energy = Stats.energy setget set_energy, get_energy
func play_hitsound():
HitSound.play(0.0)
$HitAnimation.play("Hit")
func get_current_conduit():
return Inventory.active_conduit
func get_current_projectile():
return Inventory.active_projectile
func get_type():
return "player"
func set_health(value):
Stats.set_health(value)
emit_signal("health_updated", value)
func get_health():
return Stats.get_health()
func set_energy(value):
Stats.set_energy(value)
emit_signal("energy_updated", value)
func get_energy():
return Stats.get_energy()
func _ready():
gravity = 2 * max_jump_height / pow(jump_duration, 2)
max_jump_velocity = -sqrt(2 * gravity * max_jump_height)
min_jump_velocity = -sqrt(2 * gravity * min_jump_height)
walljump_velocity = -sqrt(2 * gravity * walljump_height)
func _physics_process(delta):
Player.position = global_position - Vector2(0, 10)
emit_signal("grounded_updated", is_on_floor())
if get_health() <= 0:
get_tree().change_scene("res://Title/Death Screen'.tscn")
func handle_move_input():
input_direction = int(Input.is_action_pressed("right")) - int(Input.is_action_pressed("left"))
velocity.x = lerp(velocity.x, speed * input_direction, get_movement_weight())
WandPosition.look_at(get_global_mouse_position())
if input_direction > 0:
Spr.flip_h = false
Occluder.scale.x = 1
if input_direction < 0:
Spr.flip_h = true
Occluder.scale.x = -1
func jump():
velocity.y = max_jump_velocity
CoyoteTimer.stop()
func apply_gravity(delta, modifier = 1):
velocity.y += gravity * delta * modifier
func apply_movement():
if velocity.x > -1 and velocity.x < 1:
velocity.x = 0
var was_on_floor = is_on_floor()
velocity = move_and_slide(velocity, Vector2.UP)
if !is_on_floor() and was_on_floor and velocity.y >= 0:
CoyoteTimer.start()
if !was_on_floor and is_on_floor():
emit_signal("grounded_updated", is_on_floor())
var was_grounded = is_grounded
is_grounded = is_on_floor()
func get_movement_weight():
if is_on_floor():
return 0.2
else:
return 0.07
func _on_Area2D_body_entered(body):
velocity.y = -150