7-9-25 3:44am
This commit is contained in:
@@ -44,7 +44,8 @@ public partial class Marble : RigidBody2D
|
||||
TrySelect();
|
||||
TryAim();
|
||||
TryLaunch();
|
||||
TryMovement();
|
||||
TryMovement(delta);
|
||||
|
||||
}
|
||||
|
||||
public void ProcessOnBump(Node2D body)
|
||||
@@ -112,7 +113,7 @@ public partial class Marble : RigidBody2D
|
||||
}
|
||||
}
|
||||
|
||||
public void TryMovement()
|
||||
public void TryMovement(double delta)
|
||||
{
|
||||
if (LinearVelocity.Length() > 0 && !Sleeping)
|
||||
{
|
||||
@@ -125,6 +126,18 @@ public partial class Marble : RigidBody2D
|
||||
if (Moving)
|
||||
{
|
||||
ProcessOnMovement();
|
||||
|
||||
Vector2 Scroll = -LinearVelocity / 100;
|
||||
|
||||
Sprite2D sprite = (Sprite2D)GetNode("Sprite2D");
|
||||
ShaderMaterial material = (ShaderMaterial)sprite.Material;
|
||||
|
||||
float CurrentScrollX = (float)material.GetShaderParameter("scroll_x");
|
||||
material.SetShaderParameter("scroll_x", (CurrentScrollX + Scroll.X * (float)delta) % 1.0f);
|
||||
|
||||
float CurrentScrollY = (float)material.GetShaderParameter("scroll_y");
|
||||
material.SetShaderParameter("scroll_y", (CurrentScrollY + Scroll.Y * (float)delta) % 1.0f);
|
||||
|
||||
if (Sleeping)
|
||||
{
|
||||
Moving = false;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
[gd_scene load_steps=14 format=3 uid="uid://c8n4lue2bn25n"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://c8n4lue2bn25n"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b1bipn8tmpggr" path="res://Gameplay/Marble.cs" id="1_7ritg"]
|
||||
[ext_resource type="Shader" uid="uid://b6vvt5o0008ob" path="res://shaders/globe.gdshader" id="2_6v01e"]
|
||||
[ext_resource type="Texture2D" uid="uid://bigvacjklr7in" path="res://art/playerGrey_up1.png" id="2_76m5q"]
|
||||
[ext_resource type="Texture2D" uid="uid://dd3s6x86dgxem" path="res://art/checkerboard.png" id="2_fkve3"]
|
||||
[ext_resource type="Texture2D" uid="uid://bskloxogmm7ox" path="res://art/playerGrey_up2.png" id="3_4rms2"]
|
||||
[ext_resource type="Shader" uid="uid://dvpsalh3o60iu" path="res://shaders/red.gdshader" id="3_6v01e"]
|
||||
[ext_resource type="Texture2D" uid="uid://dkduh13hcei0w" path="res://art/fruit.png" id="3_6v01e"]
|
||||
[ext_resource type="Texture2D" uid="uid://cww2tug20ksn3" path="res://art/playerGrey_walk1.png" id="4_iy80h"]
|
||||
[ext_resource type="Texture2D" uid="uid://csm4ru8wkc2cb" path="res://art/playerGrey_walk2.png" id="5_ryns1"]
|
||||
|
||||
@@ -12,18 +12,11 @@
|
||||
bounce = 1.0
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_bdlqm"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("3_6v01e")
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_eju0r"]
|
||||
material = SubResource("ShaderMaterial_bdlqm")
|
||||
radius = 1.5
|
||||
height = 3.0
|
||||
|
||||
[sub_resource type="MeshTexture" id="MeshTexture_nbhrg"]
|
||||
mesh = SubResource("CapsuleMesh_eju0r")
|
||||
base_texture = ExtResource("2_fkve3")
|
||||
image_size = Vector2(55, 55)
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource("2_6v01e")
|
||||
shader_parameter/scroll_x = 0.0
|
||||
shader_parameter/scroll_y = 0.0
|
||||
shader_parameter/globe_magnitude = 1.0
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_n7ghd"]
|
||||
animations = [{
|
||||
@@ -51,7 +44,7 @@ animations = [{
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_803qd"]
|
||||
radius = 27.0185
|
||||
radius = 56.0803
|
||||
|
||||
[node name="Marble" type="RigidBody2D"]
|
||||
input_pickable = true
|
||||
@@ -65,8 +58,10 @@ script = ExtResource("1_7ritg")
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
position = Vector2(-4.76837e-07, -9.53674e-07)
|
||||
texture = SubResource("MeshTexture_nbhrg")
|
||||
material = SubResource("ShaderMaterial_bdlqm")
|
||||
position = Vector2(0, 1.3113e-06)
|
||||
scale = Vector2(0.0861539, 0.0861539)
|
||||
texture = ExtResource("3_6v01e")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
visible = false
|
||||
|
||||
Reference in New Issue
Block a user