generated from sakkaku-dev/godot-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
13 changed files
with
308 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class_name Hitbox | ||
extends Area2D | ||
|
||
signal hit(dmg) | ||
|
||
func damage(dmg: int): | ||
hit.emit(dmg) |
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,36 @@ | ||
[gd_scene load_steps=6 format=3 uid="uid://mt5fy2ohtmg5"] | ||
|
||
[ext_resource type="Script" path="res://src/Enemy.gd" id="1_xsn24"] | ||
[ext_resource type="Texture2D" uid="uid://bwve2nq30wldn" path="res://icon.svg" id="2_s6l7m"] | ||
[ext_resource type="Script" path="res://src/character/Hitbox.gd" id="3_dexve"] | ||
|
||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0wd2x"] | ||
size = Vector2(10, 10) | ||
|
||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5khei"] | ||
size = Vector2(12, 12) | ||
|
||
[node name="Enemy" type="CharacterBody2D"] | ||
collision_layer = 4 | ||
collision_mask = 0 | ||
script = ExtResource("1_xsn24") | ||
|
||
[node name="Sprite2D" type="Sprite2D" parent="."] | ||
modulate = Color(1, 0.490196, 0.490196, 1) | ||
scale = Vector2(0.078125, 0.078125) | ||
texture = ExtResource("2_s6l7m") | ||
|
||
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."] | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] | ||
shape = SubResource("RectangleShape2D_0wd2x") | ||
|
||
[node name="Hitbox" type="Area2D" parent="."] | ||
collision_layer = 16 | ||
collision_mask = 0 | ||
script = ExtResource("3_dexve") | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"] | ||
shape = SubResource("RectangleShape2D_5khei") | ||
|
||
[connection signal="hit" from="Hitbox" to="." method="_on_hitbox_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
[gd_scene load_steps=8 format=3 uid="uid://dlby6flxkmnjs"] | ||
|
||
[ext_resource type="Script" path="res://src/player.gd" id="1_356t7"] | ||
[ext_resource type="PackedScene" uid="uid://h5rba01pdi3f" path="res://src/props/projectile.tscn" id="2_yssxu"] | ||
[ext_resource type="Texture2D" uid="uid://bwve2nq30wldn" path="res://icon.svg" id="3_h74si"] | ||
[ext_resource type="Script" path="res://addons/input-system/PlayerInput.gd" id="4_0sora"] | ||
[ext_resource type="Script" path="res://src/character/Hitbox.gd" id="5_dpg7u"] | ||
|
||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_dgu6m"] | ||
radius = 2.0 | ||
height = 16.0 | ||
|
||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vssjf"] | ||
size = Vector2(14, 14) | ||
|
||
[node name="Player" type="CharacterBody2D" groups=["Player"]] | ||
collision_layer = 2 | ||
script = ExtResource("1_356t7") | ||
projectile_scene = ExtResource("2_yssxu") | ||
|
||
[node name="Icon" type="Sprite2D" parent="."] | ||
scale = Vector2(0.125, 0.125) | ||
texture = ExtResource("3_h74si") | ||
|
||
[node name="Input" type="Node" parent="."] | ||
script = ExtResource("4_0sora") | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] | ||
position = Vector2(0, 6) | ||
rotation = 1.5708 | ||
shape = SubResource("CapsuleShape2D_dgu6m") | ||
|
||
[node name="Hand" type="Node2D" parent="."] | ||
|
||
[node name="ShotPoint" type="Marker2D" parent="Hand"] | ||
position = Vector2(16, 0) | ||
|
||
[node name="Sprite2D" type="Sprite2D" parent="Hand/ShotPoint"] | ||
scale = Vector2(0.03125, 0.03125) | ||
texture = ExtResource("3_h74si") | ||
|
||
[node name="Hitbox" type="Area2D" parent="."] | ||
collision_layer = 8 | ||
collision_mask = 0 | ||
script = ExtResource("5_dpg7u") | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"] | ||
shape = SubResource("RectangleShape2D_vssjf") | ||
|
||
[connection signal="hit" from="Hitbox" to="." method="_on_hitbox_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
extends Node2D | ||
|
||
const SHARD_EMITTER = preload("res://src/props/shard_emitter.tscn") | ||
|
||
@onready var main = $Main | ||
@onready var death_screen = $DeathScreen | ||
|
||
func _ready(): | ||
death_screen.hide() | ||
|
||
func _on_player_died(): | ||
main.process_mode = Node.PROCESS_MODE_DISABLED | ||
|
||
var window_scale = get_viewport_rect().size / Vector2(get_window().size) | ||
var tex_scale = max(window_scale.x, window_scale.y) | ||
|
||
var img = get_viewport().get_texture().get_image() | ||
var tex = ImageTexture.create_from_image(img) | ||
death_screen.texture = tex | ||
death_screen.scale = Vector2(tex_scale, tex_scale) | ||
death_screen.show() | ||
main.hide() | ||
|
||
var shard = SHARD_EMITTER.instantiate() | ||
death_screen.add_child(shard) | ||
get_tree().create_timer(1.0).timeout.connect(func(): shard.shatter()) |
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,4 @@ | ||
extends RigidBody2D | ||
|
||
func _integrate_forces(state): | ||
scale = Vector2(1, 1) |
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,15 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://loeue0lwhf1q"] | ||
|
||
[ext_resource type="Script" path="res://src/props/shard.gd" id="1_nrevn"] | ||
|
||
[node name="Shard" type="RigidBody2D"] | ||
collision_layer = 0 | ||
collision_mask = 0 | ||
sleeping = true | ||
freeze = true | ||
script = ExtResource("1_nrevn") | ||
|
||
[node name="Polygon2D" type="Polygon2D" parent="."] | ||
|
||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] | ||
disabled = true |
Oops, something went wrong.