Pizzicato

This commit is contained in:
adrienmalin
2018-12-30 22:03:06 +01:00
parent cde121ce5a
commit 2192004736
28 changed files with 1014 additions and 44 deletions

View File

@ -25,7 +25,7 @@ params_point_size = 1.0
params_billboard_mode = 0
params_grow = false
params_use_alpha_scissor = false
albedo_color = Color( 0.201977, 0.22403, 0.310547, 1 )
albedo_color = Color( 0.409756, 0.451493, 0.615234, 1 )
metallic = 0.66
metallic_specular = 0.5
metallic_texture_channel = 0
@ -53,7 +53,7 @@ uv2_triplanar_sharpness = 1.0
proximity_fade_enable = true
proximity_fade_distance = 1.0
distance_fade_enable = false
_sections_unfolded = [ "Albedo", "Proximity Fade" ]
_sections_unfolded = [ "Albedo", "Emission", "Metallic", "Proximity Fade" ]
[sub_resource type="CubeMesh" id=2]
@ -83,6 +83,28 @@ mesh = SubResource( 2 )
skeleton = NodePath("..")
material/0 = null
[node name="OmniLight" type="OmniLight" parent="Mino0" index="0"]
layers = 1
light_color = Color( 0.871094, 0.978851, 1, 1 )
light_energy = 10.0
light_indirect_energy = 1.0
light_negative = false
light_specular = 0.5
light_bake_mode = 1
light_cull_mask = -1
shadow_enabled = false
shadow_color = Color( 0, 0, 0, 1 )
shadow_bias = 0.15
shadow_contact = 0.0
shadow_reverse_cull_face = false
editor_only = false
omni_range = 5.0
omni_attenuation = 1.0
omni_shadow_mode = 1
omni_shadow_detail = 1
_sections_unfolded = [ "Light", "Omni" ]
[node name="Mino1" type="MeshInstance" parent="." index="1"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 3, 0 )

70
Tetrominos/TetroI.gd Normal file
View File

@ -0,0 +1,70 @@
extends "Tetromino.gd"
const CLOCKWISE = -1
const COUNTERCLOCKWISE = 1
const SUPER_ROTATION_SYSTEM = [
{
COUNTERCLOCKWISE: [
Vector3(0, -1, 0),
Vector3(-1, -1, 0),
Vector3(2, -1, 0),
Vector3(-1, 1, 0),
Vector3(2, -2, 0)
],
CLOCKWISE: [
Vector3(1, 0, 0),
Vector3(-1, 0, 0),
Vector3(2, 0, 0),
Vector3(-1, -1, 0),
Vector3(2, 2, 0)
],
},
{
COUNTERCLOCKWISE: [
Vector3(-1, 0, 0),
Vector3(1, 0, 0),
Vector3(-2, 0, 0),
Vector3(1, 1, 0),
Vector3(-2, -2, 0)
],
CLOCKWISE: [
Vector3(0, -1, 0),
Vector3(-1, -1, 0),
Vector3(2, -1, 0),
Vector3(-1, 1, 0),
Vector3(2, -2, 0)
],
},
{
COUNTERCLOCKWISE: [
Vector3(0, 1, 0),
Vector3(1, 1, 0),
Vector3(-2, 1, 0),
Vector3(1, -1, 0),
Vector3(-2, 2, 0)
],
CLOCKWISE: [
Vector3(-1, 0, 0),
Vector3(1, 0, 0),
Vector3(-2, 0, 0),
Vector3(1, 1, 0),
Vector3(-2, -2, 0)
],
},
{
COUNTERCLOCKWISE: [
Vector3(1, 0, 0),
Vector3(-1, 0, 0),
Vector3(2, 0, 0),
Vector3(-1, -1, 0),
Vector3(2, 2, 0)
],
CLOCKWISE: [
Vector3(0, 1, 0),
Vector3(1, 1, 0),
Vector3(-2, 1, 0),
Vector3(1, -1, 0),
Vector3(-2, 2, 0)
],
},
]

View File

@ -1,9 +1,10 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://TetroI.gd" type="Script" id=1]
[ext_resource path="res://Tetrominos/TetroI.gd" type="Script" id=1]
[ext_resource path="res://Mino/Mino.tscn" type="PackedScene" id=2]
[node name="TetroI" type="Spatial" index="0"]
script = ExtResource( 1 )

View File

@ -96,11 +96,8 @@ func rotated_positions(direction):
translations.append(v)
return translations
func rotation_movement_liberty(direction):
return SUPER_ROTATION_SYSTEM[orientation][direction]
func apply_positions(positions):
for i in range(4):
for i in range(NB_MINOES):
minoes[i].translation = to_local(positions[i])
func move(movement):
@ -113,7 +110,7 @@ func move(movement):
func rotate(direction):
var rotated_positions = rotated_positions(direction)
var movements = rotation_movement_liberty(direction)
var movements = SUPER_ROTATION_SYSTEM[orientation][direction]
var test_position
for movement in movements:
test_position = get_parent().possible_positions(rotated_positions, movement)
@ -123,4 +120,8 @@ func rotate(direction):
apply_positions(rotated_positions)
translate(movement)
return true
return false
return false
func emit_trail(emit):
for mino in minoes:
mino.get_node("Trail").emitting = emit