First commit

This commit is contained in:
Dan 2024-08-14 20:28:46 -04:00
commit 6e7059f1a3
19 changed files with 1616 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

15
.github/workflows/discord_sync.yml vendored Normal file
View File

@ -0,0 +1,15 @@
name: Discord Webhook
on: [push]
jobs:
git:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run Discord Webhook
uses: johnnyhuy/actions-discord-git-webhook@main
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# Godot 4+ specific ignores
.godot/

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2016-2023 The Godot Engine community
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
[configuration]
entry_symbol = "git_plugin_init"
compatibility_minimum = "4.1.0"
[libraries]
macos.editor = "macos/libgit_plugin.macos.editor.universal.dylib"
windows.editor.x86_64 = "win64/libgit_plugin.windows.editor.x86_64.dll"
linux.editor.x86_64 = "linux/libgit_plugin.linux.editor.x86_64.so"
linux.editor.arm64 = "linux/libgit_plugin.linux.editor.arm64.so"
linux.editor.rv64 = ""

View File

@ -0,0 +1,7 @@
[plugin]
name="Godot Git Plugin"
description="This plugin lets you interact with Git without leaving the Godot editor. More information can be found at https://github.com/godotengine/godot-git-plugin/wiki"
author="twaritwaikar"
version="v3.1.1"
script="godot-git-plugin.gd"

29
data/crop_config.json Normal file
View File

@ -0,0 +1,29 @@
{
"wheat": {
"growth_time": 12.0,
"stages": 3,
"sprite_paths": [
"res://sprites/wheat_stage_1.png",
"res://sprites/wheat_stage_2.png",
"res://sprites/wheat_stage_3.png"
]
},
"potato": {
"growth_time": 15.0,
"stages": 4,
"sprite_paths": [
"res://sprites/potato_stage_1.png",
"res://sprites/potato_stage_2.png",
"res://sprites/potato_stage_3.png",
"res://sprites/potato_stage_4.png"
]
},
"carrot": {
"growth_time": 8.0,
"stages": 2,
"sprite_paths": [
"res://sprites/carrot_stage_1.png",
"res://sprites/carrot_stage_2.png"
]
}
}

1
icon.svg Normal file
View File

@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z" fill="#478cbf"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>

After

Width:  |  Height:  |  Size: 949 B

37
icon.svg.import Normal file
View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b03iaq5jjxtjo"
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/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

25
project.godot Normal file
View File

@ -0,0 +1,25 @@
; 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="StarClone"
config/features=PackedStringArray("4.2", "GL Compatibility")
config/icon="res://icon.svg"
[editor]
version_control/plugin_name="GitPlugin"
version_control/autoload_on_startup=true
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"

49
scripts/movement.gd Normal file
View File

@ -0,0 +1,49 @@
extends CharacterBody2D
@export var move_speed = 100 # Pixels per second
@export var tile_size = 32 # Size of each "space" in pixels
var is_moving = false
var target_position = Vector2.ZERO
# Called when the node is added to the scene
func _ready():
target_position = position
# Called every frame
func _process(delta):
if not is_moving:
handle_input()
if is_moving:
move_towards_target(delta)
# Handle player input for movement
func handle_input():
var direction = Vector2.ZERO
if Input.is_action_just_pressed("ui_right"):
direction.x += 1
elif Input.is_action_just_pressed("ui_left"):
direction.x -= 1
elif Input.is_action_just_pressed("ui_down"):
direction.y += 1
elif Input.is_action_just_pressed("ui_up"):
direction.y -= 1
if direction != Vector2.ZERO:
set_target_position(direction)
# Set the target position for movement
func set_target_position(direction: Vector2):
target_position = position + direction * tile_size
is_moving = true
# Move the player towards the target position
func move_towards_target(delta):
var distance = move_speed * delta
position = position.move_toward(target_position, distance)
if position.distance_to(target_position) < 1:
position = target_position
is_moving = false

19
scripts/place_plot.gd Normal file
View File

@ -0,0 +1,19 @@
extends Node2D
@export var plot_scene: PackedScene # Reference to the plot scene to instance
# Called when the node is added to the scene
func _ready():
set_process_input(true)
# Handle input events for plot placement
func _input(event: InputEvent):
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
var plot_position = get_global_mouse_position()
place_plot(plot_position)
# Place a plot at the given position
func place_plot(position: Vector2):
var plot_instance = plot_scene.instantiate()
plot_instance.position = position
add_child(plot_instance)

48
scripts/plant_crops.gd Normal file
View File

@ -0,0 +1,48 @@
extends Area2D
@export var crop_type: String
var growth_time: float
var stages: int
var sprite_paths: Array
var current_stage: int = 0
var timer: Timer
# Load crop configurations
var crop_config = load("res://data/crop_config.json").get_data()
# Called when the node is added to the scene
func _ready():
if crop_type in crop_config:
growth_time = crop_config[crop_type]["growth_time"]
stages = crop_config[crop_type]["stages"]
sprite_paths = crop_config[crop_type]["sprite_paths"]
else:
print("Unknown crop type: ", crop_type)
return
timer = Timer.new()
timer.one_shot = true
timer.timeout.connect(_on_timer_timeout)
add_child(timer)
start_growing()
# Start the growth process
func start_growing():
if current_stage < stages:
timer.start(growth_time / stages)
# Called when the timer times out
func _on_timer_timeout():
current_stage += 1
update_crop_stage()
if current_stage < stages:
start_growing()
# Update the crop's visual representation for the current stage
func update_crop_stage():
if current_stage - 1 < sprite_paths.size():
var sprite = $Sprite
sprite.texture = load(sprite_paths[current_stage - 1])