From 0e33b66901e23e935bc2ba33d66e3c377261ebb8 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 17 Jul 2022 17:33:55 +0200 Subject: +1 animation --- godot/assets/textures/plus1.png | 3 +++ godot/assets/textures/plus1.png.import | 3 +++ godot/scenes/Die.gd | 13 ++++++++++++- godot/scenes/Die.tscn | 23 +++++++++++++++++++++-- 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 godot/assets/textures/plus1.png create mode 100644 godot/assets/textures/plus1.png.import diff --git a/godot/assets/textures/plus1.png b/godot/assets/textures/plus1.png new file mode 100644 index 0000000..fe88033 --- /dev/null +++ b/godot/assets/textures/plus1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50722036aa4e2caebf5aa501fc2918261d3fdcc66ad649bc94fb1b6086f8583a +size 2657 diff --git a/godot/assets/textures/plus1.png.import b/godot/assets/textures/plus1.png.import new file mode 100644 index 0000000..66c6d17 --- /dev/null +++ b/godot/assets/textures/plus1.png.import @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0f8ef4108a525f37d5c49c74f31285781a2da4bac390e4f223bb267b0d7b98d +size 899 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