More cardboard goodies
This commit is contained in:
parent
1358cd5886
commit
ceb53bb4a2
12 changed files with 226 additions and 84 deletions
BIN
MLPAssets/ExampleCard/ff6.jpg
Normal file
BIN
MLPAssets/ExampleCard/ff6.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
36
MLPAssets/ExampleCard/ff6.jpg.import
Normal file
36
MLPAssets/ExampleCard/ff6.jpg.import
Normal file
|
@ -0,0 +1,36 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path.s3tc="res://.import/ff6.jpg-e066dece7da740f732cd9a31f65091eb.s3tc.stex"
|
||||
path.etc="res://.import/ff6.jpg-e066dece7da740f732cd9a31f65091eb.etc.stex"
|
||||
metadata={
|
||||
"imported_formats": [ "s3tc", "etc" ],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://MLPAssets/ExampleCard/ff6.jpg"
|
||||
dest_files=[ "res://.import/ff6.jpg-e066dece7da740f732cd9a31f65091eb.s3tc.stex", "res://.import/ff6.jpg-e066dece7da740f732cd9a31f65091eb.etc.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=2
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=true
|
||||
flags/filter=true
|
||||
flags/mipmaps=true
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
Binary file not shown.
|
@ -18,38 +18,38 @@ v 1.72000000 3.2818681e-2 2.18667858
|
|||
v 1.67165352 3.2818681e-2 2.30339731
|
||||
v 1.62339731 3.2818681e-2 2.35165352
|
||||
v 1.50667858 3.2818681e-2 2.40000000
|
||||
vt 4.1666667e-2 4.4441963e-2
|
||||
vt 4.1666667e-2 0.95555804
|
||||
vt 5.1738851e-2 2.0125561e-2
|
||||
vt 5.1738851e-2 0.97987444
|
||||
vt 6.1792227e-2 1.0072184e-2
|
||||
vt 6.1792227e-2 0.98992782
|
||||
vt 8.6108630e-2 1.6151895e-14
|
||||
vt 8.6108630e-2 1.00000000
|
||||
vt 0.71389137 0.0000000e+0
|
||||
vt 0.71389137 1.00000000
|
||||
vt 0.73820777 1.0072184e-2
|
||||
vt 0.73820777 0.98992782
|
||||
vt 0.74826115 2.0125561e-2
|
||||
vt 0.74826115 0.97987444
|
||||
vt 0.75833333 4.4441963e-2
|
||||
vt 0.75833333 0.95555804
|
||||
vt 0.78431656 0.34479267
|
||||
vt 0.78431656 0.58110397
|
||||
vt 0.78692892 0.33848585
|
||||
vt 0.78692892 0.58741079
|
||||
vt 0.78953641 0.33587836
|
||||
vt 0.78953641 0.59001828
|
||||
vt 0.79584323 0.33326599
|
||||
vt 0.79584323 0.59263065
|
||||
vt 0.95866788 0.33326599
|
||||
vt 0.95866788 0.59263065
|
||||
vt 0.96497470 0.33587836
|
||||
vt 0.96497470 0.59001828
|
||||
vt 0.96758219 0.33848585
|
||||
vt 0.96758219 0.58741079
|
||||
vt 0.97019456 0.34479267
|
||||
vt 0.97019456 0.58110397
|
||||
vt 6.0063500e-2 5.4464240e-2
|
||||
vt 6.0063500e-2 0.94553576
|
||||
vt 6.9618578e-2 3.0682798e-2
|
||||
vt 6.9618578e-2 0.96931720
|
||||
vt 7.9155814e-2 2.0850596e-2
|
||||
vt 7.9155814e-2 0.97914940
|
||||
vt 0.10222381 1.1000000e-2
|
||||
vt 0.10222381 0.98900000
|
||||
vt 0.69777619 1.1000000e-2
|
||||
vt 0.69777619 0.98900000
|
||||
vt 0.72084419 2.0850596e-2
|
||||
vt 0.72084419 0.97914940
|
||||
vt 0.73038142 3.0682798e-2
|
||||
vt 0.73038142 0.96931720
|
||||
vt 0.73993650 5.4464240e-2
|
||||
vt 0.73993650 0.94553576
|
||||
vt 0.78908804 0.34739209
|
||||
vt 0.78908804 0.57850455
|
||||
vt 0.79156629 0.34122403
|
||||
vt 0.79156629 0.58467261
|
||||
vt 0.79403992 0.33867390
|
||||
vt 0.79403992 0.58722274
|
||||
vt 0.80002294 0.33611901
|
||||
vt 0.80002294 0.58977763
|
||||
vt 0.95448817 0.33611901
|
||||
vt 0.95448817 0.58977763
|
||||
vt 0.96047120 0.33867390
|
||||
vt 0.96047120 0.58722274
|
||||
vt 0.96294482 0.34122403
|
||||
vt 0.96294482 0.58467261
|
||||
vt 0.96542307 0.34739209
|
||||
vt 0.96542307 0.57850455
|
||||
vn 0.0000000e+0 1.00000000 5.9098621e-18
|
||||
vn 0.0000000e+0 -1.00000000 -5.9468352e-17
|
||||
vn 0.0000000e+0 1.00000000 5.9468352e-17
|
||||
|
|
Binary file not shown.
BIN
MLPAssets/Models/cardborder.wings~
Normal file
BIN
MLPAssets/Models/cardborder.wings~
Normal file
Binary file not shown.
|
@ -1,16 +1,17 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://Scenes/Scripts/Board.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Scenes/Scripts/Camera.gd" type="Script" id=2]
|
||||
[ext_resource path="res://MLPAssets/Background/boardbg.jpg" type="Texture" id=3]
|
||||
[ext_resource path="res://Scenes/Components/Card.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://Scenes/BoardUI.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://Scenes/Components/Card.tscn" type="PackedScene" id=5]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=2]
|
||||
[sub_resource type="SpatialMaterial" id=1]
|
||||
flags_unshaded = true
|
||||
albedo_texture = ExtResource( 3 )
|
||||
|
||||
[sub_resource type="PlaneMesh" id=3]
|
||||
material = SubResource( 2 )
|
||||
[sub_resource type="PlaneMesh" id=2]
|
||||
material = SubResource( 1 )
|
||||
size = Vector2( 16, 9 )
|
||||
|
||||
[node name="Spatial" type="Spatial"]
|
||||
|
@ -22,8 +23,10 @@ script = ExtResource( 2 )
|
|||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.001, 0 )
|
||||
mesh = SubResource( 3 )
|
||||
mesh = SubResource( 2 )
|
||||
material/0 = null
|
||||
|
||||
[node name="Card" parent="." instance=ExtResource( 4 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.433312, -0.001, 1.49195 )
|
||||
[node name="BoardUI" parent="." instance=ExtResource( 4 )]
|
||||
|
||||
[node name="Card" parent="." instance=ExtResource( 5 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.55435, -0.001, 1.13711 )
|
||||
|
|
60
Scenes/BoardUI.tscn
Normal file
60
Scenes/BoardUI.tscn
Normal file
|
@ -0,0 +1,60 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://MLPAssets/ExampleCard/ff6.jpg" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="Animation" id=1]
|
||||
resource_name = "fade ui card"
|
||||
length = 0.1
|
||||
step = 0.01
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("TextureRect:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.01 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ false, true ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("TextureRect:modulate")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0.01, 0.1 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("TextureRect:margin_top")
|
||||
tracks/2/interp = 2
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0, 0.1 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ 0.0, 40.0 ]
|
||||
}
|
||||
|
||||
[node name="BoardUI" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
margin_left = 40.0
|
||||
margin_top = 40.0
|
||||
margin_right = 384.0
|
||||
margin_bottom = 520.0
|
||||
rect_scale = Vector2( 0.8, 0.8 )
|
||||
texture = ExtResource( 1 )
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
"anims/fade ui card" = SubResource( 1 )
|
8
Scenes/Components/Card.gd
Normal file
8
Scenes/Components/Card.gd
Normal file
|
@ -0,0 +1,8 @@
|
|||
extends Spatial
|
||||
|
||||
|
||||
func _mouse_hover():
|
||||
print("MOUSE HOVER")
|
||||
|
||||
func _area_input(camera, event, click_position, click_normal, shape_idx):
|
||||
breakpoint
|
|
@ -1,39 +1,11 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://MLPAssets/Models/cardborder.obj" type="ArrayMesh" id=1]
|
||||
[ext_resource path="res://MLPAssets/Models/cardborder.material" type="Material" id=2]
|
||||
[ext_resource path="res://Scenes/Components/Card.gd" type="Script" id=1]
|
||||
[ext_resource path="res://MLPAssets/Models/cardborder.obj" type="ArrayMesh" id=2]
|
||||
[ext_resource path="res://MLPAssets/Models/cardborder.material" type="Material" id=3]
|
||||
[ext_resource path="res://MLPAssets/ExampleCard/ff6.jpg" type="Texture" id=4]
|
||||
|
||||
[sub_resource type="Animation" id=2]
|
||||
resource_name = "flip"
|
||||
length = 0.5
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:translation")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0.00886994, 0.25, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 0.5, 0 ), Vector3( 0, 0, 0 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:rotation_degrees")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0.00886994, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 0, 180 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=1]
|
||||
resource_name = "tap"
|
||||
[sub_resource type="Animation" id=7]
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:rotation_degrees")
|
||||
|
@ -48,11 +20,65 @@ tracks/0/keys = {
|
|||
"values": [ Vector3( 0, 0, 0 ), Vector3( 0, -90, 0 ) ]
|
||||
}
|
||||
|
||||
[node name="Card" type="MeshInstance"]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
|
||||
mesh = ExtResource( 1 )
|
||||
material/0 = ExtResource( 2 )
|
||||
[sub_resource type="Animation" id=2]
|
||||
length = 0.5
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath(".:translation")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.25, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 0.5, 0 ), Vector3( 0, 0, 0 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:rotation_degrees")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 0, 180 ) ]
|
||||
}
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
anims/flip = SubResource( 2 )
|
||||
anims/tap = SubResource( 1 )
|
||||
[sub_resource type="PlaneMesh" id=8]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=5]
|
||||
flags_unshaded = true
|
||||
albedo_texture = ExtResource( 4 )
|
||||
uv1_scale = Vector3( 0.9, 0.9, 1 )
|
||||
uv1_offset = Vector3( 0.05, 0.05, 0 )
|
||||
|
||||
[sub_resource type="BoxShape" id=6]
|
||||
extents = Vector3( 0.367502, 0.0283921, 0.49861 )
|
||||
|
||||
[node name="Card" type="Spatial"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Border" type="MeshInstance" parent="."]
|
||||
mesh = ExtResource( 2 )
|
||||
material/0 = ExtResource( 3 )
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Border"]
|
||||
anims/flip = SubResource( 7 )
|
||||
anims/tap = SubResource( 2 )
|
||||
|
||||
[node name="CardImage" type="MeshInstance" parent="Border"]
|
||||
transform = Transform( 0.318962, 0, 0, 0, 1, 0, 0, 0, 0.450381, 0, 0.007, 0 )
|
||||
mesh = SubResource( 8 )
|
||||
material/0 = SubResource( 5 )
|
||||
|
||||
[node name="Area" type="Area" parent="."]
|
||||
input_capture_on_drag = true
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Area"]
|
||||
shape = SubResource( 6 )
|
||||
[connection signal="input_event" from="Area" to="." method="_area_input"]
|
||||
[connection signal="mouse_entered" from="Area" to="." method="_mouse_hover"]
|
||||
|
|
|
@ -16,9 +16,19 @@ func _input(event: InputEvent):
|
|||
mouseOrigin = get_viewport().get_mouse_position()
|
||||
lastCameraTransform = camera.transform
|
||||
|
||||
func _process(delta):
|
||||
func _process(delta: float):
|
||||
# If panning, translate mouse delta to camera delta
|
||||
if Input.is_action_pressed("pan"):
|
||||
var mouseDelta := get_viewport().get_mouse_position() - mouseOrigin
|
||||
var mousePos: Vector2 = mouseDelta * 0.0096 * (1-camera.getZoomLevel()/5) # Magic numbers everywhere
|
||||
camera.transform.origin = lastCameraTransform.origin - Vector3(mousePos.x, 0, mousePos.y)
|
||||
camera.transform.origin = lastCameraTransform.origin - Vector3(mousePos.x, 0, mousePos.y)
|
||||
|
||||
func _physics_process(delta: float):
|
||||
# Raycast mouse to check for hover
|
||||
var mousePos := get_viewport().get_mouse_position()
|
||||
var from: Vector3 = camera.project_ray_origin(mousePos)
|
||||
var to: Vector3 = from + camera.project_ray_normal(mousePos) * 1000
|
||||
var space_state := get_world().direct_space_state
|
||||
var result := space_state.intersect_ray(from, to)
|
||||
if result.size() > 0:
|
||||
print(result)
|
|
@ -49,5 +49,4 @@ pan={
|
|||
quality/driver/driver_name="GLES2"
|
||||
vram_compression/import_etc=true
|
||||
vram_compression/import_etc2=false
|
||||
quality/depth/hdr=false
|
||||
environment/default_environment="res://default_env.tres"
|
||||
|
|
Loading…
Reference in a new issue