develop #50
@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Main.gdns" type="Script" id=1]
|
[ext_resource path="res://Main.gdns" type="Script" id=1]
|
||||||
[ext_resource path="res://levels/Prototype.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://levels/PrototypeR.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://gui/GameOver.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://gui/GameOver.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://gui/GameWon.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://gui/GameWon.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
|
BIN
godot/assets/music/prototype_r.ogg
(Stored with Git LFS)
Normal file
BIN
godot/assets/music/prototype_r.ogg
(Stored with Git LFS)
Normal file
Binary file not shown.
15
godot/assets/music/prototype_r.ogg.import
Normal file
15
godot/assets/music/prototype_r.ogg.import
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="ogg_vorbis"
|
||||||
|
type="AudioStreamOGGVorbis"
|
||||||
|
path="res://.import/prototype_r.ogg-fe1f80b61f2acb1c2ae620457cf8aac9.oggstr"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/music/prototype_r.ogg"
|
||||||
|
dest_files=[ "res://.import/prototype_r.ogg-fe1f80b61f2acb1c2ae620457cf8aac9.oggstr" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=true
|
||||||
|
loop_offset=0
|
@ -1,9 +1,6 @@
|
|||||||
extends KinematicBody2D
|
extends KinematicBody2D
|
||||||
|
|
||||||
|
|
||||||
signal player_touched
|
|
||||||
|
|
||||||
|
|
||||||
var velocity = Vector2()
|
var velocity = Vector2()
|
||||||
export var direction = -1
|
export var direction = -1
|
||||||
export var detect_edges = true
|
export var detect_edges = true
|
||||||
@ -32,7 +29,7 @@ func _physics_process(_delta: float) -> void:
|
|||||||
for i in get_slide_count():
|
for i in get_slide_count():
|
||||||
var collision = get_slide_collision(i)
|
var collision = get_slide_collision(i)
|
||||||
if collision.collider.name == "Player":
|
if collision.collider.name == "Player":
|
||||||
emit_signal("player_touched")
|
Event.emit_signal("player_touched", 3)
|
||||||
|
|
||||||
Event.emit_signal("object_updated", self.get_name(), "Walking", global_position, velocity)
|
Event.emit_signal("object_updated", self.get_name(), "Walking", global_position, velocity)
|
||||||
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
extends KinematicBody2D
|
extends KinematicBody2D
|
||||||
|
|
||||||
|
|
||||||
signal player_touched
|
|
||||||
|
|
||||||
|
|
||||||
export var direction = -1
|
export var direction = -1
|
||||||
export var speed = 50
|
export var speed = 50
|
||||||
export var follow_path = false
|
export var follow_path = false
|
||||||
@ -82,7 +79,7 @@ func get_velocity_towards_target(delta: float) -> Vector2:
|
|||||||
|
|
||||||
func wall_checker_collided(wall_checker: RayCast2D) -> void:
|
func wall_checker_collided(wall_checker: RayCast2D) -> void:
|
||||||
if wall_checker.get_collider().name == "Player":
|
if wall_checker.get_collider().name == "Player":
|
||||||
emit_signal("player_touched")
|
Event.emit_signal("player_touched", 3)
|
||||||
direction *= -1
|
direction *= -1
|
||||||
$AnimatedSprite.flip_h = not $AnimatedSprite.flip_h
|
$AnimatedSprite.flip_h = not $AnimatedSprite.flip_h
|
||||||
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
extends KinematicBody2D
|
extends KinematicBody2D
|
||||||
|
|
||||||
|
|
||||||
signal player_touched
|
|
||||||
|
|
||||||
|
|
||||||
onready var start_position = position
|
onready var start_position = position
|
||||||
var velocity = Vector2()
|
var velocity = Vector2()
|
||||||
export var speed = 50.0
|
export var speed = 50.0
|
||||||
@ -25,7 +22,7 @@ func _physics_process(delta: float) -> void:
|
|||||||
return_to_start = true
|
return_to_start = true
|
||||||
$AnimatedSprite.play("normal")
|
$AnimatedSprite.play("normal")
|
||||||
if collision.collider.name == "Player":
|
if collision.collider.name == "Player":
|
||||||
emit_signal("player_touched")
|
Event.emit_signal("player_touched", 3)
|
||||||
Event.emit_signal("object_updated", self.get_name(), "Falling", global_position, velocity)
|
Event.emit_signal("object_updated", self.get_name(), "Falling", global_position, velocity)
|
||||||
|
|
||||||
if position.y <= start_position.y:
|
if position.y <= start_position.y:
|
||||||
|
@ -52,4 +52,4 @@ collision_mask = 24
|
|||||||
|
|
||||||
[node name="Jump" type="AudioStreamPlayer" parent="Sounds"]
|
[node name="Jump" type="AudioStreamPlayer" parent="Sounds"]
|
||||||
stream = ExtResource( 8 )
|
stream = ExtResource( 8 )
|
||||||
volume_db = -45.0
|
volume_db = -20.0
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
[gd_scene load_steps=10 format=2]
|
[gd_scene load_steps=11 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/coin.png" type="Texture" id=1]
|
[ext_resource path="res://assets/coin.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://state_machine/StateMachine.gdns" type="Script" id=2]
|
[ext_resource path="res://state_machine/StateMachine.gdns" type="Script" id=2]
|
||||||
[ext_resource path="res://collectables/coin/states/CoinNotCollected.gdns" type="Script" id=3]
|
[ext_resource path="res://collectables/coin/states/CoinNotCollected.gdns" type="Script" id=3]
|
||||||
[ext_resource path="res://collectables/coin/states/CoinCollected.gdns" type="Script" id=4]
|
[ext_resource path="res://collectables/coin/states/CoinCollected.gdns" type="Script" id=4]
|
||||||
|
[ext_resource path="res://assets/sounds/coin.wav" type="AudioStream" id=5]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id=1]
|
[sub_resource type="CircleShape2D" id=1]
|
||||||
radius = 6.0
|
radius = 6.0
|
||||||
@ -67,5 +68,9 @@ script = ExtResource( 4 )
|
|||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
anims/jump = SubResource( 5 )
|
anims/jump = SubResource( 5 )
|
||||||
|
|
||||||
|
[node name="CoinCollectedSound" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource( 5 )
|
||||||
|
volume_db = -6.19
|
||||||
|
|
||||||
[connection signal="body_entered" from="." to="StateMachine/CoinNotCollected" method="_on_body_entered" flags=6]
|
[connection signal="body_entered" from="." to="StateMachine/CoinNotCollected" method="_on_body_entered" flags=6]
|
||||||
[connection signal="animation_finished" from="AnimationPlayer" to="StateMachine/CoinCollected" method="_on_animation_finished" flags=6]
|
[connection signal="animation_finished" from="AnimationPlayer" to="StateMachine/CoinCollected" method="_on_animation_finished" flags=6]
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
[gd_scene load_steps=7 format=2]
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/fonts/ttf/PixelOperator8.ttf" type="DynamicFontData" id=1]
|
[ext_resource path="res://assets/fonts/ttf/PixelOperator8.ttf" type="DynamicFontData" id=1]
|
||||||
[ext_resource path="res://assets/fonts/ttf/PixelOperatorHB8.ttf" type="DynamicFontData" id=2]
|
[ext_resource path="res://assets/fonts/ttf/PixelOperatorHB8.ttf" type="DynamicFontData" id=2]
|
||||||
[ext_resource path="res://gui/GameOverScreen.gdns" type="Script" id=3]
|
[ext_resource path="res://gui/GameOverScreen.gdns" type="Script" id=3]
|
||||||
|
[ext_resource path="res://assets/sounds/died.wav" type="AudioStream" id=4]
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=1]
|
[sub_resource type="DynamicFont" id=1]
|
||||||
size = 50
|
size = 50
|
||||||
@ -45,4 +46,9 @@ custom_fonts/font = SubResource( 2 )
|
|||||||
custom_styles/hover = SubResource( 3 )
|
custom_styles/hover = SubResource( 3 )
|
||||||
text = "REINICIAR"
|
text = "REINICIAR"
|
||||||
|
|
||||||
|
[node name="GameOverMusic" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource( 4 )
|
||||||
|
volume_db = -23.524
|
||||||
|
|
||||||
|
[connection signal="visibility_changed" from="." to="." method="_play_music"]
|
||||||
[connection signal="pressed" from="Control/RestartButton" to="." method="_on_restart_button_pressed"]
|
[connection signal="pressed" from="Control/RestartButton" to="." method="_on_restart_button_pressed"]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=8 format=2]
|
[gd_scene load_steps=9 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://CameraLimit.gdns" type="Script" id=1]
|
[ext_resource path="res://CameraLimit.gdns" type="Script" id=1]
|
||||||
[ext_resource path="res://characters/player/Player.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://characters/player/Player.tscn" type="PackedScene" id=2]
|
||||||
@ -6,6 +6,7 @@
|
|||||||
[ext_resource path="res://assets/backgrounds/mountains.png" type="Texture" id=4]
|
[ext_resource path="res://assets/backgrounds/mountains.png" type="Texture" id=4]
|
||||||
[ext_resource path="res://collectables/coin/Coin.tscn" type="PackedScene" id=5]
|
[ext_resource path="res://collectables/coin/Coin.tscn" type="PackedScene" id=5]
|
||||||
[ext_resource path="res://hud/CoinHUD.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://hud/CoinHUD.tscn" type="PackedScene" id=6]
|
||||||
|
[ext_resource path="res://assets/music/prototype_r.ogg" type="AudioStream" id=7]
|
||||||
[ext_resource path="res://goal/Goal.tscn" type="PackedScene" id=8]
|
[ext_resource path="res://goal/Goal.tscn" type="PackedScene" id=8]
|
||||||
|
|
||||||
[node name="Prototype" type="Node2D"]
|
[node name="Prototype" type="Node2D"]
|
||||||
@ -55,3 +56,10 @@ position = Vector2( 72, 450 )
|
|||||||
position = Vector2( 234, 450 )
|
position = Vector2( 234, 450 )
|
||||||
|
|
||||||
[node name="Goal" parent="." instance=ExtResource( 8 )]
|
[node name="Goal" parent="." instance=ExtResource( 8 )]
|
||||||
|
|
||||||
|
[node name="BGM" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource( 7 )
|
||||||
|
volume_db = -29.714
|
||||||
|
autoplay = true
|
||||||
|
|
||||||
|
[editable path="Coins/coin"]
|
||||||
|
@ -89,10 +89,3 @@ position = Vector2( 247, 439 )
|
|||||||
|
|
||||||
[node name="SuperShelly" parent="Enemies" instance=ExtResource( 7 )]
|
[node name="SuperShelly" parent="Enemies" instance=ExtResource( 7 )]
|
||||||
position = Vector2( 62, 546 )
|
position = Vector2( 62, 546 )
|
||||||
|
|
||||||
[connection signal="player_touched" from="Enemies/Blightwing" to="Player" method="_on_player_touched"]
|
|
||||||
[connection signal="player_touched" from="Enemies/Blockface" to="Player" method="_on_player_touched"]
|
|
||||||
[connection signal="player_touched" from="Enemies/Dreadtooth" to="Player" method="_on_player_touched"]
|
|
||||||
[connection signal="player_touched" from="Enemies/Dreadtooth2" to="Player" method="_on_player_touched"]
|
|
||||||
[connection signal="player_touched" from="Enemies/Shelly" to="Player" method="_on_player_touched"]
|
|
||||||
[connection signal="player_touched" from="Enemies/SuperShelly" to="Player" method="_on_player_touched"]
|
|
||||||
|
19
godot/levels/PrototypeR.tmx
Normal file
19
godot/levels/PrototypeR.tmx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<map version="1.8" tiledversion="1.8.6" orientation="orthogonal" renderorder="right-down" width="120" height="32" tilewidth="18" tileheight="18" infinite="0" nextlayerid="4" nextobjectid="1">
|
||||||
|
<tileset firstgid="1" source="../tilesets/tiles.tsx"/>
|
||||||
|
<layer id="3" name="Background" width="120" height="32">
|
||||||
|
<data encoding="base64" compression="zstd">
|
||||||
|
KLUv/WAAO+UJAKKFEBmgKa0BQ/z5f96XBipzAacygijAnyB3inwKFSvNi9glMAjxxA9XlsgtTIpZPMt4Y5dngxsSKwGqJ/AAXtOPtCPdGGCgMLGl7aACk0ACwdEBxfEUiOZVzal6o7kqyNAeN3fIyH7S5qp2c6UrxlMzmjiIKgDhsHQId31OUO2QhjGOn1jH74PYuHOc8tYy/qlHqaNzDnLc/nFdEc9bdesdom5Z3PEgeGCq2jtS46axwFMfv3dxfKgNZ5HU/e4tjqcWSd0k/yrTDSmpq+CqHl/d0aVt0urewnTzsUiyVcsyprra58l1+g7NC/UOqt5CzniZswtOyWRvAHxDn0csowOGV42bUrLGiSrDqDOLOIxxbSotgVq8/NT2n/z80u/Jz1KVb98VKDofNZOm5Ndvltmp+0cuUIUgKiT5TQw=
|
||||||
|
</data>
|
||||||
|
</layer>
|
||||||
|
<layer id="1" name="Middleground" width="120" height="32">
|
||||||
|
<data encoding="base64" compression="zstd">
|
||||||
|
KLUv/WAAO50FAMQCADEAAAAyMwACAAAAAwQAGwACFgAAABcYABt6AAAAe3wAGxeGXwB7iACGXogxoCCzdWCCFIgEYmQHpY//V412Vf4gGemWL/1AEQoZHqr8I5IHRLoFS671y2WYzYBxqqNa2qcCCqf7uoRE1YZxqzJNOVxJqesG5R7dJVCGcRyg1GVAvQU6Pu6UVhrTRgcqSPFJzkzZ78bTSSezM7YmircT9lep4Hgo+u2SHKWql8yW9EEH
|
||||||
|
</data>
|
||||||
|
</layer>
|
||||||
|
<layer id="2" name="Foreground" width="120" height="32">
|
||||||
|
<data encoding="base64" compression="zstd">
|
||||||
|
KLUv/WAAO70CAKgAdAB0AIiINzeIN0YjWjcjNyNuNwAaoJD2AWBDhVoO4YKf+iiKEtrHJVQSqc4GzhDlVlFe0Tb1bDJ629TRhBsftwpQtCpKtEu19HH9uSSqrEzywUAhHQ==
|
||||||
|
</data>
|
||||||
|
</layer>
|
||||||
|
</map>
|
24
godot/levels/PrototypeR.tmx.import
Normal file
24
godot/levels/PrototypeR.tmx.import
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="vnen.tiled_importer"
|
||||||
|
type="PackedScene"
|
||||||
|
path="res://.import/PrototypeR.tmx-dfb7d18f520c5c44182a13443fe1b69c.scn"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://levels/PrototypeR.tmx"
|
||||||
|
dest_files=[ "res://.import/PrototypeR.tmx-dfb7d18f520c5c44182a13443fe1b69c.scn" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
custom_properties=true
|
||||||
|
tile_metadata=false
|
||||||
|
uv_clip=true
|
||||||
|
y_sort=false
|
||||||
|
image_flags=0
|
||||||
|
collision_layer=2
|
||||||
|
collision_mask=0
|
||||||
|
embed_internal_images=false
|
||||||
|
save_tiled_properties=false
|
||||||
|
add_background=true
|
||||||
|
post_import_script=""
|
154
godot/levels/PrototypeR.tscn
Normal file
154
godot/levels/PrototypeR.tscn
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
[gd_scene load_steps=15 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://CameraLimit.gdns" type="Script" id=1]
|
||||||
|
[ext_resource path="res://characters/player/Player.tscn" type="PackedScene" id=2]
|
||||||
|
[ext_resource path="res://levels/PrototypeR.tmx" type="PackedScene" id=3]
|
||||||
|
[ext_resource path="res://assets/backgrounds/hills.png" type="Texture" id=4]
|
||||||
|
[ext_resource path="res://hud/CoinHUD.tscn" type="PackedScene" id=5]
|
||||||
|
[ext_resource path="res://collectables/coin/Coin.tscn" type="PackedScene" id=6]
|
||||||
|
[ext_resource path="res://assets/music/prototype_r.ogg" type="AudioStream" id=7]
|
||||||
|
[ext_resource path="res://goal/Goal.tscn" type="PackedScene" id=8]
|
||||||
|
[ext_resource path="res://characters/enemies/blockface/Blockface.tscn" type="PackedScene" id=9]
|
||||||
|
[ext_resource path="res://characters/enemies/shelly/Shelly.tscn" type="PackedScene" id=10]
|
||||||
|
[ext_resource path="res://characters/enemies/dreadtooth/Dreadtooth.tscn" type="PackedScene" id=11]
|
||||||
|
[ext_resource path="res://characters/enemies/spikeball/Spikeball.tscn" type="PackedScene" id=12]
|
||||||
|
[ext_resource path="res://characters/enemies/super_shelly/SuperShelly.tscn" type="PackedScene" id=13]
|
||||||
|
[ext_resource path="res://characters/enemies/blightwing/Blightwing.tscn" type="PackedScene" id=14]
|
||||||
|
|
||||||
|
[node name="PrototypeR" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="Player" parent="." instance=ExtResource( 2 )]
|
||||||
|
position = Vector2( 36, 444 )
|
||||||
|
collision_layer = 5
|
||||||
|
|
||||||
|
[node name="Camera2D" type="Camera2D" parent="Player"]
|
||||||
|
current = true
|
||||||
|
limit_left = 0
|
||||||
|
limit_top = 0
|
||||||
|
limit_right = 512
|
||||||
|
limit_bottom = 288
|
||||||
|
drag_margin_h_enabled = true
|
||||||
|
drag_margin_v_enabled = true
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_bone_": true
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="Player/Camera2D"]
|
||||||
|
rect = Rect2( 0, 0, 24, 24 )
|
||||||
|
|
||||||
|
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
|
||||||
|
|
||||||
|
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
|
||||||
|
motion_scale = Vector2( 0.2, 0.1 )
|
||||||
|
motion_offset = Vector2( 0, -288 )
|
||||||
|
motion_mirroring = Vector2( 528, 0 )
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
|
||||||
|
texture = ExtResource( 4 )
|
||||||
|
centered = false
|
||||||
|
|
||||||
|
[node name="Map" type="Node2D" parent="."]
|
||||||
|
|
||||||
|
[node name="PrototypeR" parent="Map" instance=ExtResource( 3 )]
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="CoinHUD" parent="." instance=ExtResource( 5 )]
|
||||||
|
|
||||||
|
[node name="Coins" type="Node" parent="."]
|
||||||
|
|
||||||
|
[node name="Coin" parent="Coins" instance=ExtResource( 6 )]
|
||||||
|
position = Vector2( 270, 432 )
|
||||||
|
|
||||||
|
[node name="Coin2" parent="Coins" instance=ExtResource( 6 )]
|
||||||
|
position = Vector2( 846, 252 )
|
||||||
|
|
||||||
|
[node name="Coin3" parent="Coins" instance=ExtResource( 6 )]
|
||||||
|
position = Vector2( 1278, 342 )
|
||||||
|
|
||||||
|
[node name="Coin4" parent="Coins" instance=ExtResource( 6 )]
|
||||||
|
position = Vector2( 1278, 180 )
|
||||||
|
|
||||||
|
[node name="Coin9" parent="Coins" instance=ExtResource( 6 )]
|
||||||
|
position = Vector2( 1278, 108 )
|
||||||
|
|
||||||
|
[node name="Coin10" parent="Coins" instance=ExtResource( 6 )]
|
||||||
|
position = Vector2( 1800, 378 )
|
||||||
|
|
||||||
|
[node name="Coin11" parent="Coins" instance=ExtResource( 6 )]
|
||||||
|
position = Vector2( 1872, 378 )
|
||||||
|
|
||||||
|
[node name="Coin12" parent="Coins" instance=ExtResource( 6 )]
|
||||||
|
position = Vector2( 1836, 315 )
|
||||||
|
|
||||||
|
[node name="Coin5" parent="Coins" instance=ExtResource( 6 )]
|
||||||
|
position = Vector2( 522, 270 )
|
||||||
|
|
||||||
|
[node name="Coin6" parent="Coins" instance=ExtResource( 6 )]
|
||||||
|
position = Vector2( 990, 324 )
|
||||||
|
|
||||||
|
[node name="Coin13" parent="Coins" instance=ExtResource( 6 )]
|
||||||
|
position = Vector2( 1134, 414 )
|
||||||
|
|
||||||
|
[node name="Coin7" parent="Coins" instance=ExtResource( 6 )]
|
||||||
|
position = Vector2( 468, 306 )
|
||||||
|
|
||||||
|
[node name="Coin8" parent="Coins" instance=ExtResource( 6 )]
|
||||||
|
position = Vector2( 576, 306 )
|
||||||
|
|
||||||
|
[node name="BGM" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource( 7 )
|
||||||
|
volume_db = -25.0
|
||||||
|
autoplay = true
|
||||||
|
|
||||||
|
[node name="Goal" parent="." instance=ExtResource( 8 )]
|
||||||
|
position = Vector2( 2052, 396 )
|
||||||
|
|
||||||
|
[node name="Enemies" type="Node" parent="."]
|
||||||
|
|
||||||
|
[node name="Blockface" parent="Enemies" instance=ExtResource( 9 )]
|
||||||
|
position = Vector2( 531, 228 )
|
||||||
|
|
||||||
|
[node name="Blockface2" parent="Enemies" instance=ExtResource( 9 )]
|
||||||
|
position = Vector2( 1287, 72 )
|
||||||
|
|
||||||
|
[node name="Shelly" parent="Enemies" instance=ExtResource( 10 )]
|
||||||
|
position = Vector2( 918, 258 )
|
||||||
|
|
||||||
|
[node name="Shelly2" parent="Enemies" instance=ExtResource( 10 )]
|
||||||
|
position = Vector2( 612, 360 )
|
||||||
|
|
||||||
|
[node name="Dreadtooth" parent="Enemies" instance=ExtResource( 11 )]
|
||||||
|
position = Vector2( 1337, 217 )
|
||||||
|
|
||||||
|
[node name="Spikeball" parent="Enemies" instance=ExtResource( 12 )]
|
||||||
|
position = Vector2( 1458, 336 )
|
||||||
|
|
||||||
|
[node name="Spikeball2" parent="Enemies" instance=ExtResource( 12 )]
|
||||||
|
position = Vector2( 1428, 348 )
|
||||||
|
|
||||||
|
[node name="Spikeball3" parent="Enemies" instance=ExtResource( 12 )]
|
||||||
|
position = Vector2( 1845, 366 )
|
||||||
|
|
||||||
|
[node name="SuperShelly" parent="Enemies" instance=ExtResource( 13 )]
|
||||||
|
position = Vector2( 1962, 432 )
|
||||||
|
|
||||||
|
[node name="Blightwing" parent="Enemies" instance=ExtResource( 14 )]
|
||||||
|
position = Vector2( 1206, 450 )
|
||||||
|
follow_path = true
|
||||||
|
|
||||||
|
[node name="Path" type="Node2D" parent="Enemies/Blightwing"]
|
||||||
|
|
||||||
|
[node name="Node2D" type="Node2D" parent="Enemies/Blightwing/Path"]
|
||||||
|
position = Vector2( -126, 0 )
|
||||||
|
|
||||||
|
[node name="Blightwing2" parent="Enemies" instance=ExtResource( 14 )]
|
||||||
|
position = Vector2( 1846, 324 )
|
||||||
|
follow_path = true
|
||||||
|
|
||||||
|
[node name="Path" type="Node2D" parent="Enemies/Blightwing2"]
|
||||||
|
|
||||||
|
[node name="Node2D" type="Node2D" parent="Enemies/Blightwing2/Path"]
|
||||||
|
position = Vector2( -36, 63 )
|
||||||
|
|
||||||
|
[node name="Node2D2" type="Node2D" parent="Enemies/Blightwing2/Path"]
|
||||||
|
position = Vector2( 36, 63 )
|
@ -11,6 +11,8 @@ void alai::Event::_register_methods()
|
|||||||
godot::register_signal<Event>("coin_collected", "amount", GODOT_VARIANT_TYPE_INT);
|
godot::register_signal<Event>("coin_collected", "amount", GODOT_VARIANT_TYPE_INT);
|
||||||
godot::register_signal<Event>("player_died");
|
godot::register_signal<Event>("player_died");
|
||||||
godot::register_signal<Event>("player_won");
|
godot::register_signal<Event>("player_won");
|
||||||
|
godot::register_signal<Event>("player_touched", "damage", GODOT_VARIANT_TYPE_INT);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
alai::Event::Event()
|
alai::Event::Event()
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
|
|
||||||
|
#include <AudioStreamPlayer.hpp>
|
||||||
#include <AnimationPlayer.hpp>
|
#include <AnimationPlayer.hpp>
|
||||||
|
|
||||||
void alai::CoinCollected::_register_methods()
|
void alai::CoinCollected::_register_methods()
|
||||||
@ -32,7 +33,8 @@ void alai::CoinCollected::_state_enter()
|
|||||||
auto animation_player = Object::cast_to<godot::AnimationPlayer>(node);
|
auto animation_player = Object::cast_to<godot::AnimationPlayer>(node);
|
||||||
animation_player->play("jump");
|
animation_player->play("jump");
|
||||||
}
|
}
|
||||||
|
auto coin_collected_sound = get_parent()->get_node<godot::AudioStreamPlayer>("CoinCollectedSound");
|
||||||
|
coin_collected_sound->play();
|
||||||
}
|
}
|
||||||
|
|
||||||
void alai::CoinCollected::_state_exit()
|
void alai::CoinCollected::_state_exit()
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
|
|
||||||
|
#include <AudioStreamPlayer.hpp>
|
||||||
#include <PackedScene.hpp>
|
#include <PackedScene.hpp>
|
||||||
#include <Ref.hpp>
|
#include <Ref.hpp>
|
||||||
#include <Resource.hpp>
|
#include <Resource.hpp>
|
||||||
@ -15,6 +16,7 @@ void alai::GameOverScreen::_register_methods()
|
|||||||
godot::register_method("restart_game", &GameOverScreen::restart_game);
|
godot::register_method("restart_game", &GameOverScreen::restart_game);
|
||||||
godot::register_method("connect_signal", &GameOverScreen::connect_signal);
|
godot::register_method("connect_signal", &GameOverScreen::connect_signal);
|
||||||
godot::register_method("_on_player_died", &GameOverScreen::_on_player_died);
|
godot::register_method("_on_player_died", &GameOverScreen::_on_player_died);
|
||||||
|
godot::register_method("_play_music", &GameOverScreen::_play_music);
|
||||||
}
|
}
|
||||||
|
|
||||||
alai::GameOverScreen::GameOverScreen()
|
alai::GameOverScreen::GameOverScreen()
|
||||||
@ -37,9 +39,9 @@ void alai::GameOverScreen::_ready()
|
|||||||
|
|
||||||
void alai::GameOverScreen::_on_restart_button_pressed()
|
void alai::GameOverScreen::_on_restart_button_pressed()
|
||||||
{
|
{
|
||||||
if (_resource_loader->exists("res://levels/Prototype.tscn"))
|
if (_resource_loader->exists("res://levels/PrototypeR.tscn"))
|
||||||
{
|
{
|
||||||
godot::Ref<godot::PackedScene> level_scene = _resource_loader->load("res://levels/Prototype.tscn");
|
godot::Ref<godot::PackedScene> level_scene = _resource_loader->load("res://levels/PrototypeR.tscn");
|
||||||
auto level = level_scene->instance();
|
auto level = level_scene->instance();
|
||||||
auto level_node = get_tree()->get_root()->get_node("Main")->find_node("Level");
|
auto level_node = get_tree()->get_root()->get_node("Main")->find_node("Level");
|
||||||
|
|
||||||
@ -93,3 +95,7 @@ void alai::GameOverScreen::connect_signal()
|
|||||||
auto event = get_node<alai::Event>("/root/Event");
|
auto event = get_node<alai::Event>("/root/Event");
|
||||||
event->connect("player_died", this, "_on_player_died");
|
event->connect("player_died", this, "_on_player_died");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void alai::GameOverScreen::_play_music()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <Godot.hpp>
|
#include <Godot.hpp>
|
||||||
#include <ResourceLoader.hpp>
|
#include <ResourceLoader.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace alai
|
namespace alai
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -54,6 +55,7 @@ namespace alai
|
|||||||
void _on_restart_button_pressed();
|
void _on_restart_button_pressed();
|
||||||
void restart_game();
|
void restart_game();
|
||||||
void connect_signal();
|
void connect_signal();
|
||||||
|
void _play_music();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ void alai::player::Player::_ready()
|
|||||||
{
|
{
|
||||||
auto event = get_node<alai::Event>("/root/Event");
|
auto event = get_node<alai::Event>("/root/Event");
|
||||||
event->connect("level_loaded", this, "_on_level_loaded");
|
event->connect("level_loaded", this, "_on_level_loaded");
|
||||||
|
event->connect("player_touched", this, "_on_player_touched");
|
||||||
|
|
||||||
animated_sprite = get_node<godot::AnimatedSprite>("AnimatedSprite");
|
animated_sprite = get_node<godot::AnimatedSprite>("AnimatedSprite");
|
||||||
if (!animated_sprite)
|
if (!animated_sprite)
|
||||||
@ -156,11 +157,11 @@ void alai::player::Player::_physics_process(float delta)
|
|||||||
}
|
}
|
||||||
else if (collider->is_in_group("enemy") && (collider->is_in_group("rideable") && godot::Vector2::DOWN.dot(collision->get_normal()) > 0))
|
else if (collider->is_in_group("enemy") && (collider->is_in_group("rideable") && godot::Vector2::DOWN.dot(collision->get_normal()) > 0))
|
||||||
{
|
{
|
||||||
_on_player_touched();
|
_on_player_touched(3);
|
||||||
}
|
}
|
||||||
else if (collider->is_in_group("enemy") && !collider->is_in_group("rideable"))
|
else if (collider->is_in_group("enemy") && !collider->is_in_group("rideable"))
|
||||||
{
|
{
|
||||||
_on_player_touched();
|
_on_player_touched(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +302,7 @@ godot::Vector2 alai::player::Player::get_velocity()
|
|||||||
return this->velocity;
|
return this->velocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void alai::player::Player::_on_player_touched()
|
void alai::player::Player::_on_player_touched(uint8_t damage)
|
||||||
{
|
{
|
||||||
auto event = get_node<alai::Event>("/root/Event");
|
auto event = get_node<alai::Event>("/root/Event");
|
||||||
event->emit_signal("player_died");
|
event->emit_signal("player_died");
|
||||||
|
@ -283,7 +283,7 @@ namespace alai
|
|||||||
* @brief This function is called when an enemy touches the player.
|
* @brief This function is called when an enemy touches the player.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void _on_player_touched();
|
void _on_player_touched(uint8_t damage);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Called when the monitor is loaded to connect the player to it for tracking.
|
* @brief Called when the monitor is loaded to connect the player to it for tracking.
|
||||||
|
Loading…
Reference in New Issue
Block a user