Compare commits
8 Commits
f0f717e00e
...
294c88a830
Author | SHA1 | Date | |
---|---|---|---|
294c88a830
|
|||
a2dfc2d65d
|
|||
a1cc8042ea
|
|||
5e8301a04c
|
|||
36dfcee36d
|
|||
0046865101
|
|||
f860ddd669
|
|||
80d00d0c26
|
@@ -1,3 +1,4 @@
|
|||||||
README.md
|
README.md
|
||||||
flake.nix
|
flake.nix
|
||||||
flake.lock
|
flake.lock
|
||||||
|
result
|
||||||
|
BIN
assets/sprites/small_bat.aseprite
(Stored with Git LFS)
Normal file
BIN
assets/sprites/small_bat.aseprite
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/sprites/small_bat.png
(Stored with Git LFS)
Normal file
BIN
assets/sprites/small_bat.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
assets/sprites/small_bat.png.import
Normal file
34
assets/sprites/small_bat.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://chtjfq3bmonhj"
|
||||||
|
path="res://.godot/imported/small_bat.png-8cac10440ad9b69c99d6007471ff8d06.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/sprites/small_bat.png"
|
||||||
|
dest_files=["res://.godot/imported/small_bat.png-8cac10440ad9b69c99d6007471ff8d06.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
@@ -39,3 +39,47 @@ unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
|||||||
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||||
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
||||||
rm -rf \"{temp_dir}\""
|
rm -rf \"{temp_dir}\""
|
||||||
|
|
||||||
|
[preset.1]
|
||||||
|
|
||||||
|
name="Web"
|
||||||
|
platform="Web"
|
||||||
|
runnable=true
|
||||||
|
advanced_options=false
|
||||||
|
dedicated_server=false
|
||||||
|
custom_features=""
|
||||||
|
export_filter="all_resources"
|
||||||
|
include_filter=""
|
||||||
|
exclude_filter=""
|
||||||
|
export_path=""
|
||||||
|
patches=PackedStringArray()
|
||||||
|
encryption_include_filters=""
|
||||||
|
encryption_exclude_filters=""
|
||||||
|
seed=0
|
||||||
|
encrypt_pck=false
|
||||||
|
encrypt_directory=false
|
||||||
|
script_export_mode=2
|
||||||
|
|
||||||
|
[preset.1.options]
|
||||||
|
|
||||||
|
custom_template/debug=""
|
||||||
|
custom_template/release=""
|
||||||
|
variant/extensions_support=false
|
||||||
|
variant/thread_support=false
|
||||||
|
vram_texture_compression/for_desktop=true
|
||||||
|
vram_texture_compression/for_mobile=false
|
||||||
|
html/export_icon=true
|
||||||
|
html/custom_html_shell=""
|
||||||
|
html/head_include=""
|
||||||
|
html/canvas_resize_policy=2
|
||||||
|
html/focus_canvas_on_start=true
|
||||||
|
html/experimental_virtual_keyboard=false
|
||||||
|
progressive_web_app/enabled=true
|
||||||
|
progressive_web_app/ensure_cross_origin_isolation_headers=true
|
||||||
|
progressive_web_app/offline_page=""
|
||||||
|
progressive_web_app/display=1
|
||||||
|
progressive_web_app/orientation=0
|
||||||
|
progressive_web_app/icon_144x144=""
|
||||||
|
progressive_web_app/icon_180x180=""
|
||||||
|
progressive_web_app/icon_512x512=""
|
||||||
|
progressive_web_app/background_color=Color(0, 0, 0, 1)
|
||||||
|
93
flake.nix
93
flake.nix
@@ -75,6 +75,99 @@
|
|||||||
ln -s $out/libexec/slopvivors $out/bin/slopvivors
|
ln -s $out/libexec/slopvivors $out/bin/slopvivors
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
slopvivors_web_files = pkgs.stdenv.mkDerivation {
|
||||||
|
pname = "slopvivors-web-files";
|
||||||
|
version = self.packages.${pkgs.system}.slopvivors.version;
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
strictDeps = true;
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
godot
|
||||||
|
godot-export-templates-bin
|
||||||
|
];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
|
||||||
|
export HOME=$(mktemp -d)
|
||||||
|
mkdir -p $HOME/.local/share/godot/
|
||||||
|
ln -s ${pkgs.godot-export-templates-bin}/share/godot/export_templates "$HOME/.local/share/godot/"
|
||||||
|
mkdir -p build
|
||||||
|
|
||||||
|
godot --headless --export-release Web ./build/slopvivors
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p "$out"
|
||||||
|
cp ./build/* "$out"
|
||||||
|
mv ./build/slopvivors "$out"/index.html
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
slopvivors_web = pkgs.buildGoModule {
|
||||||
|
pname = "slopvivors-web";
|
||||||
|
version = self.packages.${pkgs.system}.slopvivors_web.version;
|
||||||
|
vendorHash = null;
|
||||||
|
src = self.packages.${pkgs.system}.slopvivors_web_files;
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
go
|
||||||
|
];
|
||||||
|
|
||||||
|
prePatch = ''
|
||||||
|
mkdir -p slopvivors_web_files
|
||||||
|
cp "${self.packages.${pkgs.system}.slopvivors_web_files}"/* slopvivors_web_files
|
||||||
|
cat > main.go <<EOF
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"embed"
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"io/fs"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed slopvivors_web_files/*
|
||||||
|
var webFiles embed.FS
|
||||||
|
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
rootDir, err := fs.Sub(webFiles, "slopvivors_web_files")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
http.Handle("/", http.FileServer(http.FS(rootDir)))
|
||||||
|
fmt.Printf("Serving on :8080\n")
|
||||||
|
http.ListenAndServe(":8080", nil)
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
'';
|
||||||
|
postPatch = ''
|
||||||
|
go mod init slopvivors-web
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
slopvivors_docker = pkgs.dockerTools.buildLayeredImage {
|
||||||
|
name = "slopvivors-docker";
|
||||||
|
tag = "${self.packages.${pkgs.system}.slopvivors.version}";
|
||||||
|
created = "now";
|
||||||
|
contents = [
|
||||||
|
pkgs.busybox
|
||||||
|
pkgs.caddy
|
||||||
|
self.packages.${pkgs.system}.slopvivors_web_files
|
||||||
|
];
|
||||||
|
config = {
|
||||||
|
Cmd = [
|
||||||
|
"caddy"
|
||||||
|
"file-server"
|
||||||
|
"-a"
|
||||||
|
"--listen"
|
||||||
|
":8080"
|
||||||
|
];
|
||||||
|
WorkingDir = "${self.packages.${pkgs.system}.slopvivors_web_files}/";
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@@ -6,6 +6,7 @@ extends CharacterBody2D
|
|||||||
@export var default_contact_damage: float = 0.0
|
@export var default_contact_damage: float = 0.0
|
||||||
@export var target_distance: float = 6.0
|
@export var target_distance: float = 6.0
|
||||||
@export var path_update_interval: float = 1.5
|
@export var path_update_interval: float = 1.5
|
||||||
|
@export var xp_dropped: float = 5.0
|
||||||
|
|
||||||
@onready var target_cast: RayCast2D = $TargetCast
|
@onready var target_cast: RayCast2D = $TargetCast
|
||||||
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
||||||
@@ -97,7 +98,7 @@ func _do_nav_agent_movement():
|
|||||||
func check_contact_damage():
|
func check_contact_damage():
|
||||||
if default_contact_damage == 0.0:
|
if default_contact_damage == 0.0:
|
||||||
return
|
return
|
||||||
if global_position.distance_to(target.global_position) > target_distance:
|
if global_position.distance_to(target.global_position) > target_distance + 2:
|
||||||
return
|
return
|
||||||
deal_contact_damage()
|
deal_contact_damage()
|
||||||
|
|
||||||
@@ -140,9 +141,9 @@ func die():
|
|||||||
|
|
||||||
func drop_xp_orb() -> void:
|
func drop_xp_orb() -> void:
|
||||||
var orb: XPOrb = preload("res://scenes/xp_orb.tscn").instantiate()
|
var orb: XPOrb = preload("res://scenes/xp_orb.tscn").instantiate()
|
||||||
orb.value = 5
|
orb.value = xp_dropped
|
||||||
orb.position = position
|
orb.position = position
|
||||||
get_parent().add_child(orb)
|
get_parent().call_deferred("add_child", orb)
|
||||||
|
|
||||||
|
|
||||||
func _on_animation_player_animation_finished(anim_name: StringName) -> void:
|
func _on_animation_player_animation_finished(anim_name: StringName) -> void:
|
||||||
|
@@ -12,7 +12,7 @@ shader_parameter/flash_amount = 0.0
|
|||||||
size = Vector2(32, 32)
|
size = Vector2(32, 32)
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_satqt"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_satqt"]
|
||||||
radius = 6.0
|
radius = 4.0
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_satqt"]
|
[sub_resource type="Animation" id="Animation_satqt"]
|
||||||
length = 0.001
|
length = 0.001
|
||||||
@@ -60,7 +60,7 @@ _data = {
|
|||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_pkqou"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_pkqou"]
|
||||||
|
|
||||||
[node name="EnemyBase" type="CharacterBody2D"]
|
[node name="EnemyBase" type="CharacterBody2D" groups=["damagable", "enemy"]]
|
||||||
collision_layer = 2
|
collision_layer = 2
|
||||||
collision_mask = 3
|
collision_mask = 3
|
||||||
script = ExtResource("1_qty17")
|
script = ExtResource("1_qty17")
|
||||||
|
1
scenes/enemies/enemy_bat.gd
Normal file
1
scenes/enemies/enemy_bat.gd
Normal file
@@ -0,0 +1 @@
|
|||||||
|
extends EnemyBase
|
1
scenes/enemies/enemy_bat.gd.uid
Normal file
1
scenes/enemies/enemy_bat.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bfhmjpjwdh25o
|
24
scenes/enemies/enemy_bat.tscn
Normal file
24
scenes/enemies/enemy_bat.tscn
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
[gd_scene load_steps=4 format=3 uid="uid://du4t4vydra4rm"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://b7vq8xspnlyeu" path="res://scenes/enemies/enemy_base.tscn" id="1_4r40l"]
|
||||||
|
[ext_resource type="Script" uid="uid://bfhmjpjwdh25o" path="res://scenes/enemies/enemy_bat.gd" id="2_1jj4k"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://chtjfq3bmonhj" path="res://assets/sprites/small_bat.png" id="2_608ut"]
|
||||||
|
|
||||||
|
[node name="EnemyBat" instance=ExtResource("1_4r40l")]
|
||||||
|
collision_mask = 2
|
||||||
|
script = ExtResource("2_1jj4k")
|
||||||
|
move_speed = 175.0
|
||||||
|
max_health = 6.0
|
||||||
|
default_contact_damage = 5.0
|
||||||
|
target_distance = 2.0
|
||||||
|
xp_dropped = 8.0
|
||||||
|
|
||||||
|
[node name="Sprite2D" parent="." index="0"]
|
||||||
|
texture = ExtResource("2_608ut")
|
||||||
|
|
||||||
|
[node name="TargetCast" parent="." index="2"]
|
||||||
|
collision_mask = 0
|
||||||
|
collide_with_bodies = false
|
||||||
|
|
||||||
|
[node name="ShapeCast2D" parent="." index="6"]
|
||||||
|
visible = false
|
@@ -9,6 +9,7 @@ extends Node2D
|
|||||||
@onready var timer: Timer = $Timer
|
@onready var timer: Timer = $Timer
|
||||||
|
|
||||||
const ENEMY_RAT = preload("res://scenes/enemies/enemy_rat.tscn")
|
const ENEMY_RAT = preload("res://scenes/enemies/enemy_rat.tscn")
|
||||||
|
const ENEMY_BAT = preload("res://scenes/enemies/enemy_bat.tscn")
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -21,8 +22,15 @@ func _ready() -> void:
|
|||||||
func _on_timer_timeout() -> void:
|
func _on_timer_timeout() -> void:
|
||||||
var enemies = get_tree().get_nodes_in_group(GlobalConst.GROUP_ENEMY)
|
var enemies = get_tree().get_nodes_in_group(GlobalConst.GROUP_ENEMY)
|
||||||
GlobalConst.sig_debug_stats_set.emit("enemy_count", "%s" % len(enemies))
|
GlobalConst.sig_debug_stats_set.emit("enemy_count", "%s" % len(enemies))
|
||||||
|
var next_enemy: PackedScene
|
||||||
|
match randi() % 2:
|
||||||
|
0:
|
||||||
|
next_enemy = ENEMY_BAT
|
||||||
|
1:
|
||||||
|
next_enemy = ENEMY_RAT
|
||||||
|
|
||||||
if len(enemies) < max_enemies:
|
if len(enemies) < max_enemies:
|
||||||
var new_enemy = ENEMY_RAT.instantiate()
|
var new_enemy = next_enemy.instantiate()
|
||||||
new_enemy.position = _get_spawn_pos()
|
new_enemy.position = _get_spawn_pos()
|
||||||
new_enemy.target = target
|
new_enemy.target = target
|
||||||
add_child(new_enemy)
|
add_child(new_enemy)
|
||||||
|
Reference in New Issue
Block a user