messing around with the droplet

This commit is contained in:
cemt1363
2026-06-05 23:33:17 +02:00
parent 70a6485bf7
commit 6a9a61bc25
2 changed files with 19 additions and 6 deletions
+5 -4
View File
@@ -133,15 +133,15 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3} - target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalScale.y propertyPath: m_LocalScale.y
value: 0.47118455 value: 0.58290243
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3} - target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: -5.7978 value: -4.73
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3} - target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: 0.9887 value: -2.3359
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3} - target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
@@ -385,7 +385,7 @@ Rigidbody2D:
m_Mass: 1 m_Mass: 1
m_LinearDamping: 0 m_LinearDamping: 0
m_AngularDamping: 0.05 m_AngularDamping: 0.05
m_GravityScale: 1 m_GravityScale: 0
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IncludeLayers: m_IncludeLayers:
serializedVersion: 2 serializedVersion: 2
@@ -455,6 +455,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 64d83d81ffe9aeb419af4eb171357948, type: 3} m_Script: {fileID: 11500000, guid: 64d83d81ffe9aeb419af4eb171357948, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: Assembly-CSharp::DropletMovement m_EditorClassIdentifier: Assembly-CSharp::DropletMovement
moveSpeed: 5
--- !u!1660057539 &9223372036854775807 --- !u!1660057539 &9223372036854775807
SceneRoots: SceneRoots:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
+13 -1
View File
@@ -2,15 +2,27 @@ using UnityEngine;
public class DropletMovement : MonoBehaviour public class DropletMovement : MonoBehaviour
{ {
public float moveSpeed = 5f;
private Rigidbody2D rb;
private Vector2 movement;
// Start is called once before the first execution of Update after the MonoBehaviour is created // Start is called once before the first execution of Update after the MonoBehaviour is created
void Start() void Start()
{ {
rb = GetComponent<Rigidbody2D>();
} }
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
movement.x = Input.GetAxisRaw("Horizontal");
movement.y = Input.GetAxisRaw("Vertical");
}
private void FixedUpdate()
{
rb.linearVelocity = movement.normalized * moveSpeed;
} }
} }