t-spin only if last movement is a rotation
This commit is contained in:
		| @ -75,10 +75,9 @@ func piece_locked(lines, t_spin): | |||||||
| 			flash_text.print(LINES_CLEARED_NAMES[lines]) | 			flash_text.print(LINES_CLEARED_NAMES[lines]) | ||||||
| 		elif t_spin: | 		elif t_spin: | ||||||
| 			flash_text.print(t_spin) | 			flash_text.print(t_spin) | ||||||
| 		ds = SCORES[lines][t_spin] | 		goal -= SCORES[lines][""] | ||||||
| 		goal -= ds |  | ||||||
| 		$VBC/Goal.text = str(goal) | 		$VBC/Goal.text = str(goal) | ||||||
| 		ds *= 100 * level | 		ds = 100 * level * SCORES[lines][t_spin] | ||||||
| 		flash_text.print(str(ds)) | 		flash_text.print(str(ds)) | ||||||
| 		score += ds | 		score += ds | ||||||
| 		$VBC/Score.text = str(score) | 		$VBC/Score.text = str(score) | ||||||
|  | |||||||
| @ -8,6 +8,7 @@ const T_SLOT = [ | |||||||
| ] | ] | ||||||
| 	 | 	 | ||||||
| func t_spin(): | func t_spin(): | ||||||
|  | 	if rotated_last: | ||||||
| 		var center = to_global(minoes[0].translation) | 		var center = to_global(minoes[0].translation) | ||||||
| 		var a = not grid_map.is_free_cell(center + T_SLOT[orientation]) | 		var a = not grid_map.is_free_cell(center + T_SLOT[orientation]) | ||||||
| 		var b = not grid_map.is_free_cell(center + T_SLOT[(1+orientation)%4]) | 		var b = not grid_map.is_free_cell(center + T_SLOT[(1+orientation)%4]) | ||||||
| @ -17,5 +18,4 @@ func t_spin(): | |||||||
| 			return "T-SPIN" | 			return "T-SPIN" | ||||||
| 		elif c and d and (a or b): | 		elif c and d and (a or b): | ||||||
| 			return "MINI T-SPIN" | 			return "MINI T-SPIN" | ||||||
| 	else: |  | ||||||
| 	return "" | 	return "" | ||||||
| @ -75,6 +75,7 @@ var grid_map | |||||||
| var lock_delay | var lock_delay | ||||||
| var orientation = 0 | var orientation = 0 | ||||||
| var rotation_point_5_used = false | var rotation_point_5_used = false | ||||||
|  | var rotated_last = false | ||||||
|  |  | ||||||
| func _ready(): | func _ready(): | ||||||
| 	for i in range(NB_MINOES): | 	for i in range(NB_MINOES): | ||||||
| @ -96,18 +97,19 @@ func move(movement): | |||||||
| 	if grid_map.possible_positions(get_translations(), movement): | 	if grid_map.possible_positions(get_translations(), movement): | ||||||
| 		translate(movement) | 		translate(movement) | ||||||
| 		lock_delay.start() | 		lock_delay.start() | ||||||
|  | 		rotated_last = false | ||||||
| 		return true | 		return true | ||||||
| 	return false | 	return false | ||||||
| 	 | 	 | ||||||
| func rotate(direction): | func rotate(direction): | ||||||
| 	var t = get_translations() | 	var translations = get_translations() | ||||||
| 	var rotated_translations = [t[0]] | 	var rotated_translations = [translations[0]] | ||||||
|  | 	var center = translations[0] | ||||||
| 	for i in range(1, NB_MINOES): | 	for i in range(1, NB_MINOES): | ||||||
| 		var v = t[i] | 		var rt = translations[i] - center | ||||||
| 		v -= t[0] | 		rt = Vector3(-1*direction*rt.y, direction*rt.x, 0) | ||||||
| 		v = Vector3(-1*direction*v.y, direction*v.x, 0) | 		rt += center | ||||||
| 		v += t[0] | 		rotated_translations.append(rt) | ||||||
| 		rotated_translations.append(v) |  | ||||||
| 	var movements = SUPER_ROTATION_SYSTEM[orientation][direction] | 	var movements = SUPER_ROTATION_SYSTEM[orientation][direction] | ||||||
| 	for i in range(movements.size()): | 	for i in range(movements.size()): | ||||||
| 		if grid_map.possible_positions(rotated_translations, movements[i]): | 		if grid_map.possible_positions(rotated_translations, movements[i]): | ||||||
| @ -117,6 +119,7 @@ func rotate(direction): | |||||||
| 			lock_delay.start() | 			lock_delay.start() | ||||||
| 			if i == 4: | 			if i == 4: | ||||||
| 				rotation_point_5_used = true | 				rotation_point_5_used = true | ||||||
|  | 			rotated_last = true | ||||||
| 			return true | 			return true | ||||||
| 	return false | 	return false | ||||||
| 	 | 	 | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user