From 0e33b66901e23e935bc2ba33d66e3c377261ebb8 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 17 Jul 2022 17:33:55 +0200 Subject: +1 animation --- godot/scenes/Die.gd | 13 ++++++++++++- godot/scenes/Die.tscn | 23 +++++++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) (limited to 'godot/scenes') diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd index f09a8b0..7879168 100644 --- a/godot/scenes/Die.gd +++ b/godot/scenes/Die.gd @@ -25,6 +25,7 @@ var target_bounce = 1 var default_gravity = 2 var default_bounciness = 0 var after_stroke = true +var plus1Start = 999999999999 var curr_buff = buff.none @@ -133,7 +134,7 @@ func _physics_process(delta): dice_is_moving = true $PowerUI3D/SpriteCircles.hide() - if after_stroke && dice_still_timing == true && (OS.get_ticks_msec() - dice_is_still_since) > 500: + if after_stroke && dice_still_timing == true && (OS.get_ticks_msec() - dice_is_still_since) > 800: print("stop timing while not morbin") dice_is_moving = false after_stroke = false @@ -150,6 +151,15 @@ func _physics_process(delta): func _process(delta): var rot = $CamRoot/Horizontal/Vertical/Camera.get_global_transform().basis.get_euler() $PowerUI3D.rotation_degrees.y = rad2deg(rot.y) + 180 + + var remaining = clamp(1000 - (OS.get_ticks_msec() - plus1Start), 0, 1000) + $PowerUI3D/SpritePlus1.translation.y = 2 + (1000-remaining)/300.0 + print(remaining) + if remaining > 0 && remaining < 1000: + $PowerUI3D/SpritePlus1.show() + else: + $PowerUI3D/SpritePlus1.hide() + func draw_arrow(): var l = 1 + 5 * clamp(die_launch_force_magnitude, 0, die_launch_force_magnitude_max) / die_launch_force_magnitude_max @@ -213,6 +223,7 @@ func low_gravity_revert(): func extra_stroke(): _game.revoke_stroke() + plus1Start = OS.get_ticks_msec() func bounciness(): mat.bounce = target_bounce diff --git a/godot/scenes/Die.tscn b/godot/scenes/Die.tscn index 69727f1..5a605a5 100644 --- a/godot/scenes/Die.tscn +++ b/godot/scenes/Die.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=15 format=2] +[gd_scene load_steps=17 format=2] [ext_resource path="res://scenes/Die.gd" type="Script" id=1] [ext_resource path="res://assets/game_objects/W8baseColor_Mat.material" type="Material" id=2] [ext_resource path="res://assets/textures/circles.png" type="Texture" id=3] [ext_resource path="res://assets/fonts/default_dynamicfont.tres" type="DynamicFont" id=4] [ext_resource path="res://assets/fonts/default_dynamicfontdata.tres" type="DynamicFontData" id=5] +[ext_resource path="res://assets/textures/plus1.png" type="Texture" id=6] [sub_resource type="PhysicsMaterial" id=7] friction = 0.0 @@ -31,6 +32,19 @@ surfaces/0 = { [sub_resource type="SphereMesh" id=5] +[sub_resource type="SpatialMaterial" id=11] +resource_name = "paintGreen(Clone)" +flags_transparent = true +vertex_color_use_as_albedo = true +albedo_color = Color( 1, 0, 0.878431, 0.470588 ) +metallic = 0.64 +metallic_specular = 0.77 +emission_enabled = true +emission = Color( 0.909804, 0.121569, 0.85098, 1 ) +emission_energy = 0.82 +emission_operator = 0 +emission_on_uv2 = false + [sub_resource type="SphereShape" id=6] radius = 0.1 @@ -69,9 +83,10 @@ shape = SubResource( 4 ) disabled = true [node name="Ball" type="MeshInstance" parent="BallShape"] +transform = Transform( 1, -5.64916e-05, 0.000827505, 5.58374e-05, 1, 0.000824323, -0.00082755, -0.000824278, 0.999999, 0, 0, 0 ) mesh = SubResource( 5 ) skeleton = NodePath("../..") -material/0 = null +material/0 = SubResource( 11 ) [node name="CamRoot" type="Spatial" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 15.0578, 0 ) @@ -188,3 +203,7 @@ opacity = 0.43 pixel_size = 0.0071 axis = 1 texture = ExtResource( 3 ) + +[node name="SpritePlus1" type="Sprite3D" parent="PowerUI3D"] +transform = Transform( -0.6, 0, -5.24537e-08, 0, 0.6, 0, 5.24537e-08, 0, -0.6, 0, 1.58297, 0.897554 ) +texture = ExtResource( 6 ) -- cgit