Compare commits
9 Commits
5f9a2fffb9
...
langtons-a
| Author | SHA1 | Date | |
|---|---|---|---|
| b3d488e031 | |||
| 9156f8b979 | |||
| ef75320c81 | |||
| 6ab83e0f34 | |||
| 408ed71722 | |||
| fa6e5d9582 | |||
| bee8cdeeef | |||
| a49f55b694 | |||
| 25ec8d2585 |
2
.gitignore
vendored
@@ -35,6 +35,7 @@
|
|||||||
# ---> Godot
|
# ---> Godot
|
||||||
# Godot 4+ specific ignores
|
# Godot 4+ specific ignores
|
||||||
.godot/
|
.godot/
|
||||||
|
addons/
|
||||||
|
|
||||||
# Godot-specific ignores
|
# Godot-specific ignores
|
||||||
.import/
|
.import/
|
||||||
@@ -49,4 +50,3 @@ export_presets.cfg
|
|||||||
data_*/
|
data_*/
|
||||||
mono_crash.*.json
|
mono_crash.*.json
|
||||||
|
|
||||||
addons/
|
|
||||||
|
|||||||
4
.gitmodules
vendored
@@ -1,4 +0,0 @@
|
|||||||
[submodule "evolve-die-repeat/thirdparty/godot-cpp"]
|
|
||||||
path = evolve-die-repeat/thirdparty/godot-cpp
|
|
||||||
url = https://github.com/godotengine/godot-cpp.git
|
|
||||||
branch = 4.5
|
|
||||||
25
README.md
@@ -1,25 +1,2 @@
|
|||||||
# Evolve Die Repeat TODO: The name is a work in progress
|
# notSpore
|
||||||
|
|
||||||
This is currently quite empty.
|
|
||||||
|
|
||||||
## C++ setup
|
|
||||||
From anywhere in proejct:
|
|
||||||
```bash
|
|
||||||
git submodule update --init --recursive
|
|
||||||
```
|
|
||||||
|
|
||||||
In `thirdparty`:
|
|
||||||
```bash
|
|
||||||
godot --headless --dump-extension-api
|
|
||||||
```
|
|
||||||
|
|
||||||
To compile the cpp extension, run this from `thirdparty/godot-cpp`:
|
|
||||||
```bash
|
|
||||||
scons platform=linux target=template_debug generate_bindings=yes custom_api_file=../extension_api.json -j8
|
|
||||||
```
|
|
||||||
|
|
||||||
Finally, to compile and extern local `.cpp` files, run this from `thirdparty`:
|
|
||||||
```bash
|
|
||||||
scons platform=linux target=template_debug -j8
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
extends Label
|
|
||||||
|
|
||||||
#var counter := Test.new() # C++ class
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
#text += str(counter.get_counter())
|
|
||||||
pass
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
pass
|
|
||||||
#if Input.is_action_just_pressed("ui_accept"):
|
|
||||||
#counter.increment()
|
|
||||||
#var baseText := text
|
|
||||||
#baseText = baseText.left(baseText.length() - str(counter.get_counter()).length())
|
|
||||||
#text = baseText + str(counter.get_counter())
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://ceut2lrvkns75
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
extends Node
|
|
||||||
|
|
||||||
var screen_size = Vector2(1920.0, 1080.0) # Default screen size (this is a float for some reason)
|
|
||||||
var viewport_size
|
|
||||||
@onready var extent: Rect2 = get_viewport().get_visible_rect()
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
viewport_size = get_viewport().get_visible_rect().size
|
|
||||||
|
|
||||||
# TODO: This needs to be called from a script inheriting a CharacterBody2D (e.g. the player)
|
|
||||||
# Alternative would be to pass the player reference to this script (which might be better?)
|
|
||||||
func init_screen_size(x:float, y:float) -> void:
|
|
||||||
screen_size.x = x
|
|
||||||
screen_size.y = y
|
|
||||||
|
|
||||||
# This can take a vector of any size (but should be 2d, other components are unused)
|
|
||||||
func get_boundaried_position(position):
|
|
||||||
## clamp
|
|
||||||
#return position.clamp(Vector2.ZERO, screen_size)
|
|
||||||
|
|
||||||
## periodic
|
|
||||||
position.x = wrapf(position.x, 0, screen_size.x)
|
|
||||||
position.y = wrapf(position.y, 0, screen_size.y)
|
|
||||||
return position
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://vsbibc5fanou
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://uqy71st3rbdr"
|
|
||||||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://icon.svg"
|
|
||||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
svg/scale=1.0
|
|
||||||
editor/scale_with_editor_scale=false
|
|
||||||
editor/convert_colors_with_editor_theme=false
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
extends Control
|
|
||||||
|
|
||||||
|
|
||||||
func _on_play_button_pressed() -> void:
|
|
||||||
get_tree().change_scene_to_file("res://molecular/molecular_stage.tscn")
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://dxc66bci2ivrj
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://drgv154ei1vrl"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dxc66bci2ivrj" path="res://main_menu.gd" id="1_06t4h"]
|
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_rhts7"]
|
|
||||||
font_size = 64
|
|
||||||
|
|
||||||
[node name="MainMenu" type="Control"]
|
|
||||||
layout_mode = 3
|
|
||||||
anchors_preset = 15
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
script = ExtResource("1_06t4h")
|
|
||||||
|
|
||||||
[node name="PlayButton" type="Button" parent="."]
|
|
||||||
layout_mode = 0
|
|
||||||
offset_left = 448.0
|
|
||||||
offset_top = 256.0
|
|
||||||
offset_right = 768.0
|
|
||||||
offset_bottom = 314.0
|
|
||||||
text = "Play"
|
|
||||||
|
|
||||||
[node name="MainMenuText" type="Label" parent="."]
|
|
||||||
layout_mode = 0
|
|
||||||
offset_left = 320.0
|
|
||||||
offset_top = 32.0
|
|
||||||
offset_right = 904.0
|
|
||||||
offset_bottom = 151.0
|
|
||||||
text = "The Main Menu"
|
|
||||||
label_settings = SubResource("LabelSettings_rhts7")
|
|
||||||
horizontal_alignment = 1
|
|
||||||
vertical_alignment = 1
|
|
||||||
|
|
||||||
[connection signal="pressed" from="PlayButton" to="." method="_on_play_button_pressed"]
|
|
||||||
|
Before Width: | Height: | Size: 72 KiB |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://dnlrq8gxiix6"
|
|
||||||
path="res://.godot/imported/bg-far-placeholder.jpg-01304d9c071eca65de57b4adc0479e81.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/background/bg-far-placeholder.jpg"
|
|
||||||
dest_files=["res://.godot/imported/bg-far-placeholder.jpg-01304d9c071eca65de57b4adc0479e81.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 450 B |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://c3cuhrmulyy1s"
|
|
||||||
path="res://.godot/imported/bg-near.png-00577ad303726b65cb5579d462bbdf09.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/background/bg-near.png"
|
|
||||||
dest_files=["res://.godot/imported/bg-near.png-00577ad303726b65cb5579d462bbdf09.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 960 B |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://bto1pnycvianp"
|
|
||||||
path="res://.godot/imported/bg.png-84a173f3a1de937d0ba2884af46d549b.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/background/bg.png"
|
|
||||||
dest_files=["res://.godot/imported/bg.png-84a173f3a1de937d0ba2884af46d549b.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 195 B |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://xaqiha5lh1vt"
|
|
||||||
path="res://.godot/imported/food-left-bolt.png-a2624c23f9c063886727de28bb8d45db.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/food/food-left-bolt.png"
|
|
||||||
dest_files=["res://.godot/imported/food-left-bolt.png-a2624c23f9c063886727de28bb8d45db.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 200 B |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://dj4lyyloj1ke1"
|
|
||||||
path="res://.godot/imported/food-left-bottom-bolt.png-29b52334cce2caefb211e507cb88e1c1.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/food/food-left-bottom-bolt.png"
|
|
||||||
dest_files=["res://.godot/imported/food-left-bottom-bolt.png-29b52334cce2caefb211e507cb88e1c1.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 171 B |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://dcedkos6vgv51"
|
|
||||||
path="res://.godot/imported/food-normal.png-b719473d7bef8a09701e78ab0f73d15b.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/food/food-normal.png"
|
|
||||||
dest_files=["res://.godot/imported/food-normal.png-b719473d7bef8a09701e78ab0f73d15b.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 195 B |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://cbynycukppmup"
|
|
||||||
path="res://.godot/imported/food-right-bottom-bolt.png-8eb8a35372e35c8de0cc432876ae5af5.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/food/food-right-bottom-bolt.png"
|
|
||||||
dest_files=["res://.godot/imported/food-right-bottom-bolt.png-8eb8a35372e35c8de0cc432876ae5af5.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 193 B |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://cend5h3nmvq5l"
|
|
||||||
path="res://.godot/imported/food-right-up-bolt.png-c49edf3849bcaa575384d233173c9498.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/food/food-right-up-bolt.png"
|
|
||||||
dest_files=["res://.godot/imported/food-right-up-bolt.png-c49edf3849bcaa575384d233173c9498.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 887 KiB |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://boknmstvkc0a2"
|
|
||||||
path="res://.godot/imported/player-sprite-placeholder-attacking-crop.png-7a6a3f2b68f208c74f7cac8cb16cfc5e.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/player-sprite-placeholder-attacking-crop.png"
|
|
||||||
dest_files=["res://.godot/imported/player-sprite-placeholder-attacking-crop.png-7a6a3f2b68f208c74f7cac8cb16cfc5e.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 715 KiB |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://cxwvga07sm3yl"
|
|
||||||
path="res://.godot/imported/player-sprite-placeholder-crop.png-f29c3ab24e261ab3d11fb066419e0b90.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/player-sprite-placeholder-crop.png"
|
|
||||||
dest_files=["res://.godot/imported/player-sprite-placeholder-crop.png-f29c3ab24e261ab3d11fb066419e0b90.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 12 KiB |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://dnqwe065lmv0h"
|
|
||||||
path="res://.godot/imported/player-sprite-placeholder.png-6805db1633c9b4853860db48d10b2af1.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/player-sprite-placeholder.png"
|
|
||||||
dest_files=["res://.godot/imported/player-sprite-placeholder.png-6805db1633c9b4853860db48d10b2af1.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 1.6 KiB |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://ch5rddsumyyhm"
|
|
||||||
path="res://.godot/imported/predator-healthy.png-4df87d98e435e1fb3d3b0c12615f1c9b.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/predator/predator-healthy.png"
|
|
||||||
dest_files=["res://.godot/imported/predator-healthy.png-4df87d98e435e1fb3d3b0c12615f1c9b.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 5.0 KiB |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://bhcb5g7g7um8"
|
|
||||||
path="res://.godot/imported/prey-dying-frame0.png-3dfc6299514225b1b5ecd511feec558a.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/prey/prey-dying-frame0.png"
|
|
||||||
dest_files=["res://.godot/imported/prey-dying-frame0.png-3dfc6299514225b1b5ecd511feec558a.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 4.8 KiB |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://bxn11avw7dykl"
|
|
||||||
path="res://.godot/imported/prey-dying-frame1.png-8e3f40908415d07a432ca919106bfe5f.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/prey/prey-dying-frame1.png"
|
|
||||||
dest_files=["res://.godot/imported/prey-dying-frame1.png-8e3f40908415d07a432ca919106bfe5f.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 5.0 KiB |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://ctkehsavw6ghx"
|
|
||||||
path="res://.godot/imported/prey-healthy-frame0.png-fdee965b6537e072b2ba52ebaa00234a.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/prey/prey-healthy-frame0.png"
|
|
||||||
dest_files=["res://.godot/imported/prey-healthy-frame0.png-fdee965b6537e072b2ba52ebaa00234a.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 4.7 KiB |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://uy28y3mkk6nt"
|
|
||||||
path="res://.godot/imported/prey-healthy-frame1.png-d0ef89a578931d076b5469c218505713.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/prey/prey-healthy-frame1.png"
|
|
||||||
dest_files=["res://.godot/imported/prey-healthy-frame1.png-d0ef89a578931d076b5469c218505713.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 6.2 KiB |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://btnyajci8ptb2"
|
|
||||||
path="res://.godot/imported/prey-injured-frame0.png-de2d8ee9861665f890cb3ef99d676bc3.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/prey/prey-injured-frame0.png"
|
|
||||||
dest_files=["res://.godot/imported/prey-injured-frame0.png-de2d8ee9861665f890cb3ef99d676bc3.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
Before Width: | Height: | Size: 5.8 KiB |
@@ -1,40 +0,0 @@
|
|||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://bqll8ge4cr2uf"
|
|
||||||
path="res://.godot/imported/prey-injured-frame1.png-6fdfb22e05a71b519337c6ac43b474b1.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://molecular/assets/prey/prey-injured-frame1.png"
|
|
||||||
dest_files=["res://.godot/imported/prey-injured-frame1.png-6fdfb22e05a71b519337c6ac43b474b1.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
@abstract
|
|
||||||
class_name AbstractFood
|
|
||||||
extends Area2D
|
|
||||||
|
|
||||||
@export var val: int = 10
|
|
||||||
@export var food_name: String = "Food"
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
body_entered.connect(_on_body_entered)
|
|
||||||
|
|
||||||
func _on_body_entered(body: Node2D) -> void:
|
|
||||||
if body.is_in_group("player"):
|
|
||||||
eat(body)
|
|
||||||
|
|
||||||
func eat(consumer: Node2D) -> void:
|
|
||||||
print("Player ate: ", food_name)
|
|
||||||
apply_effect(consumer)
|
|
||||||
queue_free()
|
|
||||||
|
|
||||||
func apply_effect(consumer: Node2D) -> void:
|
|
||||||
pass
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://crujkjpjehrvv
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
extends CharacterBody2D
|
|
||||||
|
|
||||||
@export var attack_duration = 0.4
|
|
||||||
@export var attack_cooldown_duration = 0.6
|
|
||||||
|
|
||||||
@onready var attack_area: Area2D = $AttackArea
|
|
||||||
@onready var attack_timer: Timer = $AttackTimer
|
|
||||||
@onready var attack_cooldown_timer: Timer = $AttackCooldownTimer
|
|
||||||
@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
|
|
||||||
|
|
||||||
@export var speed = 200
|
|
||||||
var damage = 10
|
|
||||||
var can_attack = true
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
var screen_size = get_viewport_rect().size
|
|
||||||
GameManager.init_screen_size(screen_size.x, screen_size.y)
|
|
||||||
|
|
||||||
attack_area.monitoring = false # no collision until attacking
|
|
||||||
attack_timer.wait_time = attack_duration
|
|
||||||
attack_cooldown_timer.wait_time = attack_cooldown_duration
|
|
||||||
|
|
||||||
func _process(delta):
|
|
||||||
velocity = Vector2.ZERO
|
|
||||||
if Input.is_action_pressed("move_right"):
|
|
||||||
velocity.x += 1
|
|
||||||
if Input.is_action_pressed("move_left"):
|
|
||||||
velocity.x -= 1
|
|
||||||
if Input.is_action_pressed("move_down"):
|
|
||||||
velocity.y += 1
|
|
||||||
if Input.is_action_pressed("move_up"):
|
|
||||||
velocity.y -= 1
|
|
||||||
if Input.is_action_pressed("try_attack"):
|
|
||||||
try_attack()
|
|
||||||
|
|
||||||
if not velocity.is_zero_approx():
|
|
||||||
self.rotation = atan2(velocity.y, velocity.x)
|
|
||||||
move_and_collide(speed * velocity * delta)
|
|
||||||
#position += speed * velocity * delta
|
|
||||||
position = GameManager.get_boundaried_position(position)
|
|
||||||
|
|
||||||
func try_attack() -> void:
|
|
||||||
if not can_attack:
|
|
||||||
return
|
|
||||||
attack()
|
|
||||||
|
|
||||||
func attack() -> void:
|
|
||||||
can_attack = false
|
|
||||||
attack_area.monitoring = true
|
|
||||||
attack_timer.start()
|
|
||||||
sprite.play("attacking")
|
|
||||||
|
|
||||||
func _on_attack_timeout() -> void:
|
|
||||||
attack_area.monitoring = false
|
|
||||||
sprite.play("default")
|
|
||||||
attack_cooldown_timer.start()
|
|
||||||
|
|
||||||
func _on_cooldown_timeout() -> void:
|
|
||||||
can_attack = true
|
|
||||||
|
|
||||||
func _on_attack_hit(body: Node2D) -> void:
|
|
||||||
var hit_hittable = false
|
|
||||||
if body.is_in_group("prey") or body.is_in_group("predators"):
|
|
||||||
if body.has_method("handle_damage"):
|
|
||||||
body.handle_damage(damage, self)
|
|
||||||
hit_hittable = true
|
|
||||||
elif body.is_in_group("resources"):
|
|
||||||
pass
|
|
||||||
if hit_hittable:
|
|
||||||
await get_tree().create_timer(0.2).timeout
|
|
||||||
sprite.play("default")
|
|
||||||
# TODO: resource handling logic
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://di7eglnrnqm6i
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
[gd_scene format=3 uid="uid://dxluckxdkpv4f"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://di7eglnrnqm6i" path="res://molecular/molecular_player.gd" id="1_0ix7k"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://boknmstvkc0a2" path="res://molecular/assets/player-sprite-placeholder-attacking-crop.png" id="2_5hxmy"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cxwvga07sm3yl" path="res://molecular/assets/player-sprite-placeholder-crop.png" id="2_en8op"]
|
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id="SpriteFrames_onrkg"]
|
|
||||||
animations = [{
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": ExtResource("2_5hxmy")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"attacking",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 5.0,
|
|
||||||
"texture": ExtResource("2_en8op")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"default",
|
|
||||||
"speed": 5.0
|
|
||||||
}]
|
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_5hxmy"]
|
|
||||||
radius = 378.18
|
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_4flbx"]
|
|
||||||
radius = 191.95984
|
|
||||||
height = 1295.8773
|
|
||||||
|
|
||||||
[node name="player" type="CharacterBody2D" unique_id=2032508208]
|
|
||||||
collision_mask = 6
|
|
||||||
script = ExtResource("1_0ix7k")
|
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=1745800698]
|
|
||||||
visibility_layer = 2
|
|
||||||
scale = Vector2(0.5, 0.5)
|
|
||||||
sprite_frames = SubResource("SpriteFrames_onrkg")
|
|
||||||
|
|
||||||
[node name="AttackArea" type="Area2D" parent="." unique_id=187975387]
|
|
||||||
position = Vector2(0, 56)
|
|
||||||
rotation = -1.5732701
|
|
||||||
collision_mask = 6
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="AttackArea" unique_id=1968501358]
|
|
||||||
position = Vector2(41.029465, 288.86832)
|
|
||||||
shape = SubResource("CircleShape2D_5hxmy")
|
|
||||||
debug_color = Color(0.80813414, 0.3957308, 0.3356335, 0.41960785)
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=2137063701 groups=["player"]]
|
|
||||||
rotation = -1.5732701
|
|
||||||
shape = SubResource("CapsuleShape2D_4flbx")
|
|
||||||
|
|
||||||
[node name="AttackTimer" type="Timer" parent="." unique_id=2057433652]
|
|
||||||
one_shot = true
|
|
||||||
|
|
||||||
[node name="AttackCooldownTimer" type="Timer" parent="." unique_id=1056439284]
|
|
||||||
one_shot = true
|
|
||||||
|
|
||||||
[connection signal="body_entered" from="AttackArea" to="." method="_on_attack_hit"]
|
|
||||||
[connection signal="timeout" from="AttackTimer" to="." method="_on_attack_timeout"]
|
|
||||||
[connection signal="timeout" from="AttackCooldownTimer" to="." method="_on_cooldown_timeout"]
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
extends AbstractPredator2D
|
|
||||||
|
|
||||||
# TODO: attacking logic + behaviour
|
|
||||||
# TODO: movement is buged (seems to not move/teleport somewhat
|
|
||||||
# TODO: mirroring (thought, extracct that to general function/resource?
|
|
||||||
|
|
||||||
@onready var sprite = $AnimatedSprite2D
|
|
||||||
@onready var fsm = $StateMachine
|
|
||||||
|
|
||||||
@export var speed = 0.8
|
|
||||||
var desired_rotation: float = self.rotation
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
health = maxHealth
|
|
||||||
sprite.play("Healthy")
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
# smoothly rotate
|
|
||||||
if self.rotation != self.desired_rotation:
|
|
||||||
self.rotation = lerp_angle(self.rotation, self.desired_rotation, clampf(4 * delta, 0, 1))
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# FIXME: (also goes for prey) this is framerate dependent
|
|
||||||
func move(motion: Vector3, mod: float = 1.0) -> void:
|
|
||||||
move_and_collide(Vector2(motion.x, motion.y).normalized() * self.speed * mod) # Moves along the given vector
|
|
||||||
self.desired_rotation = atan2(motion.y, motion.x)
|
|
||||||
|
|
||||||
# Apply boundary to new position
|
|
||||||
position = GameManager.get_boundaried_position(position)
|
|
||||||
|
|
||||||
|
|
||||||
func _on_sight_body_entered(body: Node2D) -> void:
|
|
||||||
if body.is_in_group("prey") or (health < maxHealth and body.is_in_group("player")):
|
|
||||||
fsm.transition_to_next_state(fsm.States.HUNTING, {"target": body})
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://d07cjelbqbiug
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
[gd_scene format=3 uid="uid://s4s66oaexava"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://d07cjelbqbiug" path="res://molecular/predator/hammerhead_predator.gd" id="1_xp037"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://ch5rddsumyyhm" path="res://molecular/assets/predator/predator-healthy.png" id="2_34kwa"]
|
|
||||||
[ext_resource type="Script" uid="uid://cygrmt03sx0k1" path="res://molecular/predator/state_machine.gd" id="3_xp037"]
|
|
||||||
[ext_resource type="Script" uid="uid://xbiqj7ubmj7d" path="res://molecular/prey/state_idle.gd" id="4_8a23j"]
|
|
||||||
[ext_resource type="Script" uid="uid://ubcu8fdfxxj1" path="res://molecular/prey/state_random_movement.gd" id="5_6rsu5"]
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_8a23j"]
|
|
||||||
atlas = ExtResource("2_34kwa")
|
|
||||||
region = Rect2(0, 0, 64, 64)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6rsu5"]
|
|
||||||
atlas = ExtResource("2_34kwa")
|
|
||||||
region = Rect2(64, 0, 64, 64)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0ts4d"]
|
|
||||||
atlas = ExtResource("2_34kwa")
|
|
||||||
region = Rect2(128, 0, 64, 64)
|
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id="SpriteFrames_shhro"]
|
|
||||||
animations = [{
|
|
||||||
"frames": [{
|
|
||||||
"duration": 3.0,
|
|
||||||
"texture": SubResource("AtlasTexture_8a23j")
|
|
||||||
}, {
|
|
||||||
"duration": 2.0,
|
|
||||||
"texture": SubResource("AtlasTexture_6rsu5")
|
|
||||||
}, {
|
|
||||||
"duration": 4.0,
|
|
||||||
"texture": SubResource("AtlasTexture_0ts4d")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"Healthy",
|
|
||||||
"speed": 5.0
|
|
||||||
}]
|
|
||||||
|
|
||||||
[node name="HammerheadPredator" type="CharacterBody2D" unique_id=678504815 groups=["predator"]]
|
|
||||||
scale = Vector2(0.3, 0.3)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 3
|
|
||||||
motion_mode = 1
|
|
||||||
script = ExtResource("1_xp037")
|
|
||||||
maxHealth = 50
|
|
||||||
metadata/_custom_type_script = "uid://dgfimmq53whll"
|
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=410999609]
|
|
||||||
sprite_frames = SubResource("SpriteFrames_shhro")
|
|
||||||
animation = &"Healthy"
|
|
||||||
|
|
||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="." unique_id=1596156928]
|
|
||||||
light_mask = 4
|
|
||||||
visibility_layer = 4
|
|
||||||
position = Vector2(0.11167908, 1.1167793)
|
|
||||||
polygon = PackedVector2Array(-22.184862, -27.994831, 23.481365, -27.21198, 13.82622, 25.891317, -6.005971, 25.891317)
|
|
||||||
|
|
||||||
[node name="StateMachine" type="Node" parent="." unique_id=1857729810 node_paths=PackedStringArray("initial_state")]
|
|
||||||
script = ExtResource("3_xp037")
|
|
||||||
initial_state = NodePath("Idle")
|
|
||||||
metadata/_custom_type_script = "uid://ck7k8ht54snsy"
|
|
||||||
|
|
||||||
[node name="Idle" type="Node" parent="StateMachine" unique_id=265876039]
|
|
||||||
script = ExtResource("4_8a23j")
|
|
||||||
metadata/_custom_type_script = "uid://co2xp7gauamql"
|
|
||||||
|
|
||||||
[node name="Timer" type="Timer" parent="StateMachine/Idle" unique_id=1870665609]
|
|
||||||
one_shot = true
|
|
||||||
|
|
||||||
[node name="RandomMovement" type="Node" parent="StateMachine" unique_id=105315122]
|
|
||||||
script = ExtResource("5_6rsu5")
|
|
||||||
metadata/_custom_type_script = "uid://co2xp7gauamql"
|
|
||||||
|
|
||||||
[node name="Timer" type="Timer" parent="StateMachine/RandomMovement" unique_id=447822526]
|
|
||||||
one_shot = true
|
|
||||||
|
|
||||||
[node name="Sight" type="Area2D" parent="." unique_id=1608385873]
|
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 7
|
|
||||||
|
|
||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Sight" unique_id=1707240701]
|
|
||||||
light_mask = 4
|
|
||||||
visibility_layer = 4
|
|
||||||
polygon = PackedVector2Array(-27.769547, -29.426758, 31.88504, -29.184647, 12.700996, 28.7294, 56.058624, 148.93633, 22.979004, 163.77974, -19.854843, 161.65926, -53.782654, 143.84715, -8.333115, 30.157196)
|
|
||||||
|
|
||||||
[connection signal="body_entered" from="Sight" to="." method="_on_sight_body_entered"]
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
extends StateMachine
|
|
||||||
|
|
||||||
enum States {IDLE, RANDOMMOVEMENT, FEEDING, FLEEING, HUNTING}
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
super()
|
|
||||||
await owner.ready
|
|
||||||
|
|
||||||
|
|
||||||
func transition_to_next_state(target: int, data: Dictionary = {}) -> void:
|
|
||||||
match target:
|
|
||||||
States.IDLE: _transition_to_next_state("Idle", data)
|
|
||||||
States.RANDOMMOVEMENT: _transition_to_next_state("RandomMovement", data)
|
|
||||||
States.FEEDING: _transition_to_next_state("Feeding", data)
|
|
||||||
States.FLEEING: _transition_to_next_state("Fleeing", data)
|
|
||||||
States.HUNTING: _transition_to_next_state("Hunting", data)
|
|
||||||
_: push_error("Trying to transition to unknown state {target}")
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://cygrmt03sx0k1
|
|
||||||
@@ -1,153 +0,0 @@
|
|||||||
extends AbstractPrey2D
|
|
||||||
|
|
||||||
@onready var sprite = get_node("AnimatedSprite2D")
|
|
||||||
@onready var fsm = $StateMachine
|
|
||||||
|
|
||||||
@export var speed = 0.5
|
|
||||||
var desired_rotation: float = self.rotation
|
|
||||||
|
|
||||||
# Mirrored sprites for periodic boundary
|
|
||||||
var mirrorSprite1: Node2D
|
|
||||||
var mirrorSprite2: Node2D
|
|
||||||
var mirrorSprite3: Node2D
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
health = maxHealth
|
|
||||||
sprite.play("Healthy")
|
|
||||||
|
|
||||||
mirrorSprite1 = sprite.duplicate()
|
|
||||||
sprite.play("Healthy")
|
|
||||||
|
|
||||||
mirrorSprite2 = sprite.duplicate()
|
|
||||||
sprite.play("Healthy")
|
|
||||||
|
|
||||||
mirrorSprite3 = sprite.duplicate()
|
|
||||||
sprite.play("Healthy")
|
|
||||||
|
|
||||||
add_child(mirrorSprite1)
|
|
||||||
add_child(mirrorSprite2)
|
|
||||||
add_child(mirrorSprite3)
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
# smoothly rotate
|
|
||||||
if self.rotation != self.desired_rotation:
|
|
||||||
self.rotation = lerp_angle(self.rotation, self.desired_rotation, clampf(4 * delta, 0, 1))
|
|
||||||
|
|
||||||
# Boundary mirroring
|
|
||||||
_handle_wrapping()
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
func move(motion: Vector3, mod: float = 1.0) -> void:
|
|
||||||
move_and_collide(Vector2(motion.x, motion.y).normalized() * self.speed * mod) # Moves along the given vector
|
|
||||||
self.desired_rotation = atan2(motion.y, motion.x)
|
|
||||||
|
|
||||||
# Apply boundary to new position
|
|
||||||
position = GameManager.get_boundaried_position(position)
|
|
||||||
|
|
||||||
func handle_damage(dmg: int, src: Node) -> void:
|
|
||||||
health = max(0, health-dmg)
|
|
||||||
if health == 0:
|
|
||||||
die()
|
|
||||||
if health < maxHealth:
|
|
||||||
become_injured()
|
|
||||||
fsm.transition_to_next_state(fsm.States.FLEEING, {"threat": src})
|
|
||||||
|
|
||||||
func die() -> void:
|
|
||||||
sprite.play("Dying")
|
|
||||||
mirrorSprite1.play("Dying")
|
|
||||||
mirrorSprite2.play("Dying")
|
|
||||||
mirrorSprite3.play("Dying")
|
|
||||||
super.die()
|
|
||||||
|
|
||||||
func become_injured() -> void:
|
|
||||||
sprite.play("Injured")
|
|
||||||
mirrorSprite1.play("Injured")
|
|
||||||
mirrorSprite2.play("Injured")
|
|
||||||
mirrorSprite3.play("Injured")
|
|
||||||
|
|
||||||
func _on_sight_body_entered(body: Node2D) -> void:
|
|
||||||
if body.is_in_group("predator") or (health < maxHealth and body.is_in_group("player")):
|
|
||||||
fsm.transition_to_next_state(fsm.States.FLEEING, {"threat": body})
|
|
||||||
|
|
||||||
|
|
||||||
# Mirroring table:
|
|
||||||
# |---|---|---|---|
|
|
||||||
# | 4 | 3 | 4 | 3 |
|
|
||||||
# |---|===|===|---|
|
|
||||||
# | 1 ǁ 2 | 1 ǁ 2 |
|
|
||||||
# |---ǁ---|---ǁ---|
|
|
||||||
# | 4 ǁ 3 | 4 ǁ 3 |
|
|
||||||
# |---|===|===|---|
|
|
||||||
# | 1 | 2 | 1 | 2 |
|
|
||||||
# |---|---|---|---|
|
|
||||||
# If less than viewport size away from an edge, mirror over that edge (for seamless boundary)
|
|
||||||
# NOTE: For this to look correctly the camera size should be smaller than half the screen port (in
|
|
||||||
# any one dimension. Ideally, the difference between camera size and half the screen port is
|
|
||||||
# at least the size of the prey sprite)
|
|
||||||
func _handle_wrapping():
|
|
||||||
mirrorSprite1.visible = false
|
|
||||||
mirrorSprite2.visible = false
|
|
||||||
mirrorSprite3.visible = false
|
|
||||||
|
|
||||||
# TODO: Assume viewport size << screen size and only draw according to GameManager.viewport_size
|
|
||||||
# Find corresponding section of the screen
|
|
||||||
if position.x < GameManager.screen_size.x/2 and position.y < GameManager.screen_size.y/2:
|
|
||||||
# 2
|
|
||||||
mirrorSprite1.visible = true
|
|
||||||
mirrorSprite2.visible = true
|
|
||||||
mirrorSprite3.visible = true
|
|
||||||
|
|
||||||
# Right
|
|
||||||
mirrorSprite1.global_position = global_position + Vector2(GameManager.screen_size.x, 0)
|
|
||||||
# Diag
|
|
||||||
mirrorSprite3.global_position = global_position + Vector2(GameManager.screen_size.x, GameManager.screen_size.y)
|
|
||||||
# Bottom
|
|
||||||
mirrorSprite2.global_position = global_position + Vector2(0, GameManager.screen_size.y)
|
|
||||||
|
|
||||||
|
|
||||||
elif position.x < GameManager.screen_size.x/2:
|
|
||||||
# 3
|
|
||||||
mirrorSprite1.visible = true
|
|
||||||
mirrorSprite2.visible = true
|
|
||||||
mirrorSprite3.visible = true
|
|
||||||
|
|
||||||
# Top
|
|
||||||
mirrorSprite1.global_position = global_position + Vector2(0, - GameManager.screen_size.y)
|
|
||||||
# Diag
|
|
||||||
mirrorSprite2.global_position = global_position + Vector2(GameManager.screen_size.x, - GameManager.screen_size.y)
|
|
||||||
# Right
|
|
||||||
mirrorSprite3.global_position = global_position + Vector2(GameManager.screen_size.x, 0)
|
|
||||||
|
|
||||||
|
|
||||||
elif position.y < GameManager.screen_size.y/2:
|
|
||||||
# 1
|
|
||||||
mirrorSprite1.visible = true
|
|
||||||
mirrorSprite2.visible = true
|
|
||||||
mirrorSprite3.visible = true
|
|
||||||
|
|
||||||
# Left
|
|
||||||
mirrorSprite1.global_position = global_position + Vector2(- GameManager.screen_size.x, 0)
|
|
||||||
# Bottom
|
|
||||||
mirrorSprite2.global_position = global_position + Vector2(0, GameManager.screen_size.y)
|
|
||||||
# Diag
|
|
||||||
mirrorSprite3.global_position = global_position + Vector2(- GameManager.screen_size.x, GameManager.screen_size.y)
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
|
||||||
# 4
|
|
||||||
mirrorSprite1.visible = true
|
|
||||||
mirrorSprite2.visible = true
|
|
||||||
mirrorSprite3.visible = true
|
|
||||||
|
|
||||||
# Left
|
|
||||||
mirrorSprite1.global_position = global_position + Vector2(- GameManager.screen_size.x, 0)
|
|
||||||
# Diag
|
|
||||||
mirrorSprite2.global_position = global_position + Vector2(- GameManager.screen_size.x, - GameManager.screen_size.y)
|
|
||||||
# Top
|
|
||||||
mirrorSprite3.global_position = global_position + Vector2(0, - GameManager.screen_size.y)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://bgossk6xo31gi
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
[gd_scene format=3 uid="uid://c3iw2v3x6ngrb"]
|
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bvsdg1v3ksixy" path="res://shared/npc/prey2D.tscn" id="1_qvulj"]
|
|
||||||
[ext_resource type="Script" uid="uid://bgossk6xo31gi" path="res://molecular/prey/nucleotide_prey.gd" id="2_0227s"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://bhcb5g7g7um8" path="res://molecular/assets/prey/prey-dying-frame0.png" id="2_lkj7f"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://bxn11avw7dykl" path="res://molecular/assets/prey/prey-dying-frame1.png" id="3_svqyr"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://ctkehsavw6ghx" path="res://molecular/assets/prey/prey-healthy-frame0.png" id="4_ee1gb"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://uy28y3mkk6nt" path="res://molecular/assets/prey/prey-healthy-frame1.png" id="5_ae5nf"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://btnyajci8ptb2" path="res://molecular/assets/prey/prey-injured-frame0.png" id="6_0f87h"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://bqll8ge4cr2uf" path="res://molecular/assets/prey/prey-injured-frame1.png" id="7_w7inl"]
|
|
||||||
[ext_resource type="Script" uid="uid://0vwv2nt16gpv" path="res://molecular/prey/state_machine.gd" id="9_xxtgy"]
|
|
||||||
[ext_resource type="Script" uid="uid://ubcu8fdfxxj1" path="res://molecular/prey/state_random_movement.gd" id="10_rgguv"]
|
|
||||||
[ext_resource type="Script" uid="uid://xbiqj7ubmj7d" path="res://molecular/prey/state_idle.gd" id="12_ubfhk"]
|
|
||||||
[ext_resource type="Script" uid="uid://dlw7inlh6asvu" path="res://molecular/prey/state_fleeing.gd" id="12_xxtgy"]
|
|
||||||
|
|
||||||
[sub_resource type="SpriteFrames" id="SpriteFrames_66x8p"]
|
|
||||||
animations = [{
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": ExtResource("2_lkj7f")
|
|
||||||
}, {
|
|
||||||
"duration": 20.0,
|
|
||||||
"texture": ExtResource("3_svqyr")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"Dying",
|
|
||||||
"speed": 1.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": ExtResource("4_ee1gb")
|
|
||||||
}, {
|
|
||||||
"duration": 20.0,
|
|
||||||
"texture": ExtResource("5_ae5nf")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"Healthy",
|
|
||||||
"speed": 1.0
|
|
||||||
}, {
|
|
||||||
"frames": [{
|
|
||||||
"duration": 1.0,
|
|
||||||
"texture": ExtResource("6_0f87h")
|
|
||||||
}, {
|
|
||||||
"duration": 20.0,
|
|
||||||
"texture": ExtResource("7_w7inl")
|
|
||||||
}],
|
|
||||||
"loop": true,
|
|
||||||
"name": &"Injured",
|
|
||||||
"speed": 1.0
|
|
||||||
}]
|
|
||||||
|
|
||||||
[node name="NucleotidePrey" unique_id=740525631 groups=["prey"] instance=ExtResource("1_qvulj")]
|
|
||||||
collision_layer = 2
|
|
||||||
collision_mask = 5
|
|
||||||
motion_mode = 1
|
|
||||||
script = ExtResource("2_0227s")
|
|
||||||
speed = 0.5
|
|
||||||
maxHealth = 20
|
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0" unique_id=788182944]
|
|
||||||
rotation = 1.5707964
|
|
||||||
scale = Vector2(0.1, 0.1)
|
|
||||||
sprite_frames = SubResource("SpriteFrames_66x8p")
|
|
||||||
animation = &"Healthy"
|
|
||||||
|
|
||||||
[node name="CollisionPolygon2D" parent="." index="1"]
|
|
||||||
light_mask = 2
|
|
||||||
visibility_layer = 2
|
|
||||||
position = Vector2(6.929083, 3.0664783)
|
|
||||||
rotation = 0.474154
|
|
||||||
|
|
||||||
[node name="StateMachine" type="Node" parent="." index="2" unique_id=445822474 node_paths=PackedStringArray("initial_state")]
|
|
||||||
script = ExtResource("9_xxtgy")
|
|
||||||
initial_state = NodePath("Idle")
|
|
||||||
|
|
||||||
[node name="RandomMovement" type="Node" parent="StateMachine" index="0" unique_id=1422146232]
|
|
||||||
script = ExtResource("10_rgguv")
|
|
||||||
|
|
||||||
[node name="Timer" type="Timer" parent="StateMachine/RandomMovement" index="0" unique_id=593528934]
|
|
||||||
one_shot = true
|
|
||||||
|
|
||||||
[node name="Fleeing" type="Node" parent="StateMachine" index="1" unique_id=1125485674]
|
|
||||||
script = ExtResource("12_xxtgy")
|
|
||||||
|
|
||||||
[node name="Idle" type="Node" parent="StateMachine" index="2" unique_id=1424222731]
|
|
||||||
script = ExtResource("12_ubfhk")
|
|
||||||
|
|
||||||
[node name="Timer" type="Timer" parent="StateMachine/Idle" index="0" unique_id=1050348256]
|
|
||||||
one_shot = true
|
|
||||||
|
|
||||||
[node name="Sight" type="Area2D" parent="." index="3" unique_id=1773478588]
|
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 7
|
|
||||||
|
|
||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Sight" index="0" unique_id=338757598]
|
|
||||||
light_mask = 2
|
|
||||||
visibility_layer = 2
|
|
||||||
rotation = 1.5707964
|
|
||||||
polygon = PackedVector2Array(3.8686981, -6.2705374, 7.0000973, -0.08602524, 3.5555592, 5.6287766, -3.0986624, 5.589636, -6.1517763, 0.031402588, -2.942093, -6.0748243, -29.993027, -74.37026, -11.10141, -83.6233, 9.332382, -84.00884, 35.163773, -77.06906)
|
|
||||||
|
|
||||||
[connection signal="timeout" from="StateMachine/RandomMovement/Timer" to="StateMachine/RandomMovement" method="_on_timer_timeout"]
|
|
||||||
[connection signal="timeout" from="StateMachine/Idle/Timer" to="StateMachine/Idle" method="_on_timer_timeout"]
|
|
||||||
[connection signal="body_entered" from="Sight" to="." method="_on_sight_body_entered"]
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
extends State
|
|
||||||
|
|
||||||
var threat: Node2D
|
|
||||||
var threshold: float = 100
|
|
||||||
|
|
||||||
func enter(previous_state_path: String, data := {}) -> void:
|
|
||||||
if data.has("threat"):
|
|
||||||
threat = data["threat"]
|
|
||||||
else:
|
|
||||||
# default behaviour; do nothing
|
|
||||||
threat = owner
|
|
||||||
|
|
||||||
func physics_update(_delta: float) -> void:
|
|
||||||
if owner.position.distance_to(threat.position) > threshold or threat == owner:
|
|
||||||
finished.emit(owner.fsm.States.IDLE, {})
|
|
||||||
return
|
|
||||||
owner.move(flee_from(threat.position))
|
|
||||||
|
|
||||||
func flee_from(pos: Vector2) -> Vector3:
|
|
||||||
var diff = threat.position - owner.position
|
|
||||||
diff = diff.normalized() * -1
|
|
||||||
return Vector3(diff.x, diff.y ,0)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://dlw7inlh6asvu
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
extends State
|
|
||||||
|
|
||||||
@onready var timer = $Timer
|
|
||||||
var dir = Vector3(1, 1, 0)
|
|
||||||
var threshold = 1
|
|
||||||
var max = 30
|
|
||||||
|
|
||||||
func enter(previous_state_path: String, data := {}) -> void:
|
|
||||||
timer.start((float)(randi() % 5)/5)
|
|
||||||
|
|
||||||
func physics_update(_delta: float) -> void:
|
|
||||||
if threshold == max:
|
|
||||||
owner.move(_delta * Vector3(randfn(0, 1), randfn(0, 1), 0), 4)
|
|
||||||
threshold = 1
|
|
||||||
else:
|
|
||||||
threshold += 1
|
|
||||||
|
|
||||||
func _on_timer_timeout() -> void:
|
|
||||||
if (randi() % 4 != 0):
|
|
||||||
finished.emit(owner.fsm.States.RANDOMMOVEMENT, {})
|
|
||||||
else:
|
|
||||||
finished.emit(owner.fsm.States.RANDOMMOVEMENT, {})
|
|
||||||
# finished.emit(owner.fsm.States.IDLE, {})
|
|
||||||
|
|
||||||
func exit() -> void:
|
|
||||||
timer.stop()
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://xbiqj7ubmj7d
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
extends StateMachine
|
|
||||||
|
|
||||||
enum States {IDLE, RANDOMMOVEMENT, FEEDING, FLEEING}
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
super()
|
|
||||||
await owner.ready
|
|
||||||
|
|
||||||
|
|
||||||
func transition_to_next_state(target: int, data: Dictionary = {}) -> void:
|
|
||||||
match target:
|
|
||||||
States.IDLE: _transition_to_next_state("Idle", data)
|
|
||||||
States.RANDOMMOVEMENT: _transition_to_next_state("RandomMovement", data)
|
|
||||||
States.FEEDING: _transition_to_next_state("Feeding", data)
|
|
||||||
States.FLEEING: _transition_to_next_state("Fleeing", data)
|
|
||||||
_: push_error("Trying to transition to unknown state {target}")
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://0vwv2nt16gpv
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
extends State
|
|
||||||
|
|
||||||
@onready var timer = $Timer
|
|
||||||
var dir: Vector3 = Vector3(0,0,0);
|
|
||||||
|
|
||||||
func enter(previous_state_path: String, data := {}) -> void:
|
|
||||||
timer.start((float)(randi() % 10)/20)
|
|
||||||
dir = calc_dir(randi() % 360)
|
|
||||||
|
|
||||||
func physics_update(_delta: float) -> void:
|
|
||||||
owner.move(dir)
|
|
||||||
|
|
||||||
func calc_dir(angle: float) -> Vector3:
|
|
||||||
return Vector3(cos(angle), sin(angle), 0)
|
|
||||||
|
|
||||||
func _on_timer_timeout() -> void:
|
|
||||||
finished.emit(owner.fsm.States.IDLE, {})
|
|
||||||
|
|
||||||
func exit() -> void:
|
|
||||||
timer.stop()
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://ubcu8fdfxxj1
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
extends SpawnManager2D
|
|
||||||
|
|
||||||
#@export var cam: Camera2D
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
spawnRange = GameManager.extent
|
|
||||||
#spawnRange = cam.get_viewport_rect()
|
|
||||||
call_deferred("_spawn_minimum")
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
pass
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://umx4w11edif
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
; Engine configuration file.
|
|
||||||
; It's best edited using the editor UI and not directly,
|
|
||||||
; since the parameters that go here are not all obvious.
|
|
||||||
;
|
|
||||||
; Format:
|
|
||||||
; [section] ; section goes between []
|
|
||||||
; param=value ; assign values to parameters
|
|
||||||
|
|
||||||
config_version=5
|
|
||||||
|
|
||||||
[animation]
|
|
||||||
|
|
||||||
compatibility/default_parent_skeleton_in_mesh_instance_3d=true
|
|
||||||
|
|
||||||
[application]
|
|
||||||
|
|
||||||
config/name="EvolveDieRepeat"
|
|
||||||
run/main_scene="uid://drgv154ei1vrl"
|
|
||||||
config/features=PackedStringArray("4.6", "Forward Plus")
|
|
||||||
config/icon="res://icon.svg"
|
|
||||||
|
|
||||||
[autoload]
|
|
||||||
|
|
||||||
GameManager="*res://game_manager.gd"
|
|
||||||
|
|
||||||
[editor_plugins]
|
|
||||||
|
|
||||||
enabled=PackedStringArray("res://addons/godot-neovim/plugin.cfg")
|
|
||||||
|
|
||||||
[global_group]
|
|
||||||
|
|
||||||
player="All scenes that constitute players should be added here."
|
|
||||||
prey="any passive killable entities belong in this group"
|
|
||||||
predator=""
|
|
||||||
|
|
||||||
[input]
|
|
||||||
|
|
||||||
move_right={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
move_left={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
move_up={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
move_down={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
try_attack={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
[layer_names]
|
|
||||||
|
|
||||||
2d_render/layer_1="Player"
|
|
||||||
2d_render/layer_2="Prey"
|
|
||||||
2d_physics/layer_1="Player"
|
|
||||||
2d_physics/layer_2="Prey"
|
|
||||||
2d_physics/layer_3="Predator"
|
|
||||||
|
|
||||||
[rendering]
|
|
||||||
|
|
||||||
textures/canvas_textures/default_texture_filter=0
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
extends CharacterBody2D
|
|
||||||
class_name NPC2D
|
|
||||||
|
|
||||||
@export var maxHealth: int = 0
|
|
||||||
var health: int = maxHealth
|
|
||||||
|
|
||||||
signal died
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
spawn()
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
func spawn() -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
func take_damage(dmg: int) -> void:
|
|
||||||
self.health -= dmg;
|
|
||||||
if self.health < 0:
|
|
||||||
self.die()
|
|
||||||
|
|
||||||
func die() -> void:
|
|
||||||
died.emit()
|
|
||||||
queue_free()
|
|
||||||
# TODO: should associate this class with a loot table (or equivalent), and can then implement logic for dying in parent class here.
|
|
||||||
|
|
||||||
func move(destination: Vector3) -> void:
|
|
||||||
push_error("Function move() not implemented.")
|
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://biu3sctw15ga
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="uid://biup0eej85fq2"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://biu3sctw15ga" path="res://shared/npc/npc2D.gd" id="1_ucjfp"]
|
|
||||||
|
|
||||||
[node name="NPC" type="CharacterBody2D"]
|
|
||||||
script = ExtResource("1_ucjfp")
|
|
||||||
|
|
||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
|
||||||
position = Vector2(7.215866, -0.5034294)
|
|
||||||
polygon = PackedVector2Array(-8.831272, -2.3390446, -5.7760534, -2.3993049, -4.0230684, 0.41277456, -5.8890305, 2.9948444, -8.862037, 2.9326901, -10.268076, 0.28495264)
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
extends NPC2D
|
|
||||||
class_name AbstractPredator2D
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
func attack(target) -> void:
|
|
||||||
push_error("Function attack() not implemented.")
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://dgfimmq53whll
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://b7wqd5owafn6g"]
|
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://biup0eej85fq2" path="res://shared/npc/npc2D.tscn" id="1_4llks"]
|
|
||||||
[ext_resource type="Script" uid="uid://dgfimmq53whll" path="res://shared/npc/predator2D.gd" id="2_rj1ok"]
|
|
||||||
|
|
||||||
[node name="AbstractPredator" instance=ExtResource("1_4llks")]
|
|
||||||
script = ExtResource("2_rj1ok")
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
extends NPC2D
|
|
||||||
class_name AbstractPrey2D
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://76jxpubyd8wp
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://bvsdg1v3ksixy"]
|
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://biup0eej85fq2" path="res://shared/npc/npc2D.tscn" id="1_2m1le"]
|
|
||||||
[ext_resource type="Script" uid="uid://76jxpubyd8wp" path="res://shared/npc/prey2D.gd" id="2_dny00"]
|
|
||||||
|
|
||||||
[node name="AbstractPrey" instance=ExtResource("1_2m1le")]
|
|
||||||
script = ExtResource("2_dny00")
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
[gd_scene load_steps=2 format=3 uid="uid://dje58m1cj34gn"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://coetidfssb80w" path="res://shared/npc/spawn_manager_2d.gd" id="1_624qc"]
|
|
||||||
|
|
||||||
[node name="SpawnManager2d" type="Node"]
|
|
||||||
script = ExtResource("1_624qc")
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
extends Node
|
|
||||||
class_name SpawnManager2D
|
|
||||||
|
|
||||||
@export var scene: PackedScene
|
|
||||||
@export var minCount = 1
|
|
||||||
@export var maxCount = 2
|
|
||||||
@export var spawnRange: Rect2 = Rect2(0, 0, 0, 0)
|
|
||||||
var _currentCount = 0
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
_spawn_minimum()
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
func _spawn_minimum() -> void:
|
|
||||||
while _currentCount < minCount and _currentCount < maxCount:
|
|
||||||
_spawn_random()
|
|
||||||
|
|
||||||
func _random_pos() -> Vector2:
|
|
||||||
return Vector2(randf_range(spawnRange.position[0], spawnRange.size[0]), randf_range(spawnRange.position[1], spawnRange.size[1]))
|
|
||||||
|
|
||||||
func _spawn_random() -> void:
|
|
||||||
var pos = _random_pos()
|
|
||||||
_spawn_creature(pos)
|
|
||||||
_currentCount += 1
|
|
||||||
|
|
||||||
func _spawn_creature(position: Vector2) -> void:
|
|
||||||
var instance = scene.instantiate()
|
|
||||||
instance.position = position
|
|
||||||
add_child(instance)
|
|
||||||
if instance.has_signal("died"):
|
|
||||||
instance.died.connect(_on_entity_died)
|
|
||||||
|
|
||||||
func _on_entity_died() -> void:
|
|
||||||
_currentCount = max(0, _currentCount-1)
|
|
||||||
call_deferred("_spawn_minimum")
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://coetidfssb80w
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
class_name State extends Node
|
|
||||||
|
|
||||||
# Emits on state completion
|
|
||||||
signal finished(next_state_path: String, data: Dictionary)
|
|
||||||
|
|
||||||
# Called by StateMachine on unhandled input
|
|
||||||
func handle_input(_event: InputEvent) -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Main update loop
|
|
||||||
func update(_delta: float) -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Physics update loop
|
|
||||||
func physics_update(_delta: float) -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Called by StateMachine on state change. Data contains arbitrary data to initialize state.
|
|
||||||
func enter(previous_state_path: String, data := {}) -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Called by StateMachine before state change. Should be used for cleanup.
|
|
||||||
func exit() -> void:
|
|
||||||
pass
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://co2xp7gauamql
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
class_name StateMachine extends Node
|
|
||||||
|
|
||||||
@export var initial_state: State = null
|
|
||||||
|
|
||||||
# use first child as 'active' state
|
|
||||||
@onready var state: State = (func get_initial_state() -> State:
|
|
||||||
return initial_state if initial_state != null else get_child(0)
|
|
||||||
).call()
|
|
||||||
|
|
||||||
# Connect states on ready, then wait.
|
|
||||||
func _ready() -> void:
|
|
||||||
for node: State in find_children("*", "State"):
|
|
||||||
node.finished.connect(transition_to_next_state)
|
|
||||||
|
|
||||||
await owner.ready
|
|
||||||
state.enter("")
|
|
||||||
|
|
||||||
# pass unhandled input to state.
|
|
||||||
func _unhandled_input(event: InputEvent) -> void:
|
|
||||||
state.handle_input(event)
|
|
||||||
|
|
||||||
# Pass process tick to state.
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
state.update(delta)
|
|
||||||
|
|
||||||
# Pass physics tick to state.
|
|
||||||
func _physics_process(delta: float) -> void:
|
|
||||||
state.physics_update(delta)
|
|
||||||
|
|
||||||
# Transition to next state
|
|
||||||
func _transition_to_next_state(target_path: String, data: Dictionary = {}) -> void:
|
|
||||||
if not has_node(target_path):
|
|
||||||
printerr(owner.name + ": Trying to transition to state " + target_path + ", which does not exist.")
|
|
||||||
return
|
|
||||||
|
|
||||||
var previous_state_path := state.name
|
|
||||||
state.exit()
|
|
||||||
state = get_node(target_path)
|
|
||||||
state.enter(previous_state_path, data)
|
|
||||||
|
|
||||||
func transition_to_next_state(target: int, data: Dictionary = {}) -> void:
|
|
||||||
push_error("Child FSM failed to implement transition function.")
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://ck7k8ht54snsy
|
|
||||||
8
evolve-die-repeat/thirdparty/.gitignore
vendored
@@ -1,8 +0,0 @@
|
|||||||
bin
|
|
||||||
*.uid
|
|
||||||
*sconsign.dblite
|
|
||||||
**.os
|
|
||||||
|
|
||||||
godot-cpp/bin/
|
|
||||||
*.o
|
|
||||||
*.so
|
|
||||||
31
evolve-die-repeat/thirdparty/SConstruct
vendored
@@ -1,31 +0,0 @@
|
|||||||
import os
|
|
||||||
from SCons.Script import DefaultEnvironment, ARGUMENTS, Glob, Dir
|
|
||||||
|
|
||||||
env = DefaultEnvironment()
|
|
||||||
platform = ARGUMENTS.get("platform", "linux")
|
|
||||||
target = ARGUMENTS.get("target", "template_debug") # or template_release
|
|
||||||
arch = ARGUMENTS.get("arch", "x86_64")
|
|
||||||
|
|
||||||
HERE = Dir(".").abspath
|
|
||||||
GODOTCPP = os.path.join(HERE, "godot-cpp")
|
|
||||||
|
|
||||||
inc_paths = [
|
|
||||||
os.path.join(GODOTCPP, "include"),
|
|
||||||
os.path.join(GODOTCPP, "gen", "include"),
|
|
||||||
]
|
|
||||||
for extra in ("godot-headers", "gdextension"):
|
|
||||||
p = os.path.join(GODOTCPP, extra)
|
|
||||||
if os.path.isdir(p):
|
|
||||||
inc_paths.append(p)
|
|
||||||
|
|
||||||
env.Append(CPPPATH=inc_paths)
|
|
||||||
env.Append(LIBPATH=[os.path.join(GODOTCPP, "bin")])
|
|
||||||
env.Append(CXXFLAGS=["-std=c++17", "-fPIC"])
|
|
||||||
|
|
||||||
env.Append(LIBS=[f"godot-cpp.{platform}.{target}.{arch}"])
|
|
||||||
|
|
||||||
outdir = os.path.join(HERE, "bin")
|
|
||||||
os.makedirs(outdir, exist_ok=True)
|
|
||||||
soname = f"gol.{platform}.{'debug' if target == 'template_debug' else 'release'}.{arch}"
|
|
||||||
|
|
||||||
env.SharedLibrary(target=os.path.join(outdir, soname), source=Glob("src/*.cpp"))
|
|
||||||
10
evolve-die-repeat/thirdparty/cpp.gdextension
vendored
@@ -1,10 +0,0 @@
|
|||||||
|
|
||||||
[configuration]
|
|
||||||
entry_symbol = "gol_library_init"
|
|
||||||
compatibility_minimum = "4.5" ; required in 4.5+
|
|
||||||
reloadable = true
|
|
||||||
|
|
||||||
[libraries]
|
|
||||||
linux.debug.x86_64 = "res://thirdparty/bin/libgol.linux.debug.x86_64"
|
|
||||||
|
|
||||||
|
|
||||||
337509
evolve-die-repeat/thirdparty/extension_api.json
vendored
1
evolve-die-repeat/thirdparty/godot-cpp
vendored
56
evolve-die-repeat/thirdparty/src/test.cpp
vendored
@@ -1,56 +0,0 @@
|
|||||||
|
|
||||||
#include <gdextension_interface.h>
|
|
||||||
#include <godot_cpp/classes/ref_counted.hpp>
|
|
||||||
#include <godot_cpp/core/class_db.hpp>
|
|
||||||
#include <godot_cpp/core/defs.hpp>
|
|
||||||
#include <godot_cpp/godot.hpp>
|
|
||||||
|
|
||||||
using namespace godot;
|
|
||||||
|
|
||||||
class Test : public RefCounted {
|
|
||||||
GDCLASS(Test, RefCounted);
|
|
||||||
|
|
||||||
int counter = 0;
|
|
||||||
|
|
||||||
static void _bind_methods() {
|
|
||||||
ClassDB::bind_method(D_METHOD("increment"), &Test::increment);
|
|
||||||
ClassDB::bind_method(D_METHOD("get_counter"), &Test::get_counter);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_counter", "value"), &Test::set_counter);
|
|
||||||
ClassDB::add_property("Test", PropertyInfo(Variant::INT, "counter"),
|
|
||||||
"set_counter", "get_counter");
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
int increment() {
|
|
||||||
counter += 1;
|
|
||||||
return counter;
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_counter() const { return counter; }
|
|
||||||
|
|
||||||
void set_counter(int p_value) { counter = p_value; }
|
|
||||||
};
|
|
||||||
|
|
||||||
extern "C" GDExtensionBool GDE_EXPORT
|
|
||||||
gol_library_init(GDExtensionInterfaceGetProcAddress get_proc_address,
|
|
||||||
GDExtensionClassLibraryPtr library,
|
|
||||||
GDExtensionInitialization *r_initialization) {
|
|
||||||
|
|
||||||
static GDExtensionBinding::InitObject init(get_proc_address, library,
|
|
||||||
r_initialization);
|
|
||||||
|
|
||||||
init.register_initializer([](ModuleInitializationLevel p_level) {
|
|
||||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ClassDB::register_class<Test>();
|
|
||||||
});
|
|
||||||
|
|
||||||
init.register_terminator([](ModuleInitializationLevel /*p_level*/) {
|
|
||||||
// no-op
|
|
||||||
});
|
|
||||||
|
|
||||||
init.set_minimum_library_initialization_level(
|
|
||||||
MODULE_INITIALIZATION_LEVEL_SCENE);
|
|
||||||
return init.init();
|
|
||||||
}
|
|
||||||