-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
529 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
extends CharacterBody2D | ||
|
||
|
||
const SPEED = 300.0 | ||
const JUMP_VELOCITY = -400.0 | ||
|
||
# Get the gravity from the project settings to be synced with RigidBody nodes. | ||
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") | ||
|
||
|
||
func _physics_process(delta): | ||
# Add the gravity. | ||
if not is_on_floor(): | ||
velocity.y += gravity * delta | ||
|
||
# Handle Jump. | ||
if Input.is_action_just_pressed("ui_accept") and is_on_floor(): | ||
velocity.y = JUMP_VELOCITY | ||
|
||
# Get the input direction and handle the movement/deceleration. | ||
# As good practice, you should replace UI actions with custom gameplay actions. | ||
var direction = Input.get_axis("ui_left", "ui_right") | ||
if direction: | ||
velocity.x = direction * SPEED | ||
else: | ||
velocity.x = move_toward(velocity.x, 0, SPEED) | ||
|
||
move_and_slide() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
extends Area2D | ||
|
||
var velocity = Vector2(0, -200) | ||
# Called when the node enters the scene tree for the first time. | ||
func _ready(): | ||
var lifetime_timer = Timer.new() | ||
lifetime_timer.set_wait_time(1.2) | ||
lifetime_timer.set_one_shot(true) | ||
lifetime_timer.timeout.connect(kill) | ||
add_child(lifetime_timer) | ||
lifetime_timer.start() | ||
|
||
func init(new_speed: float) -> void: | ||
velocity.x = new_speed | ||
|
||
# Called every frame. 'delta' is the elapsed time since the previous frame. | ||
func _process(delta): | ||
velocity.y += gravity * delta | ||
|
||
position += velocity * delta | ||
|
||
func kill(): | ||
|
||
queue_free() | ||
|
||
|
||
func _on_player_hit(area): | ||
print("area_hit") | ||
if area == get_parent().get_node("Player"): | ||
area.player_hit(1.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
[gd_scene load_steps=12 format=3 uid="uid://bl3ke7fpleyp0"] | ||
|
||
[ext_resource type="Script" path="res://dragons/fireball.gd" id="1_4ccul"] | ||
[ext_resource type="Texture2D" uid="uid://d30ikbe4lis2p" path="res://assets/fireball.png" id="1_7isww"] | ||
|
||
[sub_resource type="AtlasTexture" id="AtlasTexture_fcmkv"] | ||
atlas = ExtResource("1_7isww") | ||
region = Rect2(0, 0, 19, 19) | ||
|
||
[sub_resource type="AtlasTexture" id="AtlasTexture_njpyo"] | ||
atlas = ExtResource("1_7isww") | ||
region = Rect2(19, 0, 19, 19) | ||
|
||
[sub_resource type="AtlasTexture" id="AtlasTexture_y6sfg"] | ||
atlas = ExtResource("1_7isww") | ||
region = Rect2(38, 0, 19, 19) | ||
|
||
[sub_resource type="AtlasTexture" id="AtlasTexture_372l3"] | ||
atlas = ExtResource("1_7isww") | ||
region = Rect2(57, 0, 19, 19) | ||
|
||
[sub_resource type="AtlasTexture" id="AtlasTexture_uga0u"] | ||
atlas = ExtResource("1_7isww") | ||
region = Rect2(76, 0, 19, 19) | ||
|
||
[sub_resource type="AtlasTexture" id="AtlasTexture_v3fsn"] | ||
atlas = ExtResource("1_7isww") | ||
region = Rect2(95, 0, 19, 19) | ||
|
||
[sub_resource type="AtlasTexture" id="AtlasTexture_xeqtr"] | ||
atlas = ExtResource("1_7isww") | ||
region = Rect2(114, 0, 19, 19) | ||
|
||
[sub_resource type="SpriteFrames" id="SpriteFrames_3p26w"] | ||
animations = [{ | ||
"frames": [{ | ||
"duration": 1.0, | ||
"texture": SubResource("AtlasTexture_fcmkv") | ||
}, { | ||
"duration": 1.0, | ||
"texture": SubResource("AtlasTexture_njpyo") | ||
}, { | ||
"duration": 1.0, | ||
"texture": SubResource("AtlasTexture_y6sfg") | ||
}, { | ||
"duration": 1.0, | ||
"texture": SubResource("AtlasTexture_372l3") | ||
}, { | ||
"duration": 1.0, | ||
"texture": SubResource("AtlasTexture_uga0u") | ||
}, { | ||
"duration": 1.0, | ||
"texture": SubResource("AtlasTexture_v3fsn") | ||
}, { | ||
"duration": 1.0, | ||
"texture": SubResource("AtlasTexture_xeqtr") | ||
}], | ||
"loop": true, | ||
"name": &"default", | ||
"speed": 8.0 | ||
}] | ||
|
||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_m6stc"] | ||
size = Vector2(44, 44) | ||
|
||
[node name="Fireball" type="Area2D"] | ||
script = ExtResource("1_4ccul") | ||
|
||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] | ||
texture_filter = 1 | ||
scale = Vector2(4, 4) | ||
sprite_frames = SubResource("SpriteFrames_3p26w") | ||
frame_progress = 0.558254 | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] | ||
position = Vector2(4, 4) | ||
shape = SubResource("RectangleShape2D_m6stc") | ||
|
||
[connection signal="body_entered" from="." to="." method="_on_player_hit"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
extends Area2D | ||
|
||
|
||
# Called when the node enters the scene tree for the first time. | ||
func _ready(): | ||
$Sprite2D.play("start") | ||
|
||
|
||
# Called every frame. 'delta' is the elapsed time since the previous frame. | ||
func _process(delta): | ||
position.y = get_parent().get_node("laser_dragon").position.y | ||
|
||
#func synced_with_dragon(): | ||
|
||
|
||
func start_animation_finished(): | ||
$Sprite2D.play("cycle") | ||
|
||
|
||
func _on_player_hit(area): | ||
print("area_hit") | ||
if area == get_parent().get_node("Player"): | ||
area.player_hit(1.0) | ||
|
Oops, something went wrong.