Author SHA1 Message Date
samwise bd8f6a943d Player.gd, board.gd now support basic exploration system. Supports a 10 x 10 board by default. 2026-10-29 14:08:01 -05:00
NotDinoBits d53bb7ed21 Added new files as stated in previous commit
- Because I forgot to add them the first time (v_v)
2026-10-27 17:44:47 -05:00
NotDinoBits 69b42668ca Added more basic templates and scripts and started a combat scene
- Added combat_mode.tscn
- Added entity_template.tscn and entity.gd
- Added card_template.tscn
- Made minor edits to header comments in board.gd and player.gd
2026-10-27 17:30:50 -05:00
21 changed files with 395 additions and 170 deletions

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b7j6r3smplfs8"
path="res://.godot/imported/untitled.png-febd16b8b72c9e59c718b68ef7a066fd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/sprites/untitled.png"
dest_files=["res://.godot/imported/untitled.png-febd16b8b72c9e59c718b68ef7a066fd.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
+3 -2
View File
@@ -11,13 +11,14 @@ config_version=5
[application]
config/name="Spooky Game"
run/main_scene="uid://cdtw2fhkxtw50"
config/features=PackedStringArray("4.7", "Forward Plus")
config/icon="res://icon.svg"
[display]
window/size/viewport_width=480
window/size/viewport_height=720
window/size/viewport_width=720
window/size/viewport_height=480
window/stretch/mode="canvas_items"
[input]
-34
View File
@@ -1,34 +0,0 @@
#------------------------------------------------------------
# Script: Board Manager
# Author: NotDinoBits
# Contributers:
# Godot Version: 4.7
# Language: GDScript
#
# Description: Manages the boards the player navigates in
# exploration mode. Boards are composed of tiles
# given by a width and a height, with every element
# of the board being contained within a tile
#
# The camera in exploration mode is confined to the
# Dimensions of the board
#------------------------------------------------------------
# NOTE: Getting exploration to work is a low priority. Main priority should be the combat system
extends TileMapLayer
# Node Variables
# Width and Height of the board
@export var width = 0
@export var height = 0
# 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 -1
View File
@@ -1,6 +1,6 @@
[gd_scene format=3 uid="uid://bynls777ha833"]
[ext_resource type="Script" uid="uid://57f2lwqknbun" path="res://scenes/board.gd" id="1_bw3vb"]
[ext_resource type="Script" uid="uid://57f2lwqknbun" path="res://scripts/board.gd" id="1_bw3vb"]
[node name="Board" type="TileMapLayer" unique_id=645190065]
script = ExtResource("1_bw3vb")
+7
View File
@@ -0,0 +1,7 @@
[gd_scene format=3 uid="uid://cfxt1fck3mng7"]
[ext_resource type="Texture2D" uid="uid://rse7l4smx7j1" path="res://textures/spooky/card_template.png" id="1_y1fi3"]
[node name="CardTemplate" type="Sprite2D" unique_id=1386484005]
scale = Vector2(2, 2)
texture = ExtResource("1_y1fi3")
+5
View File
@@ -0,0 +1,5 @@
[gd_scene format=3 uid="uid://h0rnqu6fxtgv"]
[node name="CombatMode" type="Node2D" unique_id=929006189]
[node name="Camera2D" type="Camera2D" parent="." unique_id=1150031779]
+19
View File
@@ -0,0 +1,19 @@
[gd_scene format=3 uid="uid://cx2hoy8j7kw4a"]
[ext_resource type="Texture2D" uid="uid://svvapjji0cug" path="res://textures/godot_default/dodge_the_creeps_2d_assets/art/playerGrey_walk1.png" id="1_agxdn"]
[ext_resource type="Script" uid="uid://v81aouhld2ch" path="res://scenes/entity.gd" id="2_liii0"]
[sub_resource type="SpriteFrames" id="SpriteFrames_7jfs7"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("1_agxdn")
}],
"loop": 1,
"name": &"default",
"speed": 5.0
}]
[node name="EntityTemplate" type="AnimatedSprite2D" unique_id=1553557885]
sprite_frames = SubResource("SpriteFrames_7jfs7")
script = ExtResource("2_liii0")
-81
View File
@@ -1,81 +0,0 @@
[gd_scene format=3 uid="uid://xud2q0rnbjr2"]
[ext_resource type="PackedScene" uid="uid://bynls777ha833" path="res://scenes/board.tscn" id="1_kb1q4"]
[ext_resource type="Texture2D" uid="uid://btvgtetl7xo44" path="res://textures/spooky/tileset1.tres" id="2_5idnx"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_gkkyx"]
texture = ExtResource("2_5idnx")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
1:0/0 = 0
2:0/0 = 0
3:0/0 = 0
4:0/0 = 0
5:0/0 = 0
6:0/0 = 0
7:0/0 = 0
0:1/0 = 0
1:1/0 = 0
2:1/0 = 0
3:1/0 = 0
4:1/0 = 0
5:1/0 = 0
6:1/0 = 0
7:1/0 = 0
0:2/0 = 0
1:2/0 = 0
2:2/0 = 0
3:2/0 = 0
4:2/0 = 0
5:2/0 = 0
6:2/0 = 0
7:2/0 = 0
0:3/0 = 0
1:3/0 = 0
2:3/0 = 0
3:3/0 = 0
4:3/0 = 0
5:3/0 = 0
6:3/0 = 0
7:3/0 = 0
0:4/0 = 0
1:4/0 = 0
2:4/0 = 0
3:4/0 = 0
4:4/0 = 0
5:4/0 = 0
6:4/0 = 0
7:4/0 = 0
0:5/0 = 0
1:5/0 = 0
2:5/0 = 0
3:5/0 = 0
4:5/0 = 0
5:5/0 = 0
6:5/0 = 0
7:5/0 = 0
0:6/0 = 0
1:6/0 = 0
2:6/0 = 0
3:6/0 = 0
4:6/0 = 0
5:6/0 = 0
6:6/0 = 0
7:6/0 = 0
0:7/0 = 0
1:7/0 = 0
2:7/0 = 0
3:7/0 = 0
4:7/0 = 0
5:7/0 = 0
6:7/0 = 0
7:7/0 = 0
[sub_resource type="TileSet" id="TileSet_bw3vb"]
sources/0 = SubResource("TileSetAtlasSource_gkkyx")
[node name="ExplorationTest" type="Node2D" unique_id=1901038750]
[node name="Board" parent="." unique_id=645190065 instance=ExtResource("1_kb1q4")]
tile_set = SubResource("TileSet_bw3vb")
collision_enabled = false
-37
View File
@@ -1,37 +0,0 @@
#------------------------------------------------------------
# Script: Player Manager
# Author: NotDinoBits
# Contributers:
# Godot Version: 4.7
# Language: GDScript
#
# Description: Manages player interaction by listening for
# For inputs and providing an interaction interface
#
# Input reactions change based on what mode the
# game is currently in (exploration, combat, menu)
#------------------------------------------------------------
extends Node2D
# Node Variables
var screen_size
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
screen_size = get_viewport_rect().size
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
#TODO: Create Input listeners for "Combat Mode"
#TODO: Exclude the following block of interactions to "Exploration Mode"
if Input.is_action_just_pressed("hop_right"):
pass
if Input.is_action_just_pressed("hop_left"):
pass
if Input.is_action_just_pressed("hop_up"):
pass
if Input.is_action_just_pressed("hop_down"):
pass
+5 -15
View File
@@ -1,21 +1,11 @@
[gd_scene format=3 uid="uid://cyos2d7rts43r"]
[ext_resource type="Script" uid="uid://0nk20j6jxjmc" path="res://scenes/player.gd" id="1_3vyb7"]
[ext_resource type="Texture2D" uid="uid://svvapjji0cug" path="res://textures/godot_default/dodge_the_creeps_2d_assets/art/playerGrey_walk1.png" id="2_g2els"]
[sub_resource type="SpriteFrames" id="SpriteFrames_7jfs7"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("2_g2els")
}],
"loop": 1,
"name": &"default",
"speed": 5.0
}]
[ext_resource type="Script" uid="uid://0nk20j6jxjmc" path="res://scripts/player.gd" id="1_3vyb7"]
[ext_resource type="Texture2D" uid="uid://b7j6r3smplfs8" path="res://assets/sprites/untitled.png" id="2_g2els"]
[node name="Player" type="Node2D" unique_id=996879118]
script = ExtResource("1_3vyb7")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=810892839]
sprite_frames = SubResource("SpriteFrames_7jfs7")
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=435418109]
position = Vector2(0, -3)
texture = ExtResource("2_g2els")
+9
View File
@@ -1,3 +1,12 @@
[gd_scene format=3 uid="uid://cdtw2fhkxtw50"]
[ext_resource type="PackedScene" uid="uid://bynls777ha833" path="res://scenes/board.tscn" id="1_65evt"]
[ext_resource type="PackedScene" uid="uid://cyos2d7rts43r" path="res://scenes/player.tscn" id="2_j38m8"]
[node name="root_node" type="Node2D" unique_id=25639338]
[node name="Board" parent="." unique_id=645190065 instance=ExtResource("1_65evt")]
[node name="Player" parent="." unique_id=996879118 instance=ExtResource("2_j38m8")]
[node name="Camera2D" type="Camera2D" parent="Player" unique_id=372156859]
+141
View File
@@ -0,0 +1,141 @@
#------------------------------------------------------------
# Script: Board Manager
# Author: NotDinoBits
# Contributors:
#
# Godot Version: 4.7
# Language: GDScript
#
# Description: Manages the exploration board that the player
# navigates. The board consists of a grid of
# square tiles, with dimensions determined by
# width and height.
#
# Currently, the board generates a checkerboard
# pattern and prevents the player from moving
# outside the board boundaries.
#
# Future additions:
# - Wall collision
# - Loot placement and collection
# - Enemy placement and encounters
#------------------------------------------------------------
extends TileMapLayer
#------------------------------------------------------------
# Board Variables
#------------------------------------------------------------
# Number of tiles horizontally and vertically.
# These values can be changed in the Godot Inspector.
@export var width: int = 10
@export var height: int = 10
# Size of each tile in pixels.
# Currently each tile is 64x64 pixels.
@export var tile_size: int = 64
#------------------------------------------------------------
# Initialization
#------------------------------------------------------------
# Called once when the node enters the scene tree.
func _ready() -> void:
# Requests that Godot redraw the board.
# This causes the _draw() function to execute.
queue_redraw()
#------------------------------------------------------------
# Board Generation
#------------------------------------------------------------
# Draws a visible grid based on the board dimensions.
# This currently uses placeholder colors instead of textures.
func _draw() -> void:
# Loop through every coordinate on the board.
for x in range(width):
for y in range(height):
# Default tile color.
var color := Color.LIGHT_GRAY
# Alternate tile colors to create a checkerboard.
# Even coordinate sums use gray; odd sums use light gray.
if (x + y) % 2 == 0:
color = Color.GRAY
# Calculate the position and size of the tile.
# Multiplying x and y by tile_size converts
# grid coordinates into pixel coordinates.
var tile_rect := Rect2(
x * tile_size,
y * tile_size,
tile_size,
tile_size
)
# Draw the filled tile.
draw_rect(tile_rect, color)
# Draw a black outline around each tile.
draw_rect(tile_rect, Color.BLACK, false, 1.0)
#------------------------------------------------------------
# Movement Validation
#------------------------------------------------------------
# Checks whether a player can move to a given tile.
#
# Parameter:
# tile - The grid coordinate the player wants to enter.
#
# Returns:
# true - The coordinate is inside the board.
# false - The coordinate is outside the board.
func can_move_to(tile: Vector2i) -> bool:
return (
tile.x >= 0
and tile.x < width
and tile.y >= 0
and tile.y < height
)
#------------------------------------------------------------
# Coordinate Conversion
#------------------------------------------------------------
# Converts a grid coordinate into a world position.
#
# The player uses this function to position itself
# at the center of a tile after moving.
#
# Parameter:
# tile - The grid coordinate to convert.
#
# Returns:
# The center of the tile in world coordinates.
func get_tile_world_position(tile: Vector2i) -> Vector2:
# Calculate the center of the tile in local coordinates.
# Adding 0.5 shifts the position from the top-left
# corner of the tile to its center.
var tile_center := Vector2(
(tile.x + 0.5) * tile_size,
(tile.y + 0.5) * tile_size
)
# Convert the local tile position to world coordinates.
# This also accounts for the Board node's position.
return to_global(tile_center)
File renamed without changes.
+65
View File
@@ -0,0 +1,65 @@
#------------------------------------------------------------
# Script: Entity Template
# Author: NotDinoBits
# Contributers:
#
# Godot Version: 4.7
# Language: GDScript
#
# Interfaces: Combat_Actions (maybe)
#
# Description: Provides an easily-modifiable template for
# basic entities. Entities have combat mode and
# exploration mode functions.
#
# GENERAL
# General variables and functions need at any time
# Integers: HP, Attack Power (AP), Defense
# Card-List: Inventory
# Functions:
#
# COMBAT MODE
# Combat-mode specific variables and functions
# Integers: Mana
# Functions: damage, action, card, addMaxMana
#
# EXPLORATION MODE
# Exploration-mode specific variables and functions
# Functions: left, right, up, down
#------------------------------------------------------------
extends AnimatedSprite2D
# --- SETUP ---
const CARD_TEMPLATE = preload("uid://cfxt1fck3mng7")
# --- VARIABLES ---
# --- General
@export var hp = 0
@export var ap = 0
@export var defense = 0
# The inventory show only contain card objects derived from card_template.tscn
@export var inventory = []
# --- Combat
var mana_max = 1
var mana = 0
# --- Exploration
# --- FUNCTIONS ---
# --- General
# --- Combat
# --- Exploration
# 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
View File
@@ -0,0 +1 @@
uid://v81aouhld2ch
+59
View File
@@ -0,0 +1,59 @@
#------------------------------------------------------------
# Script: Player Manager
# Author: NotDinoBits
# Contributers:
#
# Godot Version: 4.7
# Language: GDScript
#
# Description: Manages player interaction by listening for
# For inputs and providing an interaction interface
#
# Input reactions change based on what mode the
# game is currently in (exploration, combat, menu)
#------------------------------------------------------------
extends Node2D
var screen_size
# Player position on the grid
var grid_position: Vector2i = Vector2i(2, 2)
# Reference to Board
@onready var board = get_node("../Board")
func _ready() -> void:
screen_size = get_viewport_rect().size
global_position = board.get_tile_world_position(grid_position)
func _process(_delta: float) -> void:
# Exploration mode movement
if Input.is_action_just_pressed("hop_right"):
move_player(Vector2i.RIGHT)
elif Input.is_action_just_pressed("hop_left"):
move_player(Vector2i.LEFT)
elif Input.is_action_just_pressed("hop_up"):
move_player(Vector2i.UP)
elif Input.is_action_just_pressed("hop_down"):
move_player(Vector2i.DOWN)
func move_player(direction: Vector2i) -> void:
var target_position: Vector2i = grid_position + direction
# Check board boundaries
if not board.can_move_to(target_position):
return
# Update player's grid location
grid_position = target_position
# Move player to the center of the tile
global_position = board.get_tile_world_position(grid_position)
File renamed without changes.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://rse7l4smx7j1"
path="res://.godot/imported/card_template.png-43698d203797a1ea0f472478f803dd0a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://textures/spooky/card_template.png"
dest_files=["res://.godot/imported/card_template.png-43698d203797a1ea0f472478f803dd0a.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