This commit is contained in:
Exobyt 2024-09-20 22:46:27 +02:00
parent 5643fee9d3
commit 99d5016ac2
9 changed files with 171 additions and 149 deletions

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.cte
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View file

@ -12,7 +12,7 @@ config_version=5
config/name="Texpand"
config/description="Tetris with special Blocks that expands"
config/version="2.0.0"
config/version="2.0.1"
config/tags=PackedStringArray("game_jam")
run/main_scene="res://scenes/Main/main.tscn"
config/features=PackedStringArray("4.3", "GL Compatibility")
@ -24,8 +24,8 @@ boot_splash/minimum_display_time=1
[autoload]
DebugMenu="*res://addons/debug_menu/debug_menu.tscn"
GLOBAL="*res://scenes/Globals/global.gd"
DebugMenu="*res://addons/debug_menu/debug_menu.tscn"
[display]
@ -44,11 +44,17 @@ version_control/autoload_on_startup=true
enabled=PackedStringArray("res://addons/debug_menu/plugin.cfg")
[github_to_itch]
config/itch_username="Exobyt"
config/itch_project_name=""
[global_group]
Block="Block"
ExpandBlock=""
Border=""
Part=""
[input]

View file

@ -4,7 +4,7 @@ var points = 0
enum SPEED {MIN=20, MAX=80}
var currentSpeed := SPEED.MIN
var currentSpeed = SPEED.MIN
var hasSelectedSpeed = false
@ -85,6 +85,6 @@ func convertIntToTime(value) -> String:
func speedUp():
if currentSpeed + 1 <= SPEED.MAX:
currentSpeed += 1
currentSpeed += 0.5
else:
currentSpeed = SPEED.MAX

View file

@ -1,15 +1,19 @@
extends Node2D
extends Area2D
static var rowRemoved = false
func isFull():
var full = true
for i in get_children():
i.force_raycast_update()
#print(i.get_collider())
if not i.is_colliding():
full = false
return full
var amount = 0
for i in get_overlapping_areas():
if i.is_in_group("Part"):
if i.get_parent().get_parent().expand:
amount += 2
else:
amount += 1
if amount >= 10:
return true
else:
return false
func check():
if not GLOBAL.rowRemoved:
@ -18,16 +22,29 @@ func check():
GLOBAL.rowRemoved = true
var blocksSplit = []
var removeBlock = []
for i in get_children():
i.force_raycast_update()
if i.get_collider() != null:
blocksSplit.append(i.get_collider().get_parent().get_parent())
for i in get_overlapping_areas():
if i.is_in_group("Part"):
var block = i.get_parent().get_parent()
blocksSplit.append(block)
i.free()
if GLOBAL.currentMode == GLOBAL.MODES.TIME:
GLOBAL.time += i.get_collider().get_parent().get_parent().type
if i.get_collider().get_parent().get_parent().expand:
GLOBAL.points += i.get_collider().get_parent().get_parent().type * 2
GLOBAL.time += block.type
if block.expand:
GLOBAL.points += block.type * 2
else:
GLOBAL.points += i.get_collider().get_parent().get_parent().type
i.get_collider().free()
GLOBAL.points += block.type
for j in blocksSplit:
j.splitParts()
#for i in get_children():
#i.force_raycast_update()
#if i.get_collider() != null:
#blocksSplit.append(i.get_collider().get_parent().get_parent())
#if GLOBAL.currentMode == GLOBAL.MODES.TIME:
#GLOBAL.time += i.get_collider().get_parent().get_parent().type
#if i.get_collider().get_parent().get_parent().expand:
#GLOBAL.points += i.get_collider().get_parent().get_parent().type * 2
#else:
#GLOBAL.points += i.get_collider().get_parent().get_parent().type
#i.get_collider().free()
#for j in blocksSplit:
#j.splitParts()

View file

