Initial commit: Godot idle game project setup with basic player movement
This commit is contained in:
commit
ef38f19f04
7 changed files with 130 additions and 0 deletions
22
.gitignore
vendored
Normal file
22
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
# Godot 4+ specific ignores
|
||||||
|
.godot/
|
||||||
|
*.tmp
|
||||||
|
|
||||||
|
# Assets folder (temporarily ignored)
|
||||||
|
assets/
|
||||||
|
|
||||||
|
# Imported translations (automatically generated from CSV files)
|
||||||
|
*.translation
|
||||||
|
|
||||||
|
# Mono-specific ignores
|
||||||
|
.mono/
|
||||||
|
data_*/
|
||||||
|
mono_crash.*.json
|
||||||
|
|
||||||
|
# System/IDE-specific ignores
|
||||||
|
.DS_Store
|
||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
46
CLAUDE.md
Normal file
46
CLAUDE.md
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
# CLAUDE.md
|
||||||
|
|
||||||
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||||
|
|
||||||
|
## Project Overview
|
||||||
|
This is a Godot 4.3 idle game project. The game uses Godot's Forward Plus rendering method and is configured for 1280x720 resolution.
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
|
||||||
|
### Running the Game
|
||||||
|
- Open the project in Godot 4.3 Editor
|
||||||
|
- Press F5 or click the Play button to run the main scene
|
||||||
|
- Press F6 to run the current scene
|
||||||
|
|
||||||
|
### Development Workflow
|
||||||
|
Since this is a Godot project, most development happens through:
|
||||||
|
1. The Godot Editor for scene editing and visual work
|
||||||
|
2. External text editor/IDE for GDScript files in `scripts/`
|
||||||
|
3. Asset pipeline through `assets/` subdirectories
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
### Scene Structure
|
||||||
|
- **Main.tscn**: Root scene that instantiates all game elements
|
||||||
|
- **Player.tscn**: CharacterBody2D-based player with movement controls
|
||||||
|
- Scenes reference scripts via `res://scripts/` paths
|
||||||
|
- Scene UIDs are auto-generated by Godot (e.g., `uid://b4ncr5x8y7kmt`)
|
||||||
|
|
||||||
|
### Script Organization
|
||||||
|
- All GDScript files go in `scripts/`
|
||||||
|
- Scripts extend appropriate Godot node types (Node2D, CharacterBody2D, etc.)
|
||||||
|
- Player movement uses built-in input actions (ui_left, ui_right, ui_up, ui_down)
|
||||||
|
|
||||||
|
### Asset Organization
|
||||||
|
```
|
||||||
|
assets/
|
||||||
|
├── sprites/ # 2D graphics and textures
|
||||||
|
├── sounds/ # Audio files (music, SFX)
|
||||||
|
└── fonts/ # Font files
|
||||||
|
```
|
||||||
|
|
||||||
|
## Important Notes
|
||||||
|
- The project uses placeholder graphics (PlaceholderTexture2D) for prototyping
|
||||||
|
- Movement speed is defined as a constant in Player.gd (SPEED = 300.0)
|
||||||
|
- The `.godot/` directory is auto-generated and should never be edited manually
|
||||||
|
- Scene files (.tscn) use Godot's text format and can be edited manually if needed, but prefer using the Godot Editor
|
||||||
19
project.godot
Normal file
19
project.godot
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
; Engine configuration file.
|
||||||
|
; It's best edited using the editor UI and not directly,
|
||||||
|
; since the properties are organized in sections here.
|
||||||
|
|
||||||
|
[application]
|
||||||
|
|
||||||
|
config/name="IdleGame"
|
||||||
|
run/main_scene="res://scenes/Main.tscn"
|
||||||
|
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||||
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/size/viewport_width=1280
|
||||||
|
window/size/viewport_height=720
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
renderer/rendering_method="forward_plus"
|
||||||
10
scenes/Main.tscn
Normal file
10
scenes/Main.tscn
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://b4ncr5x8y7kmt"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/Main.gd" id="1_0xvmr"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dxqwp3y8r4ktm" path="res://scenes/Player.tscn" id="2_1yx8k"]
|
||||||
|
|
||||||
|
[node name="Main" type="Node2D"]
|
||||||
|
script = ExtResource("1_0xvmr")
|
||||||
|
|
||||||
|
[node name="Player" parent="." instance=ExtResource("2_1yx8k")]
|
||||||
|
position = Vector2(640, 360)
|
||||||
18
scenes/Player.tscn
Normal file
18
scenes/Player.tscn
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
[gd_scene load_steps=4 format=3 uid="uid://dxqwp3y8r4ktm"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/Player.gd" id="1_hqxmv"]
|
||||||
|
|
||||||
|
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_1"]
|
||||||
|
size = Vector2(64, 64)
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1"]
|
||||||
|
size = Vector2(64, 64)
|
||||||
|
|
||||||
|
[node name="Player" type="CharacterBody2D"]
|
||||||
|
script = ExtResource("1_hqxmv")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = SubResource("PlaceholderTexture2D_1")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_1")
|
||||||
7
scripts/Main.gd
Normal file
7
scripts/Main.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
print("Game started!")
|
||||||
|
|
||||||
|
func _process(_delta):
|
||||||
|
pass
|
||||||
8
scripts/Player.gd
Normal file
8
scripts/Player.gd
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
const SPEED = 300.0
|
||||||
|
|
||||||
|
func _physics_process(_delta):
|
||||||
|
var direction = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
|
||||||
|
velocity = direction * SPEED
|
||||||
|
move_and_slide()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue