feat: Implement Stop N Go game mode with a new manager script and associated gridmap assets within the MeshLibrary.

This commit is contained in:
Yogi Wiguna
2026-02-24 10:43:00 +08:00
parent a536e060c9
commit ea49eb2e4a
6 changed files with 59 additions and 16 deletions
@@ -10,6 +10,7 @@
[ext_resource type="ArrayMesh" uid="uid://bqvqj3fhf5x51" path="res://assets/models/tiles/tile_ghost.tres" id="6_r32il"]
[ext_resource type="ArrayMesh" uid="uid://cv4bedhida00g" path="res://assets/models/tiles/tile_star.tres" id="7_p5epg"]
[ext_resource type="ArrayMesh" uid="uid://gpnl4cjrivor" path="res://assets/models/tiles/tile_speed.tres" id="7_sx8rm"]
[ext_resource type="ArrayMesh" uid="uid://onkud44h3we1" path="res://assets/models/meshes/safe_zone.res" id="8_cg50n"]
[ext_resource type="ArrayMesh" uid="uid://dx41n2x8v30r1" path="res://assets/models/meshes/crack.res" id="10_r32il"]
[ext_resource type="Texture2D" uid="uid://dpkx1a780pvwv" path="res://assets/textures/tile_diamond.png" id="10_sx8rm"]
@@ -95,7 +96,7 @@ item/1/shapes = []
item/1/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/1/navigation_layers = 1
item/2/name = "safe_zone"
item/2/mesh = ExtResource("3_8v5xv")
item/2/mesh = ExtResource("8_cg50n")
item/2/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/2/mesh_cast_shadow = 1
item/2/shapes = []
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

+41
View File
@@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cw1nmpknfgbuu"
path.s3tc="res://.godot/imported/start_n_finish.jpg-f99b3789c83f30a48c1d54337a904fe9.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/textures/start_n_finish.jpg"
dest_files=["res://.godot/imported/start_n_finish.jpg-f99b3789c83f30a48c1d54337a904fe9.s3tc.ctex"]
[params]
compress/mode=2
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=true
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=0
+16 -15
View File
@@ -22,7 +22,8 @@ var finish_line_x: int = 21 # Right side of the map for win condition
# Tile IDs
const TILE_WALKABLE = 0
const TILE_START = 2 # Start Line
const TILE_START = 3 # Start Line
const TILE_FINISH = 3 # Finish Line
const TILE_SAFE = 2 # Green Safe Zone
const TILE_OBSTACLE = 4 # Wall
@@ -143,7 +144,7 @@ func _update_stop_timer_visuals():
var hbox = stop_timer_node.get_node_or_null("HBox")
if hbox:
stop_segments.clear()
for i in range(4):
for i in range(3):
var seg = hbox.get_node_or_null("Segment%d" % i)
if seg: stop_segments.append(seg)
@@ -173,9 +174,9 @@ func _update_stop_timer_visuals():
stop_timer_node.visible = true
if current_phase == Phase.GO:
# GO Phase: All dim unless in last 4 seconds
# GO Phase: All dim unless in last 3 seconds
for i in range(stop_segments.size()):
var threshold = 4.0 - i
var threshold = 3.0 - i
if phase_timer <= threshold:
stop_segments[i].add_theme_stylebox_override("panel", lit_style)
else:
@@ -277,6 +278,8 @@ func _apply_arena_setup():
var tile_id = TILE_WALKABLE
if x == 0:
tile_id = TILE_START
elif x == gridmap.columns - 1:
tile_id = TILE_FINISH
elif x in safe_columns:
tile_id = TILE_SAFE
@@ -352,16 +355,14 @@ func _spawn_mission_tiles():
if base_tile == TILE_OBSTACLE:
continue
# Randomly populate other floors with goal tiles
# 30% chance to have a tile to avoid overcrowding
if randf() < 0.3:
var tile_type = goal_items[randi() % goal_items.size()]
gridmap.set_cell_item(Vector3i(x, 1, z), tile_type)
# Sync to clients
var main = get_node("/root/Main")
if main:
main.rpc("sync_grid_item", x, 1, z, tile_type)
# Spawn tiles on all floors (100% density)
var tile_type = goal_items[randi() % goal_items.size()]
gridmap.set_cell_item(Vector3i(x, 1, z), tile_type)
# Sync to clients
var main = get_node("/root/Main")
if main:
main.rpc("sync_grid_item", x, 1, z, tile_type)
func _assign_missions():
# NO-OP: Missions are now achievement-based (Complete 3 Goals)
@@ -384,7 +385,7 @@ func check_movement_violation(player_id: int, from: Vector2i, to: Vector2i) -> b
# Usually implies checking if you ARE in a safe zone.
var tile_from = gridmap.get_cell_item(Vector3i(from.x, 0, from.y))
if tile_from != TILE_SAFE:
if tile_from != TILE_SAFE and tile_from != TILE_START and tile_from != TILE_FINISH:
_penalize_player(player_id)
return true
return false