@ -1,66 +1,16 @@
[gd_scene load_steps=2 format=3 uid="uid://ibyhtfpc52vc"]
[gd_scene load_steps=3 format=3 uid="uid://ibyhtfpc52vc"]
[ext_resource type="Script" path="res://scenes/Grid/row_test.gd" id="1_2nxxe"]
[node name="RowTest" type="Node2D"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_t04sr"]
size = Vector2(624, 48)
[node name="RowTest" type="Area2D"]
collision_layer = 16
collision_mask = 8
input_pickable = false
script = ExtResource("1_2nxxe")
[node name="RayCast2D" type="RayCast2D" parent="."]
position = Vector2(32, 24)
target_position = Vector2(0, 16)
collision_mask = 24
hit_from_inside = true
[node name="RayCast2D2" type="RayCast2D" parent="."]
position = Vector2(96, 24)
target_position = Vector2(0, 16)
collision_mask = 24
hit_from_inside = true
[node name="RayCast2D3" type="RayCast2D" parent="."]
position = Vector2(160, 24)
target_position = Vector2(0, 16)
collision_mask = 24
hit_from_inside = true
[node name="RayCast2D4" type="RayCast2D" parent="."]
position = Vector2(224, 24)
target_position = Vector2(0, 16)
collision_mask = 24
hit_from_inside = true
[node name="RayCast2D5" type="RayCast2D" parent="."]
position = Vector2(288, 24)
target_position = Vector2(0, 16)
collision_mask = 24
hit_from_inside = true
[node name="RayCast2D6" type="RayCast2D" parent="."]
position = Vector2(352, 24)
target_position = Vector2(0, 16)
collision_mask = 24
hit_from_inside = true
[node name="RayCast2D7" type="RayCast2D" parent="."]
position = Vector2(416, 24)
target_position = Vector2(0, 16)
collision_mask = 24
hit_from_inside = true
[node name="RayCast2D8" type="RayCast2D" parent="."]
position = Vector2(480, 24)
target_position = Vector2(0, 16)
collision_mask = 24
hit_from_inside = true
[node name="RayCast2D9" type="RayCast2D" parent="."]
position = Vector2(544, 24)
target_position = Vector2(0, 16)
collision_mask = 24
hit_from_inside = true
[node name="RayCast2D10" type="RayCast2D" parent="."]
position = Vector2(608, 24)
target_position = Vector2(0, 16)
collision_mask = 24
hit_from_inside = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(320, 32)
shape = SubResource("RectangleShape2D_t04sr")

View file

@ -38,18 +38,49 @@ func _physics_process(delta: float) -> void:
elif Input.is_action_just_pressed("right"):
if not isRightColliding():
global_position.x += GLOBAL.GRID
if Input.is_action_pressed("down"):
velocity = get_gravity() * delta * GLOBAL.SPEED.MAX
else:
velocity = get_gravity() * delta * GLOBAL.currentSpeed
else:
if stopped and not isBottomColliding():
position.y += GLOBAL.GRID
snapPosition()
if Input.is_action_pressed("down") and isCurrent():
velocity = get_gravity() * delta * GLOBAL.SPEED.MAX
else:
velocity = get_gravity() * delta * GLOBAL.currentSpeed
#if isBottomColliding():
#print(global_position)
#print(global_position.snapped(Vector2(64,64)))
#print(global_position.snapped(Vector2(64,64)) - Vector2(32,32))
#print(int((global_position.snapped(Vector2(64,64)) - Vector2(32,32)).y))
#print(int((global_position.snapped(Vector2(64,64)) - Vector2(32,32)).x))
#print(int(global_position.x-32) % GLOBAL.GRID)
#print(int(global_position.y-32) % GLOBAL.GRID)
#print(name + ": " + str(not isBottomColliding() and not isCurrent()))
#print(global_position)
#print(int(global_position.x-32) % GLOBAL.GRID)
#print(int(global_position.y-32) % GLOBAL.GRID)
#if isBottomColliding():
#
#if not int(global_position.x-32) % GLOBAL.GRID == 0:
#global_position.x = global_position.snapped(Vector2(64,64)).x -32
#if not int(global_position.y-32) % GLOBAL.GRID == 0:
#global_position.y = global_position.snapped(Vector2(64,64)).y -32
#global_position = global_position.snapped(Vector2(64,64))
#position.y += GLOBAL.GRID
if is_on_floor():
position = position.snapped(Vector2(32,32))
#if is_on_floor():
#position = position.snapped(Vector2(32,32))
#if not is_on_floor() and not isCurrent() and not isBottomColliding():
#position += Vector2(0,64)
#print(not isBottomColliding())
#if stopped and not isBottomColliding():
#position += Vector2(0,64)
if isCurrent() and not expanding and not GLOBAL.blockStopped:
move_and_slide()
else:
velocity = Vector2.ZERO
func expandBlocks():
@ -77,10 +108,10 @@ func expandBlocks():
position.x += GLOBAL.GRID
if isCollidingBorder():
position.y -= GLOBAL.GRID
for i in partsContainer.get_children():
if i != null:
i.removeOverlapp()
#print(i)
i.removeOverlapp()
#splitParts()
func addParts():
@ -96,31 +127,11 @@ func addParts():
look = 3
newPart.init(i.position,look)
func splitParts():
for i in $PartsContainer.get_children():
var newBlock = load(block1x1).instantiate()
get_parent().add_child(newBlock)
newBlock.init(i.global_position, expand)
newBlock.setColor(modulate)
queue_free()
func setColor(color):
modulate = color
func init(pos, scaler=null):
if scaler != null:
if scaler:
expand = scaler
#$AnimationPlayer.play("Expand")
scale = Vector2(2,2)
addParts()
id = GLOBAL.getNewID()
GLOBAL.currentID = id
snapPosition()
global_position = pos
if offset:
snapPosition()
func setNewID():
id = GLOBAL.getNewID()
@ -129,7 +140,11 @@ func isCurrent():
return GLOBAL.currentID == id
func snapPosition(): #x :bool, y: bool
position = position.snapped(Vector2(64,64))
if not offset and not expand:
global_position = global_position.snapped(Vector2(64,64)) - Vector2(32,32)
else:
global_position = global_position.snapped(Vector2(64,64))
#position = position.snapped(Vector2(64,64))
func rotateBlock(direction):
match direction:
@ -232,7 +247,41 @@ func _on_animation_player_animation_finished(anim_name: StringName) -> void:
func _on_coyote_timer_timeout() -> void:
if isBottomColliding():
snapPosition()
stopped = true
GLOBAL.blockStopped = true
if expand:
expandBlocks()
func init(pos):
if expand and stopped:
#$AnimationPlayer.play("Expand")
scale = Vector2(2,2)
addParts()
id = GLOBAL.getNewID()
GLOBAL.currentID = id
snapPosition()
global_position = pos
if offset:
snapPosition()
func splitParts():
for i in $PartsContainer.get_children():
var newBlock = load(block1x1).instantiate()
get_parent().add_child(newBlock)
newBlock.clone(expand, type, stopped)
newBlock.init(i.global_position)
newBlock.setColor(modulate)
queue_free()
func clone(newExpand=false, newType=GLOBAL.BLOCKTYPES.LIGHT, newStopped=false):
expand = newExpand
stopped = newStopped
type = newType
#if not expand and type == GLOBAL.BLOCKTYPES.HEAVY:
#look = 1
#elif expand and not type == GLOBAL.BLOCKTYPES.HEAVY:
#look = 2
#elif expand and type == GLOBAL.BLOCKTYPES.HEAVY:
#look = 3

View file

@ -1,4 +1,4 @@
extends Node2D
extends Area2D
@onready var spriteBlock = $Sprites/Block
@onready var spriteSpecialBlock = $Sprites/SpecialBlock
@ -27,15 +27,32 @@ func isOverlapping() -> bool:
func removeOverlapp():
var blocksSplit = []
for i in get_children():
if is_instance_of(i,RayCast2D):
i.force_raycast_update()
var collider = i.get_collider()
if collider != null and collider.get_parent().get_parent().id != GLOBAL.currentID:
blocksSplit.append(i.get_collider().get_parent().get_parent())
collider.free()
var removeBlock = []
for i in $Area2D.get_overlapping_areas():
if i.is_in_group("Part") and i.get_parent().get_parent().id != GLOBAL.currentID:
print(i)
var block = i.get_parent().get_parent()
blocksSplit.append(block)
i.free()
#if GLOBAL.currentMode == GLOBAL.MODES.TIME:
#GLOBAL.time += block.type
#if block.expand:
#GLOBAL.points += block.type * 2
#else:
#GLOBAL.points += block.type
for j in blocksSplit:
j.splitParts()
#for i in get_children():
#if is_instance_of(i,RayCast2D):
#i.force_raycast_update()
#var collider = i.get_collider()
#if collider != null and collider.get_parent().get_parent().id != GLOBAL.currentID:
#blocksSplit.append(i.get_collider().get_parent().get_parent())
#collider.free()
#for j in blocksSplit:
#j.splitParts()
func init(pos, look=0):
position = pos

View file

@ -9,35 +9,11 @@
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ix7xn"]
size = Vector2(48, 48)
[node name="Part" type="StaticBody2D"]
collision_layer = 24
collision_mask = 24
[node name="Part" type="Area2D" groups=["Part"]]
collision_layer = 8
collision_mask = 16
script = ExtResource("1_hlmu7")
[node name="Overlap Test" type="RayCast2D" parent="."]
position = Vector2(-16, -16)
target_position = Vector2(8, 0)
collision_mask = 24
hit_from_inside = true
[node name="Overlap Test2" type="RayCast2D" parent="."]
position = Vector2(-16, 16)
target_position = Vector2(8, 0)
collision_mask = 24
hit_from_inside = true
[node name="Overlap Test3" type="RayCast2D" parent="."]
position = Vector2(16, -16)
target_position = Vector2(-8, 0)
collision_mask = 24
hit_from_inside = true
[node name="Overlap Test4" type="RayCast2D" parent="."]
position = Vector2(16, 16)
target_position = Vector2(-8, 0)
collision_mask = 24
hit_from_inside = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_ix7xn")
@ -84,3 +60,10 @@ position = Vector2(-32, 0)
target_position = Vector2(0, 0)
collision_mask = 3
hit_from_inside = true
[node name="Area2D" type="Area2D" parent="."]
collision_layer = 16
collision_mask = 8
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("RectangleShape2D_ix7xn")