Compare commits
20 Commits
langtons-a
...
0b9b1e75d4
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b9b1e75d4 | |||
| c0f5dd4628 | |||
| 03117b77fb | |||
| 18ce1716e4 | |||
| 5811658c64 | |||
| e4b3919b81 | |||
| 8de3ee2c9a | |||
| 4160361145 | |||
| 3262a8899c | |||
| 6662dc0c80 | |||
| 1a532a5afb | |||
| a5055a523f | |||
| 551482e209 | |||
| 263011b460 | |||
| 9de9d18632 | |||
| a4d062ea04 | |||
| 52ae094087 | |||
| e77fe832f0 | |||
| f4fd083a1a | |||
| cdcc23c50a |
1
.gitignore
vendored
@@ -35,7 +35,6 @@
|
|||||||
# ---> Godot
|
# ---> Godot
|
||||||
# Godot 4+ specific ignores
|
# Godot 4+ specific ignores
|
||||||
.godot/
|
.godot/
|
||||||
addons/
|
|
||||||
|
|
||||||
# Godot-specific ignores
|
# Godot-specific ignores
|
||||||
.import/
|
.import/
|
||||||
|
|||||||
4
.gitmodules
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[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,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
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# Godot 4+ specific ignores
|
# Godot 4+ specific ignores
|
||||||
.godot/
|
.godot/
|
||||||
project.godot
|
/android/
|
||||||
*.import
|
|
||||||
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
|
||||||
23
evolve-die-repeat/game_manager.gd
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
extends Node
|
||||||
|
|
||||||
|
var screen_size = Vector2(1920.0, 1080.0) # Default screen size (this is a float for some reason)
|
||||||
|
var viewport_size
|
||||||
|
|
||||||
|
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
evolve-die-repeat/game_manager.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://vsbibc5fanou
|
||||||
|
Before Width: | Height: | Size: 995 B After Width: | Height: | Size: 995 B |
43
evolve-die-repeat/icon.svg.import
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
[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
|
||||||
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 |
@@ -0,0 +1,40 @@
|
|||||||
|
[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
|
||||||
BIN
evolve-die-repeat/molecular/assets/background/bg.png
Normal file
|
After Width: | Height: | Size: 960 B |
40
evolve-die-repeat/molecular/assets/background/bg.png.import
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
[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
|
||||||
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: 887 KiB |
@@ -0,0 +1,40 @@
|
|||||||
|
[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
|
||||||
|
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
|
||||||
75
evolve-die-repeat/molecular/molecular_player.gd
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
@export var attack_duration = 0.2 # TODO: finetune
|
||||||
|
@export var attack_cooldown_duration = 0.4
|
||||||
|
|
||||||
|
@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():
|
||||||
|
look_at(velocity * 1000000) # FIXME: ideally we look_at a point at infinity
|
||||||
|
# or rotate the player some other way
|
||||||
|
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)
|
||||||
|
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
evolve-die-repeat/molecular/molecular_player.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://di7eglnrnqm6i
|
||||||
64
evolve-die-repeat/molecular/molecular_player.tscn
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
[gd_scene load_steps=7 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"]
|
||||||
|
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="AttackArea" type="Area2D" parent="."]
|
||||||
|
position = Vector2(0, 56)
|
||||||
|
rotation = -1.5732701
|
||||||
|
collision_mask = 2
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="AttackArea"]
|
||||||
|
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="." groups=["player"]]
|
||||||
|
rotation = -1.5732701
|
||||||
|
shape = SubResource("CapsuleShape2D_4flbx")
|
||||||
|
|
||||||
|
[node name="AttackTimer" type="Timer" parent="."]
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
|
[node name="AttackCooldownTimer" type="Timer" parent="."]
|
||||||
|
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"]
|
||||||
116
evolve-die-repeat/molecular/molecular_stage.tscn
Normal file
146
evolve-die-repeat/molecular/nucleotide_prey.gd
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
extends AbstractPrey2D
|
||||||
|
|
||||||
|
@onready var sprite = get_node("AnimatedSprite2D")
|
||||||
|
|
||||||
|
# Mirroed 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.animation = "Healthy"
|
||||||
|
sprite.play()
|
||||||
|
|
||||||
|
mirrorSprite1 = sprite.duplicate()
|
||||||
|
mirrorSprite2 = sprite.duplicate()
|
||||||
|
mirrorSprite3 = sprite.duplicate()
|
||||||
|
|
||||||
|
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:
|
||||||
|
# Boundary mirroring
|
||||||
|
_handle_wrapping()
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
#self.move(Vector3(randfn(0, 1), randfn(0, 1), 0))
|
||||||
|
pass
|
||||||
|
|
||||||
|
func move(motion: Vector3) -> void:
|
||||||
|
move_and_collide(Vector2(motion.x, motion.y)) # Moves along the given vector
|
||||||
|
|
||||||
|
# Apply boundary to new position
|
||||||
|
position = GameManager.get_boundaried_position(position)
|
||||||
|
|
||||||
|
func handle_damage(dmg: int) -> void:
|
||||||
|
health = max(0, health-dmg)
|
||||||
|
if health == 0:
|
||||||
|
die()
|
||||||
|
if health < maxHealth:
|
||||||
|
become_injured()
|
||||||
|
|
||||||
|
func die() -> void:
|
||||||
|
sprite.play("Dying")
|
||||||
|
super.die()
|
||||||
|
|
||||||
|
func become_injured() -> void:
|
||||||
|
sprite.play("Injured")
|
||||||
|
mirrorSprite1.play("Injured")
|
||||||
|
mirrorSprite2.play("Injured")
|
||||||
|
mirrorSprite3.play("Injured")
|
||||||
|
|
||||||
|
# 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.position = Vector2(sprite.position.x + GameManager.screen_size.x, sprite.position.y)
|
||||||
|
mirrorSprite1.position = Vector2(GameManager.screen_size.x, 0)
|
||||||
|
# Diag
|
||||||
|
#mirrorSprite2.position = Vector2(sprite.position.x + GameManager.screen_size.x, sprite.position.y + GameManager.screen_size.y)
|
||||||
|
mirrorSprite3.position = Vector2(GameManager.screen_size.x, GameManager.screen_size.y)
|
||||||
|
# Bottom
|
||||||
|
#mirrorSprite3.position = Vector2(sprite.position.x, sprite.position.y + GameManager.screen_size.y)
|
||||||
|
mirrorSprite2.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.position = Vector2(sprite.position.x, sprite.position.y - GameManager.screen_size.y)
|
||||||
|
mirrorSprite1.position = Vector2(0, - GameManager.screen_size.y)
|
||||||
|
# Diag
|
||||||
|
#mirrorSprite2.position = Vector2(sprite.position.x + GameManager.screen_size.x, sprite.position.y - GameManager.screen_size.y)
|
||||||
|
mirrorSprite2.position = Vector2(GameManager.screen_size.x, - GameManager.screen_size.y)
|
||||||
|
# Right
|
||||||
|
#mirrorSprite3.position = Vector2(sprite.position.x + GameManager.screen_size.x, sprite.position.y)
|
||||||
|
mirrorSprite3.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.position = Vector2(sprite.position.x - GameManager.screen_size.x, sprite.position.y)
|
||||||
|
mirrorSprite1.position = Vector2(- GameManager.screen_size.x, 0)
|
||||||
|
# Bottom
|
||||||
|
#mirrorSprite2.position = Vector2(sprite.position.x, sprite.position.y + GameManager.screen_size.y)
|
||||||
|
mirrorSprite2.position = Vector2(0, GameManager.screen_size.y)
|
||||||
|
# Diag
|
||||||
|
#mirrorSprite3.position = Vector2(sprite.position.x - GameManager.screen_size.x, sprite.position.y + GameManager.screen_size.y)
|
||||||
|
mirrorSprite3.position = Vector2(- GameManager.screen_size.x, GameManager.screen_size.y)
|
||||||
|
|
||||||
|
|
||||||
|
else:
|
||||||
|
# 4
|
||||||
|
mirrorSprite1.visible = true
|
||||||
|
mirrorSprite2.visible = true
|
||||||
|
mirrorSprite3.visible = true
|
||||||
|
|
||||||
|
# Left
|
||||||
|
#mirrorSprite1.position = Vector2(sprite.position.x - GameManager.screen_size.x, sprite.position.y)
|
||||||
|
mirrorSprite1.position = Vector2(- GameManager.screen_size.x, 0)
|
||||||
|
# Diag
|
||||||
|
#mirrorSprite2.position = Vector2(sprite.position.x - GameManager.screen_size.x, sprite.position.y - GameManager.screen_size.y)
|
||||||
|
mirrorSprite2.position = Vector2(- GameManager.screen_size.x, - GameManager.screen_size.y)
|
||||||
|
# Top
|
||||||
|
#mirrorSprite3.position = Vector2(sprite.position.x, sprite.position.y - GameManager.screen_size.y)
|
||||||
|
mirrorSprite3.position = Vector2(0, - GameManager.screen_size.y)
|
||||||
|
|
||||||
|
|
||||||
1
evolve-die-repeat/molecular/nucleotide_prey.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bgossk6xo31gi
|
||||||
57
evolve-die-repeat/molecular/nucleotide_prey.tscn
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
[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" groups=["prey"] instance=ExtResource("1_qvulj")]
|
||||||
|
collision_layer = 2
|
||||||
|
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"
|
||||||
13
evolve-die-repeat/molecular/prey_manager.gd
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
extends SpawnManager2D
|
||||||
|
|
||||||
|
@export var cam: Camera2D
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
spawnRange = cam.get_viewport_rect()
|
||||||
|
_spawn_minimum()
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
pass
|
||||||
1
evolve-die-repeat/molecular/prey_manager.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://umx4w11edif
|
||||||
62
evolve-die-repeat/project.godot
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
; 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"
|
||||||
|
|
||||||
|
[autoload]
|
||||||
|
|
||||||
|
GameManager="*res://game_manager.gd"
|
||||||
|
|
||||||
|
[global_group]
|
||||||
|
|
||||||
|
player="All scenes that constitute players should be added here."
|
||||||
|
prey="any passive killable entities belong in this group"
|
||||||
|
|
||||||
|
[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"
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
textures/canvas_textures/default_texture_filter=0
|
||||||
41
evolve-die-repeat/shared/npc/npc2D.gd
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
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()
|
||||||
|
|
||||||
|
# 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:
|
||||||
|
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
evolve-die-repeat/shared/npc/npc2D.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://biu3sctw15ga
|
||||||
10
evolve-die-repeat/shared/npc/npc2D.tscn
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[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)
|
||||||
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")
|
||||||
6
evolve-die-repeat/shared/npc/spawnManager2D.tscn
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[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")
|
||||||
41
evolve-die-repeat/shared/npc/spawn_manager_2d.gd
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
extends Node
|
||||||
|
class_name SpawnManager2D
|
||||||
|
|
||||||
|
#var scene = preload("res://molecular/nucleotide_prey.tscn")
|
||||||
|
@export var scene: PackedScene
|
||||||
|
@export var minCount = 1
|
||||||
|
@export var maxCount = 2
|
||||||
|
@export var spawnRange: Rect2
|
||||||
|
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)
|
||||||
|
_spawn_minimum()
|
||||||
1
evolve-die-repeat/shared/npc/spawn_manager_2d.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://coetidfssb80w
|
||||||
8
evolve-die-repeat/thirdparty/.gitignore
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
bin
|
||||||
|
*.uid
|
||||||
|
*sconsign.dblite
|
||||||
|
**.os
|
||||||
|
|
||||||
|
godot-cpp/bin/
|
||||||
|
*.o
|
||||||
|
*.so
|
||||||
31
evolve-die-repeat/thirdparty/SConstruct
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
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
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
[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
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();
|
||||||
|
}
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
UI -> toggleButton so camera follows ant
|
|
||||||
-> reset camera button
|
|
||||||
-> pause button
|
|
||||||
dynamically generate tile colours (using a big palette for indexing maybe?) this probably needs to be a shader.
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
extends Sprite2D
|
|
||||||
|
|
||||||
var pos: Vector2i = Vector2i(0,0)
|
|
||||||
var dir: TileSet.CellNeighbor = TileSet.CELL_NEIGHBOR_RIGHT_SIDE
|
|
||||||
@onready var tiles: TileMapLayer = get_node("../TileMapLayer")
|
|
||||||
@export var randomRules: bool = true
|
|
||||||
|
|
||||||
var curDir: Dictionary = {
|
|
||||||
0: TileSet.CELL_NEIGHBOR_RIGHT_SIDE,
|
|
||||||
1: TileSet.CELL_NEIGHBOR_BOTTOM_RIGHT_SIDE,
|
|
||||||
2: TileSet.CELL_NEIGHBOR_BOTTOM_LEFT_SIDE,
|
|
||||||
3: TileSet.CELL_NEIGHBOR_LEFT_SIDE,
|
|
||||||
4: TileSet.CELL_NEIGHBOR_TOP_LEFT_SIDE,
|
|
||||||
5: TileSet.CELL_NEIGHBOR_TOP_RIGHT_SIDE,
|
|
||||||
}
|
|
||||||
|
|
||||||
var curInt: Dictionary = {
|
|
||||||
TileSet.CELL_NEIGHBOR_RIGHT_SIDE: 0,
|
|
||||||
TileSet.CELL_NEIGHBOR_BOTTOM_RIGHT_SIDE: 1,
|
|
||||||
TileSet.CELL_NEIGHBOR_BOTTOM_LEFT_SIDE: 2,
|
|
||||||
TileSet.CELL_NEIGHBOR_LEFT_SIDE: 3,
|
|
||||||
TileSet.CELL_NEIGHBOR_TOP_LEFT_SIDE: 4,
|
|
||||||
TileSet.CELL_NEIGHBOR_TOP_RIGHT_SIDE: 5,
|
|
||||||
}
|
|
||||||
|
|
||||||
var antProgram: Array[Vector2i] = [
|
|
||||||
Vector2i(2, 1),
|
|
||||||
Vector2i(0, 2),
|
|
||||||
Vector2i(3, 3),
|
|
||||||
Vector2i(1, 4),
|
|
||||||
Vector2i(1, 5),
|
|
||||||
Vector2i(2, 0),
|
|
||||||
]
|
|
||||||
|
|
||||||
func randomTileset() -> void:
|
|
||||||
var rng = RandomNumberGenerator.new()
|
|
||||||
antProgram = []
|
|
||||||
var s: int = rng.randi_range(10, 99)
|
|
||||||
for i in range(0, s):
|
|
||||||
antProgram.append(Vector2i(rng.randi_range(1, 4), (i+1)%s))
|
|
||||||
|
|
||||||
|
|
||||||
func getNextStep(tile: int) -> Vector2i:
|
|
||||||
if tile > antProgram.size():
|
|
||||||
return Vector2i(0,0)
|
|
||||||
else:
|
|
||||||
return antProgram.get(tile)
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
self.set_z_index(1)
|
|
||||||
self.set_frame(curInt[dir])
|
|
||||||
if randomRules:
|
|
||||||
randomTileset()
|
|
||||||
tiles.set_tile(pos, tiles.get_tile_colour(pos))
|
|
||||||
move(dir)
|
|
||||||
|
|
||||||
# update loop:
|
|
||||||
# move in dir
|
|
||||||
# get tile col, change dir based on col
|
|
||||||
# paint tile col
|
|
||||||
func update() -> void:
|
|
||||||
move(dir)
|
|
||||||
pos = tiles.get_neighbor_cell(pos, dir)
|
|
||||||
|
|
||||||
var tile: int = tiles.get_tile_colour(pos)
|
|
||||||
var res = getNextStep(tile)
|
|
||||||
dir = curDir[(curInt[dir] + tiles.numTiles + res.x) % tiles.numTiles]
|
|
||||||
self.set_frame(curInt[dir])
|
|
||||||
|
|
||||||
tiles.set_tile(pos, res.y % tiles.numTiles)
|
|
||||||
|
|
||||||
func move(to: TileSet.CellNeighbor) -> void:
|
|
||||||
var delta: Vector2
|
|
||||||
match to:
|
|
||||||
TileSet.CELL_NEIGHBOR_RIGHT_SIDE:
|
|
||||||
delta = Vector2(tiles.texSize.x, 0)
|
|
||||||
TileSet.CELL_NEIGHBOR_BOTTOM_RIGHT_SIDE:
|
|
||||||
delta = Vector2(tiles.texSize.x/2, tiles.texSize.y/4*3)
|
|
||||||
TileSet.CELL_NEIGHBOR_BOTTOM_LEFT_SIDE:
|
|
||||||
delta = Vector2(-tiles.texSize.x/2, tiles.texSize.y/4*3)
|
|
||||||
TileSet.CELL_NEIGHBOR_LEFT_SIDE:
|
|
||||||
delta = Vector2(-tiles.texSize.x, 0)
|
|
||||||
TileSet.CELL_NEIGHBOR_TOP_LEFT_SIDE:
|
|
||||||
delta = Vector2(-tiles.texSize.x/2, -tiles.texSize.y/4*3)
|
|
||||||
TileSet.CELL_NEIGHBOR_TOP_RIGHT_SIDE:
|
|
||||||
delta = Vector2(tiles.texSize.x/2, -tiles.texSize.y/4*3)
|
|
||||||
_:
|
|
||||||
delta = Vector2(0,0)
|
|
||||||
self.translate(delta)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://b6ll30b7xtwal
|
|
||||||
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
@@ -1,41 +0,0 @@
|
|||||||
extends Camera2D
|
|
||||||
|
|
||||||
@export var minZoom := 0.01
|
|
||||||
@export var maxZoom := 2.0
|
|
||||||
@export var zoomFactor := 0.1
|
|
||||||
@export var zoomDuration := 0.2
|
|
||||||
var zoomLevel: float = 1
|
|
||||||
var dragging: bool = false
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
pass
|
|
||||||
|
|
||||||
func _input(event):
|
|
||||||
if event.is_action_pressed("zoomIn"):
|
|
||||||
setZoomLevel(zoomLevel + zoomFactor)
|
|
||||||
elif event.is_action_pressed("zoomOut"):
|
|
||||||
setZoomLevel(zoomLevel - zoomFactor)
|
|
||||||
elif event.is_action_pressed("resetCamera"):
|
|
||||||
reset()
|
|
||||||
|
|
||||||
func _unhandled_input(event):
|
|
||||||
if event is InputEventMouseButton:
|
|
||||||
if event.get_button_index() == 1:
|
|
||||||
dragging = event.is_pressed()
|
|
||||||
elif event is InputEventMouseMotion:
|
|
||||||
if dragging:
|
|
||||||
self.global_position -= event.get_relative() * 1/zoomLevel
|
|
||||||
|
|
||||||
|
|
||||||
func setZoomLevel(level: float, mouse_world_position = self.get_global_mouse_position()):
|
|
||||||
var old_zoomLevel = zoomLevel
|
|
||||||
zoomLevel = clampf(level, minZoom, maxZoom)
|
|
||||||
|
|
||||||
var direction = (mouse_world_position - global_position)
|
|
||||||
var new_position = self.global_position + direction - ((direction) / (zoomLevel/old_zoomLevel))
|
|
||||||
|
|
||||||
zoom = Vector2(zoomLevel, zoomLevel)
|
|
||||||
self.global_position = new_position
|
|
||||||
|
|
||||||
func reset():
|
|
||||||
self.global_position = Vector2(0, 0)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://bqjbnbfd7jlob
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
extends Node2D
|
|
||||||
|
|
||||||
var t: float = -1
|
|
||||||
var paused: bool = false
|
|
||||||
@export var stepSize: float = 20
|
|
||||||
@export var ant: Sprite2D
|
|
||||||
@export var tiles: TileMapLayer
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready() -> void:
|
|
||||||
pass
|
|
||||||
|
|
||||||
func _input(event):
|
|
||||||
if event.is_action_pressed("togglePause"):
|
|
||||||
paused = !paused
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta: float) -> void:
|
|
||||||
if paused: return
|
|
||||||
|
|
||||||
t += delta
|
|
||||||
if (t > stepSize/1000):
|
|
||||||
t = 0
|
|
||||||
ant.update()
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://by3d3t5ymxl3m
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
[gd_scene load_steps=9 format=3 uid="uid://b6xi32r3co6md"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://by3d3t5ymxl3m" path="res://grid.gd" id="1_bghhw"]
|
|
||||||
[ext_resource type="Script" uid="uid://b6ll30b7xtwal" path="res://ant.gd" id="1_ebq2e"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://ykvioy4g357o" path="res://assets/ant.png" id="3_sle3t"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://b8dilj6w2vq2l" path="res://assets/tiles.png" id="4_fqc2p"]
|
|
||||||
[ext_resource type="Script" uid="uid://cqxfmo3hixad1" path="res://tile_map_layer.gd" id="5_fqc2p"]
|
|
||||||
[ext_resource type="Script" uid="uid://bqjbnbfd7jlob" path="res://camera.gd" id="6_g2qvd"]
|
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_g2qvd"]
|
|
||||||
texture = ExtResource("4_fqc2p")
|
|
||||||
texture_region_size = Vector2i(32, 32)
|
|
||||||
0:0/0 = 0
|
|
||||||
1:0/0 = 0
|
|
||||||
0:1/0 = 0
|
|
||||||
1:1/0 = 0
|
|
||||||
0:2/0 = 0
|
|
||||||
1:2/0 = 0
|
|
||||||
0:3/0 = 0
|
|
||||||
1:3/0 = 0
|
|
||||||
0:4/0 = 0
|
|
||||||
0:5/0 = 0
|
|
||||||
|
|
||||||
[sub_resource type="TileSet" id="TileSet_05i0m"]
|
|
||||||
tile_shape = 3
|
|
||||||
tile_size = Vector2i(32, 32)
|
|
||||||
sources/0 = SubResource("TileSetAtlasSource_g2qvd")
|
|
||||||
|
|
||||||
[node name="Grid" type="Node2D" node_paths=PackedStringArray("ant", "tiles")]
|
|
||||||
script = ExtResource("1_bghhw")
|
|
||||||
stepSize = 1.0
|
|
||||||
ant = NodePath("Ant")
|
|
||||||
tiles = NodePath("TileMapLayer")
|
|
||||||
|
|
||||||
[node name="TileMapLayer" type="TileMapLayer" parent="."]
|
|
||||||
tile_set = SubResource("TileSet_05i0m")
|
|
||||||
collision_enabled = false
|
|
||||||
script = ExtResource("5_fqc2p")
|
|
||||||
|
|
||||||
[node name="Ant" type="Sprite2D" parent="."]
|
|
||||||
position = Vector2(-15.999998, 14.999998)
|
|
||||||
scale = Vector2(0.8, 0.8)
|
|
||||||
texture = ExtResource("3_sle3t")
|
|
||||||
vframes = 6
|
|
||||||
script = ExtResource("1_ebq2e")
|
|
||||||
|
|
||||||
[node name="Camera" type="Camera2D" parent="."]
|
|
||||||
position = Vector2(-3.8146973e-06, -8)
|
|
||||||
scale = Vector2(0.79999983, 0.79999983)
|
|
||||||
script = ExtResource("6_g2qvd")
|
|
||||||
@@ -1,43 +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="New Game Project"
|
|
||||||
run/main_scene="res://grid.tscn"
|
|
||||||
config/features=PackedStringArray("4.5", "Forward Plus")
|
|
||||||
config/icon="res://icon.svg"
|
|
||||||
|
|
||||||
[editor_plugins]
|
|
||||||
|
|
||||||
enabled=PackedStringArray("res://addons/godot-vim/plugin.cfg")
|
|
||||||
|
|
||||||
[input]
|
|
||||||
|
|
||||||
zoomIn={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
zoomOut={
|
|
||||||
"deadzone": 0.2,
|
|
||||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":5,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
togglePause={
|
|
||||||
"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)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
resetCamera={
|
|
||||||
"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":82,"physical_keycode":0,"key_label":0,"unicode":114,"location":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
extends TileMapLayer
|
|
||||||
|
|
||||||
var tiles: Dictionary = {}
|
|
||||||
@onready var numTiles: int = get_tile_set().get_source(0).get_tiles_count()
|
|
||||||
#@onready var texSize: Vector2 = get_tile_set().get_tile_texture(get_tile_set().get_tile_id(0))
|
|
||||||
@onready var texSize: Vector2 = Vector2(32, 32) # TODO: get from tileSet
|
|
||||||
@export var randomColors: bool = true
|
|
||||||
var stateColMap: Dictionary = {
|
|
||||||
}
|
|
||||||
var rng: RandomNumberGenerator = RandomNumberGenerator.new()
|
|
||||||
|
|
||||||
func get_tile_colour(pos: Vector2i) -> int:
|
|
||||||
return tiles.get_or_add(pos, 0)
|
|
||||||
|
|
||||||
# TODO: state should be an enum probably
|
|
||||||
func set_tile(pos: Vector2i, state: int) -> void:
|
|
||||||
self.set_cell(pos, 0, Vector2i(0, state%numTiles))
|
|
||||||
if randomColors:
|
|
||||||
var col: Color = stateColMap.get_or_add(state, Color(rng.randf(), rng.randf(), rng.randf(), 1))
|
|
||||||
self.get_cell_tile_data(pos).set_modulate(col)
|
|
||||||
tiles.erase(pos)
|
|
||||||
tiles.get_or_add(pos, state)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://cqxfmo3hixad1
|
|
||||||