Compare commits
12 Commits
game-of-li
...
3262a8899c
| Author | SHA1 | Date | |
|---|---|---|---|
| 3262a8899c | |||
| 6662dc0c80 | |||
| 1a532a5afb | |||
| a5055a523f | |||
| 551482e209 | |||
| 263011b460 | |||
| 9de9d18632 | |||
| a4d062ea04 | |||
| 52ae094087 | |||
| e77fe832f0 | |||
| f4fd083a1a | |||
| cdcc23c50a |
4
.gitmodules
vendored
@@ -1,4 +1,4 @@
|
|||||||
[submodule "game-of-life-test/thirdparty/godot-cpp"]
|
[submodule "evolve-die-repeat/thirdparty/godot-cpp"]
|
||||||
path = game-of-life-test/thirdparty/godot-cpp
|
path = evolve-die-repeat/thirdparty/godot-cpp
|
||||||
url = https://github.com/godotengine/godot-cpp.git
|
url = https://github.com/godotengine/godot-cpp.git
|
||||||
branch = 4.5
|
branch = 4.5
|
||||||
|
|||||||
25
README.md
@@ -1,2 +1,25 @@
|
|||||||
# notSpore
|
# Evolve Die Repeat TODO: The name is a work in progress
|
||||||
|
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
15
evolve-die-repeat/debug_label.gd
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
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
evolve-die-repeat/debug_label.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://ceut2lrvkns75
|
||||||
|
Before Width: | Height: | Size: 995 B After Width: | Height: | Size: 995 B |
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://dma7owg4valo7"
|
uid="uid://uqy71st3rbdr"
|
||||||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
5
evolve-die-repeat/main_menu.gd
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
|
||||||
|
func _on_play_button_pressed() -> void:
|
||||||
|
get_tree().change_scene_to_file("res://molecular/molecular_stage.tscn")
|
||||||
1
evolve-die-repeat/main_menu.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dxc66bci2ivrj
|
||||||
36
evolve-die-repeat/main_menu.tscn
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
[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"]
|
||||||
|
After Width: | Height: | Size: 72 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[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
|
||||||
BIN
evolve-die-repeat/molecular/assets/background/bg-near.png
Normal file
|
After Width: | Height: | Size: 450 B |
@@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://c7assq3lqgw8x"
|
uid="uid://c3cuhrmulyy1s"
|
||||||
path="res://.godot/imported/black_sq.png-43fbf60d129e97f2df8400c8ac3589c6.ctex"
|
path="res://.godot/imported/bg-near.png-00577ad303726b65cb5579d462bbdf09.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://black_sq.png"
|
source_file="res://molecular/assets/background/bg-near.png"
|
||||||
dest_files=["res://.godot/imported/black_sq.png-43fbf60d129e97f2df8400c8ac3589c6.ctex"]
|
dest_files=["res://.godot/imported/bg-near.png-00577ad303726b65cb5579d462bbdf09.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
BIN
evolve-die-repeat/molecular/assets/background/bg.png
Normal file
|
After Width: | Height: | Size: 960 B |
@@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://csm64p7o7eyc6"
|
uid="uid://bto1pnycvianp"
|
||||||
path="res://.godot/imported/white_sq.png-7baf4040d7b03bc76a02f41aa766a5a0.ctex"
|
path="res://.godot/imported/bg.png-84a173f3a1de937d0ba2884af46d549b.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://white_sq.png"
|
source_file="res://molecular/assets/background/bg.png"
|
||||||
dest_files=["res://.godot/imported/white_sq.png-7baf4040d7b03bc76a02f41aa766a5a0.ctex"]
|
dest_files=["res://.godot/imported/bg.png-84a173f3a1de937d0ba2884af46d549b.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
BIN
evolve-die-repeat/molecular/assets/background/dirt-specs.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bfjf6dxvbq5cj"
|
||||||
|
path="res://.godot/imported/dirt-specs.png-ef6f8fd578fedf9d185ca3625a87c7c3.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://molecular/assets/background/dirt-specs.png"
|
||||||
|
dest_files=["res://.godot/imported/dirt-specs.png-ef6f8fd578fedf9d185ca3625a87c7c3.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
|
||||||
|
After Width: | Height: | Size: 715 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[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
|
||||||
BIN
evolve-die-repeat/molecular/assets/player-sprite-placeholder.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[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
|
||||||
BIN
evolve-die-repeat/molecular/assets/prey/prey-dying-frame0.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[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
|
||||||
BIN
evolve-die-repeat/molecular/assets/prey/prey-dying-frame1.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[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
|
||||||
BIN
evolve-die-repeat/molecular/assets/prey/prey-healthy-frame0.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[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
|
||||||
BIN
evolve-die-repeat/molecular/assets/prey/prey-healthy-frame1.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[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
|
||||||
BIN
evolve-die-repeat/molecular/assets/prey/prey-injured-frame0.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[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
|
||||||
BIN
evolve-die-repeat/molecular/assets/prey/prey-injured-frame1.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[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
|
||||||
34
evolve-die-repeat/molecular/molecular_player.gd
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
@export var speed = 200
|
||||||
|
var screen_size
|
||||||
|
var damage = 1
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
screen_size = get_viewport_rect().size
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
move_and_collide(speed * velocity * delta)
|
||||||
|
#position += speed * velocity * delta
|
||||||
|
position = get_boundaried_position(position)
|
||||||
|
|
||||||
|
# periodic boundary
|
||||||
|
|
||||||
|
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
evolve-die-repeat/molecular/molecular_player.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://di7eglnrnqm6i
|
||||||
33
evolve-die-repeat/molecular/molecular_player.tscn
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
[gd_scene load_steps=5 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://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_en8op")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"default",
|
||||||
|
"speed": 5.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_4flbx"]
|
||||||
|
radius = 191.95984
|
||||||
|
height = 1295.8773
|
||||||
|
|
||||||
|
[node name="player" type="CharacterBody2D"]
|
||||||
|
collision_mask = 2
|
||||||
|
script = ExtResource("1_0ix7k")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
visibility_layer = 2
|
||||||
|
scale = Vector2(0.5, 0.5)
|
||||||
|
sprite_frames = SubResource("SpriteFrames_onrkg")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="." groups=["player"]]
|
||||||
|
position = Vector2(0, 56)
|
||||||
|
rotation = -1.5732701
|
||||||
|
shape = SubResource("CapsuleShape2D_4flbx")
|
||||||
110
evolve-die-repeat/molecular/molecular_stage.tscn
Normal file
41
evolve-die-repeat/molecular/nucleotide_prey.gd
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
extends AbstractPrey2D
|
||||||
|
|
||||||
|
@onready var sprite = get_node("AnimatedSprite2D")
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
$AnimatedSprite2D.animation = "Healthy"
|
||||||
|
$AnimatedSprite2D.play()
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
return
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
self.move(Vector3(randfn(0, 1), randfn(0, 1), 0))
|
||||||
|
|
||||||
|
func move(destination: Vector3) -> void:
|
||||||
|
move_and_collide(Vector2(destination.x, destination.y))
|
||||||
|
|
||||||
|
func die() -> void:
|
||||||
|
sprite.play("Dying")
|
||||||
|
super.die()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_area_2d_body_entered(body: Node2D) -> void:
|
||||||
|
# TODO: collision with other entities
|
||||||
|
# check if colision with player
|
||||||
|
if body.is_in_group("player"):
|
||||||
|
handle_collision_player(body)
|
||||||
|
|
||||||
|
|
||||||
|
# Function to handle collision logic
|
||||||
|
func handle_collision_player(player):
|
||||||
|
self.health -= player.damage
|
||||||
|
if sprite:
|
||||||
|
if self.health <= 0:
|
||||||
|
self.die()
|
||||||
|
else:
|
||||||
|
sprite.play("Injured")
|
||||||
1
evolve-die-repeat/molecular/nucleotide_prey.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bgossk6xo31gi
|
||||||
65
evolve-die-repeat/molecular/nucleotide_prey.tscn
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
[gd_scene load_steps=10 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/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"]
|
||||||
|
|
||||||
|
[sub_resource type="SpriteFrames" id="SpriteFrames_66x8p"]
|
||||||
|
animations = [{
|
||||||
|
"frames": [{
|
||||||
|
"duration": 20.0,
|
||||||
|
"texture": ExtResource("2_lkj7f")
|
||||||
|
}, {
|
||||||
|
"duration": 20.0,
|
||||||
|
"texture": ExtResource("3_svqyr")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"Dying",
|
||||||
|
"speed": 1.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 20.0,
|
||||||
|
"texture": ExtResource("4_ee1gb")
|
||||||
|
}, {
|
||||||
|
"duration": 20.0,
|
||||||
|
"texture": ExtResource("5_ae5nf")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"Healthy",
|
||||||
|
"speed": 1.0
|
||||||
|
}, {
|
||||||
|
"frames": [{
|
||||||
|
"duration": 20.0,
|
||||||
|
"texture": ExtResource("6_0f87h")
|
||||||
|
}, {
|
||||||
|
"duration": 20.0,
|
||||||
|
"texture": ExtResource("7_w7inl")
|
||||||
|
}],
|
||||||
|
"loop": true,
|
||||||
|
"name": &"Injured",
|
||||||
|
"speed": 1.0
|
||||||
|
}]
|
||||||
|
|
||||||
|
[node name="NucleotidePrey" instance=ExtResource("1_qvulj")]
|
||||||
|
collision_layer = 2
|
||||||
|
collision_mask = 3
|
||||||
|
motion_mode = 1
|
||||||
|
script = ExtResource("2_0227s")
|
||||||
|
maxHealth = 20
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0"]
|
||||||
|
scale = Vector2(0.1, 0.1)
|
||||||
|
sprite_frames = SubResource("SpriteFrames_66x8p")
|
||||||
|
animation = &"Dying"
|
||||||
|
frame_progress = 0.60472965
|
||||||
|
|
||||||
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Area2D" index="0"]
|
||||||
|
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)
|
||||||
|
|
||||||
|
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
|
||||||
27
evolve-die-repeat/molecular/preyManager.gd
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
extends Node
|
||||||
|
|
||||||
|
var preyScene = preload("res://molecular/nucleotide_prey.tscn")
|
||||||
|
#var predatorScene = preload("res://Predator.tscn")
|
||||||
|
var score
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
for i in range(0, 100, 10):
|
||||||
|
spawn_creature(preyScene, Vector2(i, i))
|
||||||
|
spawn_random()
|
||||||
|
spawn_random()
|
||||||
|
spawn_random()
|
||||||
|
spawn_random()
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
func spawn_random() -> void:
|
||||||
|
spawn_creature(preyScene, Vector2(randfn(100, 100), randfn(100, 100)))
|
||||||
|
|
||||||
|
func spawn_creature(scene, position: Vector2) -> void:
|
||||||
|
var instance = scene.instantiate()
|
||||||
|
instance.position = position
|
||||||
|
add_child(instance)
|
||||||
1
evolve-die-repeat/molecular/preyManager.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://2pmjtnrg5471
|
||||||
52
evolve-die-repeat/project.godot
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
; 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
|
||||||
|
|
||||||
|
[application]
|
||||||
|
|
||||||
|
config/name="EvolveDieRepeat"
|
||||||
|
run/main_scene="uid://drgv154ei1vrl"
|
||||||
|
config/features=PackedStringArray("4.5", "Forward Plus")
|
||||||
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[global_group]
|
||||||
|
|
||||||
|
player="All scenes that constitute players should be added here."
|
||||||
|
|
||||||
|
[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)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
[layer_names]
|
||||||
|
|
||||||
|
2d_render/layer_1="Player"
|
||||||
|
2d_render/layer_2="Prey"
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
textures/canvas_textures/default_texture_filter=0
|
||||||
38
evolve-die-repeat/shared/npc/npc2D.gd
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
extends CharacterBody2D
|
||||||
|
class_name NPC2D
|
||||||
|
|
||||||
|
@export var maxHealth: int = 0
|
||||||
|
var health: int = maxHealth
|
||||||
|
|
||||||
|
# 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()
|
||||||
|
|
||||||
|
# I think the move per npc is to model concrete behaviours in functions.
|
||||||
|
# How the npc acts can be determined elsewhere, these functions just implement the behvaiour
|
||||||
|
func flee(direction: Vector3) -> void:
|
||||||
|
push_error("Function flee() not implemented.")
|
||||||
|
|
||||||
|
# Im envisioning we feed on "sustenance (to be classed)" only; when something dies it should spawn some sustenance
|
||||||
|
func feed(source ) -> void:
|
||||||
|
push_error("Function feed() not implemented.")
|
||||||
|
|
||||||
|
func die() -> void:
|
||||||
|
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
evolve-die-repeat/shared/npc/npc2D.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://biu3sctw15ga
|
||||||
8
evolve-die-repeat/shared/npc/npc2D.tscn
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[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="Area2D" type="Area2D" parent="."]
|
||||||
15
evolve-die-repeat/shared/npc/predator2D.gd
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
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
evolve-die-repeat/shared/npc/predator2D.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dgfimmq53whll
|
||||||
7
evolve-die-repeat/shared/npc/predator2D.tscn
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[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")
|
||||||
12
evolve-die-repeat/shared/npc/prey2D.gd
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
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
evolve-die-repeat/shared/npc/prey2D.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://76jxpubyd8wp
|
||||||
7
evolve-die-repeat/shared/npc/prey2D.tscn
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[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")
|
||||||
8
evolve-die-repeat/thirdparty/.gitignore
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
bin
|
||||||
|
*.uid
|
||||||
|
*sconsign.dblite
|
||||||
|
**.os
|
||||||
|
|
||||||
|
godot-cpp/bin/
|
||||||
|
*.o
|
||||||
|
*.so
|
||||||
@@ -7,3 +7,4 @@ reloadable = true
|
|||||||
[libraries]
|
[libraries]
|
||||||
linux.debug.x86_64 = "res://thirdparty/bin/libgol.linux.debug.x86_64"
|
linux.debug.x86_64 = "res://thirdparty/bin/libgol.linux.debug.x86_64"
|
||||||
|
|
||||||
|
|
||||||
337509
evolve-die-repeat/thirdparty/extension_api.json
vendored
Normal file
1
evolve-die-repeat/thirdparty/godot-cpp
vendored
Submodule
56
evolve-die-repeat/thirdparty/src/test.cpp
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
#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();
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 2.6 KiB |
@@ -1,36 +0,0 @@
|
|||||||
shader_type canvas_item;
|
|
||||||
|
|
||||||
uniform sampler2D unlitTex;
|
|
||||||
uniform sampler2D litTex;
|
|
||||||
uniform sampler2D binDataTex;
|
|
||||||
uniform int n;
|
|
||||||
|
|
||||||
const int cellSize = 8;
|
|
||||||
|
|
||||||
void vertex() {
|
|
||||||
// Called for every vertex the material is visible on.
|
|
||||||
}
|
|
||||||
|
|
||||||
void fragment() {
|
|
||||||
// Called for every pixel the material is visible on.
|
|
||||||
vec2 totalGridSize = vec2(float(n) * float(cellSize));
|
|
||||||
|
|
||||||
vec2 scaledUV = UV * float(n);
|
|
||||||
ivec2 cellIdx = ivec2(floor(scaledUV));
|
|
||||||
vec2 cellUV = fract(scaledUV);
|
|
||||||
|
|
||||||
float binVal = texelFetch(binDataTex, cellIdx, 0).r;
|
|
||||||
bool isWhite = binVal > 0.5;
|
|
||||||
|
|
||||||
vec4 color = texture(unlitTex, cellUV);
|
|
||||||
if (isWhite) {
|
|
||||||
color = texture(litTex, cellUV);
|
|
||||||
}
|
|
||||||
|
|
||||||
COLOR = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
//void light() {
|
|
||||||
// // Called for every pixel for every light affecting the material.
|
|
||||||
// // Uncomment to replace the default light processing function with this one.
|
|
||||||
//}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://cidrd2kca02ko
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
[gd_scene load_steps=7 format=3 uid="uid://bawvofeipkkmn"]
|
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dma7owg4valo7" path="res://icon.svg" id="1_4fmrq"]
|
|
||||||
[ext_resource type="Shader" uid="uid://cidrd2kca02ko" path="res://dot_matrix.gdshader" id="1_wjpme"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://csm64p7o7eyc6" path="res://white_sq.png" id="2_og22u"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://c7assq3lqgw8x" path="res://black_sq.png" id="3_b70w7"]
|
|
||||||
[ext_resource type="Script" uid="uid://cgwkfjisbqbwt" path="res://gol.gd" id="5_og22u"]
|
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_wvg0l"]
|
|
||||||
shader = ExtResource("1_wjpme")
|
|
||||||
shader_parameter/unlitTex = ExtResource("3_b70w7")
|
|
||||||
shader_parameter/litTex = ExtResource("2_og22u")
|
|
||||||
shader_parameter/n = 64
|
|
||||||
|
|
||||||
[node name="Dot Matrix" type="Node2D"]
|
|
||||||
|
|
||||||
[node name="Renderer" type="Sprite2D" parent="."]
|
|
||||||
material = SubResource("ShaderMaterial_wvg0l")
|
|
||||||
position = Vector2(960, 960)
|
|
||||||
scale = Vector2(15, 15)
|
|
||||||
texture = ExtResource("1_4fmrq")
|
|
||||||
script = ExtResource("5_og22u")
|
|
||||||
metadata/_edit_lock_ = true
|
|
||||||
@@ -1,196 +0,0 @@
|
|||||||
extends Sprite2D
|
|
||||||
|
|
||||||
var n: int = 64
|
|
||||||
var arr := []
|
|
||||||
|
|
||||||
var data_img: Image
|
|
||||||
var data_tex: ImageTexture
|
|
||||||
|
|
||||||
var gol := GoL.new()
|
|
||||||
|
|
||||||
@onready var mat: ShaderMaterial = material as ShaderMaterial
|
|
||||||
|
|
||||||
# sim. consts
|
|
||||||
var T := 0.01
|
|
||||||
var t := 0.0
|
|
||||||
|
|
||||||
# player (2x2 block)
|
|
||||||
var player_alive := true
|
|
||||||
var player_col := 10
|
|
||||||
var player_row := 10
|
|
||||||
var PLAYER_SHAPE := [Vector2i(0,0), Vector2i(1,0), Vector2i(0,1), Vector2i(1,1)]
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
data_img = Image.create(n, n, false, Image.FORMAT_R8)
|
|
||||||
data_img.fill(Color8(0, 0, 0, 255))
|
|
||||||
|
|
||||||
data_tex = ImageTexture.create_from_image(data_img)
|
|
||||||
mat.set_shader_parameter("binDataTex", data_tex)
|
|
||||||
mat.set_shader_parameter("n", n)
|
|
||||||
|
|
||||||
# player
|
|
||||||
_seed_clear()
|
|
||||||
_fill_example()
|
|
||||||
_spawn_player(20, 10)
|
|
||||||
_upload_arr()
|
|
||||||
|
|
||||||
|
|
||||||
func _upload_arr() -> void:
|
|
||||||
for y in n:
|
|
||||||
for x in n:
|
|
||||||
var v := int(arr[y][x]) * 255
|
|
||||||
data_img.set_pixel(x, y, Color8(v, 0, 0, 255))
|
|
||||||
data_tex.update(data_img)
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(_delta: float) -> void:
|
|
||||||
if Input.is_action_just_pressed("move_right"):
|
|
||||||
_move_player(1, 0)
|
|
||||||
if Input.is_action_just_pressed("move_left"):
|
|
||||||
_move_player(-1, 0)
|
|
||||||
if Input.is_action_just_pressed("move_up"):
|
|
||||||
_move_player(0, -1)
|
|
||||||
if Input.is_action_just_pressed("move_down"):
|
|
||||||
_move_player(0, 1)
|
|
||||||
|
|
||||||
t += _delta
|
|
||||||
if t >= T:
|
|
||||||
t = 0.0
|
|
||||||
_game_of_life_step()
|
|
||||||
# arr = gol.step_once(arr, n) # cpp step (no player)
|
|
||||||
_track_player_after_step()
|
|
||||||
_upload_arr()
|
|
||||||
|
|
||||||
func _game_of_life_step() -> void:
|
|
||||||
var next := []
|
|
||||||
for y in n:
|
|
||||||
var row := []
|
|
||||||
for x in n:
|
|
||||||
var alive: bool = arr[y][x] == 1
|
|
||||||
var cn := _count_neighs(x, y)
|
|
||||||
|
|
||||||
var newv := 0
|
|
||||||
if alive:
|
|
||||||
newv = int(cn == 2 or cn == 3)
|
|
||||||
else:
|
|
||||||
newv = int(cn == 3)
|
|
||||||
row.append(newv)
|
|
||||||
next.append(row)
|
|
||||||
arr = next
|
|
||||||
|
|
||||||
func _count_neighs(x:int, y:int) -> int:
|
|
||||||
var ans := 0
|
|
||||||
for _dy in 3:
|
|
||||||
var dy := _dy-1
|
|
||||||
for _dx in 3:
|
|
||||||
var dx := _dx-1
|
|
||||||
if dx == 0 and dy == 0:
|
|
||||||
continue
|
|
||||||
var nx := int((x + dx + n)%n)
|
|
||||||
var ny := int((y + dy + n)%n)
|
|
||||||
ans += arr[ny][nx]
|
|
||||||
return ans
|
|
||||||
|
|
||||||
|
|
||||||
func _track_player_after_step() -> void:
|
|
||||||
if not player_alive:
|
|
||||||
return
|
|
||||||
var best_count := -1
|
|
||||||
var best_shift := Vector2i(0, 0)
|
|
||||||
|
|
||||||
# search a 5x5 neighborhood for where the 2x2 footprint moved
|
|
||||||
for dy in range(-2, 3):
|
|
||||||
for dx in range(-2, 3):
|
|
||||||
var cnt := 0
|
|
||||||
for off in PLAYER_SHAPE:
|
|
||||||
var x:int = (player_col + off.x + dx + n) % n
|
|
||||||
var y:int = (player_row + off.y + dy + n) % n
|
|
||||||
cnt += arr[y][x]
|
|
||||||
if cnt > best_count:
|
|
||||||
best_count = cnt
|
|
||||||
best_shift = Vector2i(dx, dy)
|
|
||||||
|
|
||||||
# if nothing from the footprint survived, the player is dead
|
|
||||||
if best_count <= 0:
|
|
||||||
player_alive = false
|
|
||||||
print("Player dead!")
|
|
||||||
return
|
|
||||||
|
|
||||||
player_col = (player_col + best_shift.x + n) % n
|
|
||||||
player_row = (player_row + best_shift.y + n) % n
|
|
||||||
|
|
||||||
|
|
||||||
func _fill_example() -> void:
|
|
||||||
#_checkerboard()
|
|
||||||
_ship()
|
|
||||||
|
|
||||||
# inits
|
|
||||||
func _checkerboard() -> void:
|
|
||||||
for y in n:
|
|
||||||
var row := []
|
|
||||||
for x in n:
|
|
||||||
row.append((x + y) % 2) # checkerboard
|
|
||||||
arr.append(row)
|
|
||||||
|
|
||||||
func _ship() -> void:
|
|
||||||
var i: int = 0
|
|
||||||
var j: int = 0
|
|
||||||
while (i < n):
|
|
||||||
var row := []
|
|
||||||
j = 0
|
|
||||||
while (j < n):
|
|
||||||
row.append(0)
|
|
||||||
j+=1
|
|
||||||
arr.append(row)
|
|
||||||
i+=1
|
|
||||||
|
|
||||||
arr[0][1] = 1
|
|
||||||
arr[1][2] = 1
|
|
||||||
arr[2][0] = 1
|
|
||||||
arr[2][1] = 1
|
|
||||||
arr[2][2] = 1
|
|
||||||
|
|
||||||
|
|
||||||
# Player
|
|
||||||
func _write_player(val:int) -> void:
|
|
||||||
for off in PLAYER_SHAPE:
|
|
||||||
var x:int = (player_col + off.x + n) % n
|
|
||||||
var y:int = (player_row + off.y + n) % n
|
|
||||||
arr[y][x] = val
|
|
||||||
|
|
||||||
func _spawn_player(col:int, row:int) -> void:
|
|
||||||
player_col = (col + n) % n
|
|
||||||
player_row = (row + n) % n
|
|
||||||
player_alive = true
|
|
||||||
_write_player(1)
|
|
||||||
_upload_arr()
|
|
||||||
|
|
||||||
func _despawn_player() -> void:
|
|
||||||
if player_alive:
|
|
||||||
_write_player(0)
|
|
||||||
player_alive = false
|
|
||||||
_upload_arr()
|
|
||||||
|
|
||||||
func _move_player(dx:int, dy:int) -> void:
|
|
||||||
if not player_alive:
|
|
||||||
return
|
|
||||||
# erase old footprint
|
|
||||||
_write_player(0)
|
|
||||||
# move
|
|
||||||
player_col = (player_col + dx + n) % n
|
|
||||||
player_row = (player_row + dy + n) % n
|
|
||||||
# write new footprint
|
|
||||||
_write_player(1)
|
|
||||||
_upload_arr()
|
|
||||||
|
|
||||||
|
|
||||||
# Clear
|
|
||||||
func _seed_clear() -> void:
|
|
||||||
arr.clear()
|
|
||||||
for _y in n:
|
|
||||||
var row := []
|
|
||||||
for _x in n:
|
|
||||||
row.append(0)
|
|
||||||
arr.append(row)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://cgwkfjisbqbwt
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
extends Area2D
|
|
||||||
|
|
||||||
@export var speed = 400 # How fast the player will move (pixels/sec).
|
|
||||||
var screen_size # Size of the game window.
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
screen_size = get_viewport_rect().size
|
|
||||||
|
|
||||||
func _process(delta):
|
|
||||||
var velocity = Vector2.ZERO # The player's movement vector.
|
|
||||||
if Input.is_action_pressed("move_right"):
|
|
||||||
velocity.x += 1
|
|
||||||
if Input.is_action_pressed("move_left"):
|
|
||||||
velocity.x -= 1
|
|
||||||
|
|
||||||
if velocity.length() > 0:
|
|
||||||
velocity = velocity.normalized() * speed
|
|
||||||
$AnimatedSprite2D.play()
|
|
||||||
else:
|
|
||||||
$AnimatedSprite2D.stop()
|
|
||||||
|
|
||||||
position += velocity * delta
|
|
||||||
position = position.clamp(Vector2.ZERO, screen_size)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://cvxhfc50fgdyb
|
|
||||||
@@ -1,44 +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
|
|
||||||
|
|
||||||
[application]
|
|
||||||
|
|
||||||
config/name="GameOfLifeTest"
|
|
||||||
run/main_scene="uid://bawvofeipkkmn"
|
|
||||||
config/features=PackedStringArray("4.5", "Forward Plus")
|
|
||||||
config/icon="res://icon.svg"
|
|
||||||
|
|
||||||
[display]
|
|
||||||
|
|
||||||
window/size/viewport_width=1920
|
|
||||||
window/size/viewport_height=1920
|
|
||||||
|
|
||||||
[input]
|
|
||||||
|
|
||||||
move_right={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
move_left={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
move_up={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
move_down={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
10
game-of-life-test/thirdparty/.gitignore
vendored
@@ -1,10 +0,0 @@
|
|||||||
bin
|
|
||||||
*.uid
|
|
||||||
*sconsign.dblite
|
|
||||||
**.os
|
|
||||||
|
|
||||||
game-of-life-test/thirdparty/godot-cpp/bin/
|
|
||||||
game-of-life-test/thirdparty/bin/
|
|
||||||
*.o
|
|
||||||
*.so
|
|
||||||
|
|
||||||
1
game-of-life-test/thirdparty/godot-cpp
vendored
75
game-of-life-test/thirdparty/src/gol.cpp
vendored
@@ -1,75 +0,0 @@
|
|||||||
|
|
||||||
// src/gol.cpp
|
|
||||||
|
|
||||||
#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>
|
|
||||||
#include <godot_cpp/variant/array.hpp>
|
|
||||||
|
|
||||||
using namespace godot;
|
|
||||||
|
|
||||||
class GoL : public RefCounted {
|
|
||||||
GDCLASS(GoL, RefCounted);
|
|
||||||
|
|
||||||
static void _bind_methods() {
|
|
||||||
ClassDB::bind_method(D_METHOD("step_once", "arr", "n"), &GoL::step_once);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int neighs(const Array &a, int n, int x, int y) {
|
|
||||||
int s = 0;
|
|
||||||
for (int dy = -1; dy <= 1; ++dy) {
|
|
||||||
for (int dx = -1; dx <= 1; ++dx) {
|
|
||||||
if (dx == 0 && dy == 0)
|
|
||||||
continue;
|
|
||||||
const int nx = ((x + dx) % n + n) % n;
|
|
||||||
const int ny = ((y + dy) % n + n) % n;
|
|
||||||
const Array row = a[ny];
|
|
||||||
s += (int)row[nx];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
Array step_once(const Array &arr, int n) const {
|
|
||||||
Array next;
|
|
||||||
next.resize(n);
|
|
||||||
for (int y = 0; y < n; ++y) {
|
|
||||||
Array row;
|
|
||||||
row.resize(n);
|
|
||||||
const Array crow = arr[y];
|
|
||||||
for (int x = 0; x < n; ++x) {
|
|
||||||
const bool alive = ((int)crow[x]) == 1;
|
|
||||||
const int cn = neighs(arr, n, x, y);
|
|
||||||
row.set(x, alive ? int(cn == 2 || cn == 3) : int(cn == 3));
|
|
||||||
}
|
|
||||||
next.set(y, row);
|
|
||||||
}
|
|
||||||
return next;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
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<GoL>();
|
|
||||||
});
|
|
||||||
|
|
||||||
init.register_terminator([](ModuleInitializationLevel /*p_level*/) {
|
|
||||||
// no-op
|
|
||||||
});
|
|
||||||
|
|
||||||
init.set_minimum_library_initialization_level(
|
|
||||||
MODULE_INITIALIZATION_LEVEL_SCENE);
|
|
||||||
return init.init();
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB |