added bow
|
@ -0,0 +1,3 @@
|
|||
source_md5="594555e2c22caa9c1b92e03613253660"
|
||||
dest_md5="e35df6dc7b881ee34e3fe4ae7fd3ee6e"
|
||||
|
BIN
.import/16color_uv_map.png-df63502cb1f1e075959c28e0cfc8f23e.stex
Normal file
|
@ -0,0 +1,3 @@
|
|||
source_md5="cefcc262207f6a82b9fe087e6c00c834"
|
||||
dest_md5="9602c94358d82f97c04cdccd20c0fcbc"
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
source_md5="445ece771f313ea59f896c5971a9de9e"
|
||||
dest_md5="a6e4165a03954c5d6c14282809b1cfdc"
|
||||
|
BIN
.import/a_egg_shoot.ogg-a189d93f991049e0cd06f6e0d7340395.oggstr
Normal file
3
.import/arrow.png-11415057882cccf873402d42cfed3df7.md5
Normal file
|
@ -0,0 +1,3 @@
|
|||
source_md5="589e927fe81ba35082a1f5602752fc65"
|
||||
dest_md5="9ae7ca9045ade117b152945398b6fc11"
|
||||
|
BIN
.import/arrow.png-11415057882cccf873402d42cfed3df7.stex
Normal file
|
@ -1,3 +1,3 @@
|
|||
source_md5="bd1294629647d4f3a0412ccc11a46d11"
|
||||
dest_md5="3bebf6f205f157016a22665138dafc75"
|
||||
source_md5="c8db8b1c88764e5a7f5a5a1f7fb47a41"
|
||||
dest_md5="7620ce6045a282839caeaf946382dd77"
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
source_md5="bae264ef795216ac097995eb4a8318a0"
|
||||
dest_md5="510dc415ac2b127f72435cbd356bb19b"
|
||||
source_md5="8fc881edcb39ccf0758b9ec711989795"
|
||||
dest_md5="7f140056d488b97e7bef07fd1560499a"
|
||||
|
||||
|
|
3
.import/sg_bow.png-92bf7dc68fff558d09a1bb7dc4c97add.md5
Normal file
|
@ -0,0 +1,3 @@
|
|||
source_md5="dd4f9fb6fe826116c3ac7053da03e403"
|
||||
dest_md5="999dd5d6e313f8c56f7645b191174805"
|
||||
|
BIN
.import/sg_bow.png-92bf7dc68fff558d09a1bb7dc4c97add.stex
Normal file
|
@ -0,0 +1,3 @@
|
|||
source_md5="6f9f2cee0dbc9668f922adf18955131e"
|
||||
dest_md5="f653b2119d0873a52a2f9d176c577ebf"
|
||||
|
BIN
.import/sg_shoot.png-223ce6d7d994249f3cb61d6c2acca3e4.stex
Normal file
|
@ -0,0 +1,3 @@
|
|||
source_md5="eb9124d9635714f5f75ebde43a34d500"
|
||||
dest_md5="67786600ab9901e6eae9cb41dc4e3fe8"
|
||||
|
BIN
.import/sg_shoot_air.png-eaed2f177e6addedcd0fd98ca682e602.stex
Normal file
|
@ -0,0 +1,3 @@
|
|||
source_md5="77b59f61726f60517f6b47e28ec5a8d4"
|
||||
dest_md5="d8648a4deb976a1b8ede2630af6ba5ca"
|
||||
|
BIN
audio/sounds/a_egg_collect.ogg
Normal file
15
audio/sounds/a_egg_collect.ogg.import
Normal file
|
@ -0,0 +1,15 @@
|
|||
[remap]
|
||||
|
||||
importer="ogg_vorbis"
|
||||
type="AudioStreamOGGVorbis"
|
||||
path="res://.import/a_egg_collect.ogg-7a1c2c7d5367f0237f278d4b2cb750fc.oggstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://audio/sounds/a_egg_collect.ogg"
|
||||
dest_files=[ "res://.import/a_egg_collect.ogg-7a1c2c7d5367f0237f278d4b2cb750fc.oggstr" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
BIN
audio/sounds/a_egg_shoot.ogg
Normal file
15
audio/sounds/a_egg_shoot.ogg.import
Normal file
|
@ -0,0 +1,15 @@
|
|||
[remap]
|
||||
|
||||
importer="ogg_vorbis"
|
||||
type="AudioStreamOGGVorbis"
|
||||
path="res://.import/a_egg_shoot.ogg-a189d93f991049e0cd06f6e0d7340395.oggstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://audio/sounds/a_egg_shoot.ogg"
|
||||
dest_files=[ "res://.import/a_egg_shoot.ogg-a189d93f991049e0cd06f6e0d7340395.oggstr" ]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
3
game.gd
|
@ -8,6 +8,7 @@ onready var viewport_container = get_parent().get_node("Main/Control/ViewportCon
|
|||
var golds = 0
|
||||
var stars = [false,false,false,false,false]
|
||||
var shards = 0
|
||||
var arrows = 1
|
||||
var score = 0
|
||||
#Audio Channels
|
||||
onready var ac_jump = $JumpSound
|
||||
|
@ -15,6 +16,7 @@ onready var ac_collectible = $CollecitbleSound
|
|||
onready var ac_climb = $ClimbSound
|
||||
#Sounds
|
||||
onready var a_gold = preload("res://audio/sounds/snd_coin.ogg")
|
||||
onready var a_arrow = preload("res://audio/sounds/a_egg_collect.ogg")
|
||||
onready var a_jump = preload("res://audio/sounds/jump.ogg")
|
||||
onready var a_star = preload("res://audio/sounds/a_jinjo.ogg")
|
||||
onready var a_shard = preload("res://audio/sounds/tempjingle.wav")
|
||||
|
@ -22,6 +24,7 @@ onready var a_climb_up = preload("res://audio/sounds/a_climb.ogg")
|
|||
onready var a_climb_down = preload("res://audio/sounds/a_bmilc.ogg")
|
||||
onready var a_sword = preload("res://audio/sounds/sword.ogg")
|
||||
onready var a_doublejump = preload("res://audio/sounds/a_bree.wav")
|
||||
onready var a_shoot = preload("res://audio/sounds/a_egg_shoot.ogg")
|
||||
#Objects
|
||||
onready var block_text = preload("res://objects/hud/blocktext.tscn")
|
||||
|
||||
|
|
BIN
graphics/debug/16color_uv_map.png
Normal file
After Width: | Height: | Size: 142 B |
35
graphics/debug/16color_uv_map.png.import
Normal file
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/16color_uv_map.png-df63502cb1f1e075959c28e0cfc8f23e.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://graphics/debug/16color_uv_map.png"
|
||||
dest_files=[ "res://.import/16color_uv_map.png-df63502cb1f1e075959c28e0cfc8f23e.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=true
|
||||
svg/scale=1.0
|
Before Width: | Height: | Size: 387 B After Width: | Height: | Size: 420 B |
BIN
graphics/player/arrow.png
Normal file
After Width: | Height: | Size: 166 B |
35
graphics/player/arrow.png.import
Normal file
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/arrow.png-11415057882cccf873402d42cfed3df7.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://graphics/player/arrow.png"
|
||||
dest_files=[ "res://.import/arrow.png-11415057882cccf873402d42cfed3df7.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=true
|
||||
svg/scale=1.0
|
Before Width: | Height: | Size: 159 B After Width: | Height: | Size: 166 B |
BIN
graphics/player/sg_bow.png
Normal file
After Width: | Height: | Size: 436 B |
35
graphics/player/sg_bow.png.import
Normal file
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/sg_bow.png-92bf7dc68fff558d09a1bb7dc4c97add.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://graphics/player/sg_bow.png"
|
||||
dest_files=[ "res://.import/sg_bow.png-92bf7dc68fff558d09a1bb7dc4c97add.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=true
|
||||
svg/scale=1.0
|
BIN
graphics/player/sg_shoot.png
Normal file
After Width: | Height: | Size: 455 B |
35
graphics/player/sg_shoot.png.import
Normal file
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/sg_shoot.png-223ce6d7d994249f3cb61d6c2acca3e4.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://graphics/player/sg_shoot.png"
|
||||
dest_files=[ "res://.import/sg_shoot.png-223ce6d7d994249f3cb61d6c2acca3e4.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=true
|
||||
svg/scale=1.0
|
BIN
graphics/player/sg_shoot_air.png
Normal file
After Width: | Height: | Size: 306 B |
35
graphics/player/sg_shoot_air.png.import
Normal file
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/sg_shoot_air.png-eaed2f177e6addedcd0fd98ca682e602.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://graphics/player/sg_shoot_air.png"
|
||||
dest_files=[ "res://.import/sg_shoot_air.png-eaed2f177e6addedcd0fd98ca682e602.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=true
|
||||
svg/scale=1.0
|
BIN
graphics/player/sg_shoot_grounded.png
Normal file
After Width: | Height: | Size: 493 B |
35
graphics/player/sg_shoot_grounded.png.import
Normal file
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/sg_shoot_grounded.png-f5fd264dea518c0aedffd9ce0d2e3ddb.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://graphics/player/sg_shoot_grounded.png"
|
||||
dest_files=[ "res://.import/sg_shoot_grounded.png-f5fd264dea518c0aedffd9ce0d2e3ddb.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=true
|
||||
svg/scale=1.0
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=16 format=2]
|
||||
[gd_scene load_steps=17 format=2]
|
||||
|
||||
[ext_resource path="res://objects/player/player.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://objects/ladder/ladder.tscn" type="PackedScene" id=2]
|
||||
|
@ -14,6 +14,7 @@
|
|||
[ext_resource path="res://objects/collectibles/shard.tscn" type="PackedScene" id=12]
|
||||
[ext_resource path="res://objects/enemy/bat.tscn" type="PackedScene" id=13]
|
||||
[ext_resource path="res://objects/enemy/snake.tscn" type="PackedScene" id=14]
|
||||
[ext_resource path="res://objects/collectibles/arrow.tscn" type="PackedScene" id=15]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 8, 128 )
|
||||
|
@ -54,7 +55,7 @@ tile_data = PoolIntArray( 327707, 1, 0, 393243, 1, 0, 458779, 1, 0, 524315, 1, 0
|
|||
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
||||
position = Vector2( -8, 96 )
|
||||
position = Vector2( -8, 104 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="StaticBody2D"]
|
||||
|
@ -138,6 +139,9 @@ color = 1
|
|||
[node name="Gold21" parent="Collectibles" instance=ExtResource( 5 )]
|
||||
position = Vector2( 32, 96 )
|
||||
|
||||
[node name="Arrow" parent="Collectibles" instance=ExtResource( 15 )]
|
||||
position = Vector2( 192, 168 )
|
||||
|
||||
[node name="Enemies" type="Node2D" parent="."]
|
||||
|
||||
[node name="Slime" parent="Enemies" instance=ExtResource( 11 )]
|
||||
|
|
11
objects/collectibles/arrow.gd
Normal file
|
@ -0,0 +1,11 @@
|
|||
extends Node2D
|
||||
|
||||
export var value = 1
|
||||
|
||||
func _on_Area2D_area_entered(area):
|
||||
#Collect
|
||||
if area.is_in_group("player"):
|
||||
Game.arrows += value
|
||||
Game.score += 25
|
||||
Game.play_sound(Game.a_arrow,Game.ac_collectible)
|
||||
queue_free()
|
31
objects/collectibles/arrow.tscn
Normal file
|
@ -0,0 +1,31 @@
|
|||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/1px_border.gdshader" type="Shader" id=1]
|
||||
[ext_resource path="res://objects/collectibles/arrow.gd" type="Script" id=2]
|
||||
[ext_resource path="res://graphics/player/arrow.png" type="Texture" id=3]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=7]
|
||||
shader = ExtResource( 1 )
|
||||
shader_param/border_color = Color( 0, 0, 0, 1 )
|
||||
shader_param/border_corners = true
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=6]
|
||||
extents = Vector2( 4, 4 )
|
||||
|
||||
[node name="Arrow" type="Node2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
material = SubResource( 7 )
|
||||
position = Vector2( 2, 2 )
|
||||
rotation = -1.5708
|
||||
texture = ExtResource( 3 )
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
visible = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
position = Vector2( 4, 4 )
|
||||
shape = SubResource( 6 )
|
||||
|
||||
[connection signal="area_entered" from="Area2D" to="." method="_on_Area2D_area_entered"]
|
|
@ -1,6 +1,7 @@
|
|||
extends Node2D
|
||||
|
||||
export var can_be_killed_by_sword = true
|
||||
export var can_be_killed_by_arrow = true
|
||||
export var can_be_squashed = true
|
||||
export var score_for_killing = 0
|
||||
|
||||
|
@ -13,6 +14,16 @@ func _on_Area2D_area_entered(area):
|
|||
if can_be_killed_by_sword:
|
||||
die()
|
||||
else:
|
||||
#Block text
|
||||
Game.instance_node(Game.block_text,global_position.x,global_position.y,get_parent())
|
||||
#Die from arrow
|
||||
if area.is_in_group("arrow"):
|
||||
if can_be_killed_by_arrow:
|
||||
Game.arrows -= 1
|
||||
area.get_parent().queue_free()
|
||||
die()
|
||||
else:
|
||||
#Block text
|
||||
Game.instance_node(Game.block_text,global_position.x,global_position.y,get_parent())
|
||||
#Die from rock/ get squashed
|
||||
if area.is_in_group("squash"):
|
||||
|
|
|
@ -8,6 +8,7 @@ onready var green_star = $GreenStar
|
|||
onready var blue_star = $BlueStar
|
||||
onready var magenta_star = $MagentaStar
|
||||
onready var score_counter = $ScoreCounter
|
||||
onready var arrow_counter = $ArrowCounter
|
||||
|
||||
func _physics_process(delta):
|
||||
#Gold Counter
|
||||
|
@ -22,3 +23,5 @@ func _physics_process(delta):
|
|||
magenta_star.visible = Game.stars[4]
|
||||
#Score Counter
|
||||
score_counter.text = "%06d" % Game.score
|
||||
#Arrow Counter
|
||||
arrow_counter.text = "%02d" % Game.arrows
|
||||
|
|
|
@ -114,3 +114,11 @@ margin_right = 264.0
|
|||
margin_bottom = 21.0
|
||||
theme = ExtResource( 10 )
|
||||
text = "000000"
|
||||
|
||||
[node name="ArrowCounter" type="Label" parent="HUD"]
|
||||
margin_left = 237.0
|
||||
margin_top = 1.0
|
||||
margin_right = 321.0
|
||||
margin_bottom = 21.0
|
||||
theme = ExtResource( 10 )
|
||||
text = "00"
|
||||
|
|
13
objects/player/arrow_projectile.gd
Normal file
|
@ -0,0 +1,13 @@
|
|||
extends Node2D
|
||||
|
||||
func _ready():
|
||||
scale.x = get_parent().get_node("Player").sprite.scale.x
|
||||
|
||||
func _physics_process(delta):
|
||||
position.x += 4 * scale.x
|
||||
|
||||
|
||||
func _on_Area2D_body_entered(body):
|
||||
if body is TileMap or body is StaticBody2D:
|
||||
queue_free()
|
||||
|
35
objects/player/arrow_projectile.tscn
Normal file
|
@ -0,0 +1,35 @@
|
|||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://scripts/1px_border.gdshader" type="Shader" id=1]
|
||||
[ext_resource path="res://graphics/player/arrow.png" type="Texture" id=2]
|
||||
[ext_resource path="res://objects/player/arrow_projectile.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=1]
|
||||
shader = ExtResource( 1 )
|
||||
shader_param/border_color = Color( 0, 0, 0, 1 )
|
||||
shader_param/border_corners = true
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 5.5, 3.5 )
|
||||
|
||||
[node name="ArrowProjectile" type="Node2D"]
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
material = SubResource( 1 )
|
||||
z_index = -1
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="." groups=["arrow"]]
|
||||
visible = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
position = Vector2( -0.5, -0.5 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."]
|
||||
position = Vector2( -0.5, -0.5 )
|
||||
scale = Vector2( 0.55, 0.35 )
|
||||
|
||||
[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"]
|
||||
[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]
|
|
@ -7,8 +7,10 @@ onready var climb_ray = $ClimbRay
|
|||
onready var anims = $AnimationPlayer
|
||||
onready var sword_sprite = $SwordSprite
|
||||
onready var sword_hitbox = $SwordArea
|
||||
#Map
|
||||
onready var map = get_owner()
|
||||
##States
|
||||
enum State {IDLE,WALK,JUMP,FALL,STUNNED,CLIMB,SWORD}
|
||||
enum State {IDLE,WALK,JUMP,FALL,STUNNED,CLIMB,SWORD,SHOOT}
|
||||
var current_state = State.IDLE
|
||||
var axis = Vector2.ZERO
|
||||
##Physics
|
||||
|
@ -20,7 +22,9 @@ var jump_force = 150
|
|||
var current_ladder = null
|
||||
var can_doublejump = true
|
||||
var doublejump_force = 120
|
||||
|
||||
var arrowpos = Vector2(5,3)
|
||||
#Preload
|
||||
var pre_arrow = preload("res://objects/player/arrow_projectile.tscn")
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
|
@ -47,11 +51,14 @@ func _physics_process(delta):
|
|||
continue
|
||||
State.SWORD:
|
||||
_process_sword()
|
||||
continue
|
||||
State.SHOOT:
|
||||
_process_shoot()
|
||||
|
||||
#Gravity
|
||||
if current_state != State.CLIMB: velocity.y += gravity
|
||||
#Apply velocity
|
||||
move_and_slide(velocity,Vector2.UP)
|
||||
print(velocity.y)
|
||||
#Debug
|
||||
if Input.is_action_pressed("debug_move_player"):
|
||||
position = get_viewport().get_mouse_position()
|
||||
|
@ -89,6 +96,8 @@ func _process_idle_walk():
|
|||
Game.play_sound(Game.a_sword,Game.ac_jump)
|
||||
current_state = State.SWORD
|
||||
return
|
||||
#Goto Shoot
|
||||
check_shoot()
|
||||
|
||||
func _process_jump():
|
||||
jump_pressure += 1
|
||||
|
@ -99,6 +108,8 @@ func _process_jump():
|
|||
velocity.y = -jump_force / 4
|
||||
#velocity.y = 0
|
||||
current_state = State.FALL
|
||||
#Goto Shoot
|
||||
check_shoot()
|
||||
|
||||
func _process_fall():
|
||||
if anims.get_current_animation() != "doublejump": anims.play("jump")
|
||||
|
@ -109,8 +120,11 @@ func _process_fall():
|
|||
if is_on_floor():
|
||||
current_state = State.IDLE
|
||||
return
|
||||
#Goto Shoot
|
||||
check_shoot()
|
||||
|
||||
func _process_climb():
|
||||
can_doublejump = true
|
||||
#Graphics
|
||||
anims.play("climb")
|
||||
anims.set_speed_scale(abs(axis.y))
|
||||
|
@ -141,13 +155,25 @@ func _process_sword():
|
|||
sword_hitbox.position.x = sprite.scale.x * 10
|
||||
#Return to idle after animationplayer end anim signal
|
||||
|
||||
func _process_shoot():
|
||||
#Stop
|
||||
velocity.x = 0
|
||||
if anims.get_current_animation() == "shoot air":
|
||||
#Cancel air shoot animation when grounded
|
||||
if is_on_floor():
|
||||
current_state = State.IDLE
|
||||
return
|
||||
move(walk_speed,0,true)
|
||||
|
||||
func spawn_arrow():
|
||||
Game.play_sound(Game.a_shoot,Game.ac_jump)
|
||||
Game.instance_node(pre_arrow,global_position.x+(arrowpos.x*sprite.scale.x),global_position.y+arrowpos.y,map)
|
||||
|
||||
func check_jump():
|
||||
if Input.is_action_just_pressed("jump"):
|
||||
#Detach ladder
|
||||
if current_state == State.CLIMB:
|
||||
Game.ac_climb.set_stream(null)
|
||||
Game.ac_climb.set_stream(null) # stop climb sound
|
||||
position.x -= sprite.scale.x * 5
|
||||
anims.set_speed_scale(1)
|
||||
# Jump
|
||||
|
@ -166,6 +192,15 @@ func check_double_jump():
|
|||
velocity.y = -doublejump_force
|
||||
anims.play("doublejump")
|
||||
|
||||
func check_shoot():
|
||||
#Only Shoot if have arrows and there are no arrows onscreen
|
||||
if Input.is_action_just_pressed("shoot") && Game.arrows > 0 && get_tree().get_nodes_in_group("arrow").size() == 0:
|
||||
current_state = State.SHOOT
|
||||
if is_on_floor():
|
||||
anims.play("shoot grounded")
|
||||
else:
|
||||
anims.play("shoot air") #Shoot immediately in air
|
||||
|
||||
func move(hsp,vsp,flip:bool):
|
||||
velocity.x = hsp * axis.x
|
||||
#Flip
|
||||
|
@ -196,3 +231,15 @@ func _on_AnimationPlayer_animation_finished(anim_name):
|
|||
if anim_name == "stab":
|
||||
current_state = State.IDLE
|
||||
return
|
||||
#Return to idle after grounded shoot
|
||||
if anim_name == "shoot grounded":
|
||||
current_state = State.IDLE
|
||||
return
|
||||
#Return to fall or idle after air shoot
|
||||
if anim_name == "shoot air":
|
||||
if is_on_floor():
|
||||
current_state = State.IDLE
|
||||
return
|
||||
else:
|
||||
current_state = State.FALL
|
||||
return
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=45 format=2]
|
||||
[gd_scene load_steps=27 format=2]
|
||||
|
||||
[ext_resource path="res://objects/player/player.gd" type="Script" id=1]
|
||||
[ext_resource path="res://graphics/player/sg_walk.png" type="Texture" id=2]
|
||||
|
@ -9,132 +9,12 @@
|
|||
[ext_resource path="res://graphics/player/sg_climb.png" type="Texture" id=7]
|
||||
[ext_resource path="res://graphics/player/pal_sword_red.png" type="Texture" id=8]
|
||||
[ext_resource path="res://graphics/player/sg_stab.png" type="Texture" id=9]
|
||||
[ext_resource path="res://graphics/player/sword_slash.png" type="Texture" id=10]
|
||||
[ext_resource path="res://graphics/player/sg_shoot_grounded.png" type="Texture" id=10]
|
||||
[ext_resource path="res://graphics/player/sword_stab.png" type="Texture" id=11]
|
||||
[ext_resource path="res://graphics/player/sg_slash.png" type="Texture" id=12]
|
||||
[ext_resource path="res://graphics/player/sg_shoot_air.png" type="Texture" id=12]
|
||||
[ext_resource path="res://scripts/recolor.tres" type="Shader" id=13]
|
||||
[ext_resource path="res://graphics/player/sg_doublejump.png" type="Texture" id=14]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=14]
|
||||
shader = ExtResource( 4 )
|
||||
shader_param/border_color = Color( 0, 0, 0, 1 )
|
||||
shader_param/border_corners = true
|
||||
shader_param/palette = ExtResource( 6 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=12]
|
||||
atlas = ExtResource( 7 )
|
||||
region = Rect2( 0, 0, 20, 20 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=13]
|
||||
atlas = ExtResource( 7 )
|
||||
region = Rect2( 20, 0, 20, 20 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=16]
|
||||
atlas = ExtResource( 12 )
|
||||
region = Rect2( 0, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=17]
|
||||
atlas = ExtResource( 12 )
|
||||
region = Rect2( 32, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=18]
|
||||
atlas = ExtResource( 12 )
|
||||
region = Rect2( 64, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=19]
|
||||
atlas = ExtResource( 9 )
|
||||
region = Rect2( 0, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=20]
|
||||
atlas = ExtResource( 9 )
|
||||
region = Rect2( 32, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=8]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 0, 0, 20, 20 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=9]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 20, 0, 20, 20 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=10]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 40, 0, 20, 20 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=11]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 60, 0, 20, 20 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=5]
|
||||
animations = [ {
|
||||
"frames": [ SubResource( 12 ), SubResource( 13 ) ],
|
||||
"loop": true,
|
||||
"name": "climb",
|
||||
"speed": 7.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 3 ) ],
|
||||
"loop": true,
|
||||
"name": "idle",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 5 ) ],
|
||||
"loop": true,
|
||||
"name": "jump",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 16 ), SubResource( 17 ), SubResource( 18 ) ],
|
||||
"loop": false,
|
||||
"name": "slash",
|
||||
"speed": 7.0
|
||||
}, {
|
||||
"frames": [ SubResource( 19 ), SubResource( 20 ) ],
|
||||
"loop": false,
|
||||
"name": "stab",
|
||||
"speed": 15.0
|
||||
}, {
|
||||
"frames": [ SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ) ],
|
||||
"loop": true,
|
||||
"name": "walk",
|
||||
"speed": 10.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=21]
|
||||
shader = ExtResource( 13 )
|
||||
shader_param/palette = ExtResource( 8 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=22]
|
||||
atlas = ExtResource( 10 )
|
||||
region = Rect2( 0, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=23]
|
||||
atlas = ExtResource( 10 )
|
||||
region = Rect2( 32, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=24]
|
||||
atlas = ExtResource( 10 )
|
||||
region = Rect2( 64, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=25]
|
||||
atlas = ExtResource( 11 )
|
||||
region = Rect2( 0, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=26]
|
||||
atlas = ExtResource( 11 )
|
||||
region = Rect2( 32, 0, 32, 32 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=15]
|
||||
animations = [ {
|
||||
"frames": [ SubResource( 22 ), SubResource( 23 ), SubResource( 24 ) ],
|
||||
"loop": true,
|
||||
"name": "slash",
|
||||
"speed": 7.0
|
||||
}, {
|
||||
"frames": [ SubResource( 25 ), SubResource( 26 ) ],
|
||||
"loop": false,
|
||||
"name": "stab",
|
||||
"speed": 15.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id=27]
|
||||
shader = ExtResource( 4 )
|
||||
shader_param/border_color = Color( 0, 0, 0, 1 )
|
||||
|
@ -412,6 +292,164 @@ tracks/4/keys = {
|
|||
"values": [ 0.0 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=37]
|
||||
resource_name = "shoot air"
|
||||
length = 0.5
|
||||
step = 0.06
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:region_rect")
|
||||
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": [ Rect2( 0, 0, 20, 20 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Sprite:texture")
|
||||
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": [ ExtResource( 12 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("SwordArea/SwordHitBox:disabled")
|
||||
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": [ true ]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/path = NodePath("SwordSprite:texture")
|
||||
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": 1,
|
||||
"values": [ null ]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/path = NodePath("Sprite:rotation_degrees")
|
||||
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": 0,
|
||||
"values": [ 0.0 ]
|
||||
}
|
||||
tracks/5/type = "method"
|
||||
tracks/5/path = NodePath(".")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"values": [ {
|
||||
"args": [ ],
|
||||
"method": "spawn_arrow"
|
||||
} ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=36]
|
||||
resource_name = "shoot grounded"
|
||||
length = 0.5
|
||||
step = 0.06
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:region_rect")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.06, 0.12, 0.24, 0.3, 0.36 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ Rect2( 0, 0, 20, 20 ), Rect2( 20, 0, 20, 20 ), Rect2( 40, 0, 20, 20 ), Rect2( 60, 0, 20, 20 ), Rect2( 80, 0, 20, 20 ), Rect2( 100, 0, 20, 20 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Sprite:texture")
|
||||
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": [ ExtResource( 10 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("SwordArea/SwordHitBox:disabled")
|
||||
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": [ true ]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/path = NodePath("SwordSprite:texture")
|
||||
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": 1,
|
||||
"values": [ null ]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/path = NodePath("Sprite:rotation_degrees")
|
||||
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": 0,
|
||||
"values": [ 0.0 ]
|
||||
}
|
||||
tracks/5/type = "method"
|
||||
tracks/5/path = NodePath(".")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/keys = {
|
||||
"times": PoolRealArray( 0.24 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"values": [ {
|
||||
"args": [ ],
|
||||
"method": "spawn_arrow"
|
||||
} ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=32]
|
||||
resource_name = "stab"
|
||||
length = 0.3
|
||||
|
@ -560,25 +598,9 @@ extents = Vector2( 6, 7 )
|
|||
[node name="Player" type="KinematicBody2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
visible = false
|
||||
material = SubResource( 14 )
|
||||
frames = SubResource( 5 )
|
||||
animation = "stab"
|
||||
frame = 1
|
||||
playing = true
|
||||
|
||||
[node name="Sword" type="AnimatedSprite" parent="."]
|
||||
visible = false
|
||||
material = SubResource( 21 )
|
||||
frames = SubResource( 15 )
|
||||
animation = "stab"
|
||||
frame = 1
|
||||
playing = true
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
material = SubResource( 27 )
|
||||
texture = ExtResource( 14 )
|
||||
texture = ExtResource( 3 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 0, 20, 20 )
|
||||
|
||||
|
@ -613,6 +635,8 @@ anims/climb = SubResource( 29 )
|
|||
anims/doublejump = SubResource( 35 )
|
||||
anims/idle = SubResource( 30 )
|
||||
anims/jump = SubResource( 31 )
|
||||
"anims/shoot air" = SubResource( 37 )
|
||||
"anims/shoot grounded" = SubResource( 36 )
|
||||
anims/stab = SubResource( 32 )
|
||||
anims/walk = SubResource( 33 )
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ debug_1={
|
|||
}
|
||||
sword={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":67,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
crt={
|
||||
|
@ -87,6 +87,11 @@ debug_move_player={
|
|||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":77,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
shoot={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
|
|