Loads of stuff
This commit is contained in:
parent
f3af522683
commit
66ce3ff503
413 changed files with 14802 additions and 0 deletions
11
stages/TestTileMap/TestTileMap.tscn
Normal file
11
stages/TestTileMap/TestTileMap.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://5l63jip8pcfl"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c6q0enhmgus55" path="res://Stages/TestTileMap/test_tile_map.gd" id="1_2clj7"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwcevwwphdvq" path="res://Entities/GroundTile/GroundTile.tscn" id="2_ginxf"]
|
||||
|
||||
[node name="TestTileMap" type="Node3D"]
|
||||
script = ExtResource("1_2clj7")
|
||||
ground_tile = ExtResource("2_ginxf")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.844459, 0.535621, 0, -0.535621, 0.844459, 0, 1.57618, 1.71313)
|
||||
41
stages/TestTileMap/test_tile_map.gd
Normal file
41
stages/TestTileMap/test_tile_map.gd
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
extends Node3D
|
||||
@export var ground_tile: PackedScene
|
||||
@export var map_width: int = 500
|
||||
@export var map_height: int = 500
|
||||
@export var tile_size: float = 1.0 # Size of each tile (adjust based on your tile model)
|
||||
|
||||
func _ready() -> void:
|
||||
Log.pr('Testing tile map generation')
|
||||
create_tiles()
|
||||
|
||||
func create_tiles() -> void:
|
||||
Log.pr('I am going to put down some tiles...')
|
||||
|
||||
if not ground_tile:
|
||||
Log.pr('Error: ground_tile scene is not assigned!')
|
||||
return
|
||||
|
||||
# Calculate the starting position to center the grid
|
||||
var start_x = - (map_width * tile_size) / 2.0
|
||||
var start_z = - (map_height * tile_size) / 2.0
|
||||
|
||||
# Generate tiles in a grid pattern
|
||||
for x in range(map_width):
|
||||
for z in range(map_height):
|
||||
# Instantiate the tile scene
|
||||
var tile_instance = ground_tile.instantiate()
|
||||
|
||||
# Calculate world position
|
||||
var world_pos = Vector3(
|
||||
start_x + (x * tile_size),
|
||||
0, # Y position - adjust if needed
|
||||
start_z + (z * tile_size)
|
||||
)
|
||||
|
||||
# Set the position
|
||||
tile_instance.position = world_pos
|
||||
|
||||
# Add to the scene tree
|
||||
add_child(tile_instance)
|
||||
|
||||
Log.pr('Finished creating %d tiles (%dx%d grid)' % [map_width * map_height, map_width, map_height])
|
||||
1
stages/TestTileMap/test_tile_map.gd.uid
Normal file
1
stages/TestTileMap/test_tile_map.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c6q0enhmgus55
|
||||
Loading…
Add table
Add a link
Reference in a new issue