Rework movement system to use deltaTime and GetAxisRaw
This commit is contained in:
@@ -20,7 +20,7 @@ public class Ratbot : MonoBehaviour
|
||||
// Constantly move towards player
|
||||
Rigidbody2D controller = GetComponent<Rigidbody2D>();
|
||||
Vector2 direction = (player.transform.position - transform.position).normalized;
|
||||
controller.linearVelocity = direction*moveSpeed;
|
||||
controller.linearVelocity = direction*moveSpeed*Time.deltaTime;
|
||||
}
|
||||
|
||||
void OnCollisionStay2D(Collision2D collision) {
|
||||
|
||||
@@ -102,7 +102,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 4d75aac518cf9dca0b16bb5a2e347204, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
moveSpeed: 4
|
||||
moveSpeed: 200
|
||||
damageStrength: 10
|
||||
damageTimeoutSeconds: 0.5
|
||||
health: 10
|
||||
|
||||
@@ -315,6 +315,10 @@ PrefabInstance:
|
||||
propertyPath: m_RenderPostProcessing
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6118034672792182209, guid: e05928a0d673caf999d31b31b994a112, type: 3}
|
||||
propertyPath: moveSpeed
|
||||
value: 3000
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6118034672792182209, guid: e05928a0d673caf999d31b31b994a112, type: 3}
|
||||
propertyPath: dashDistance
|
||||
value: 1000
|
||||
@@ -542,7 +546,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 58ed146781c2cc8bd972920fd08533fe, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
state: Start
|
||||
state: 0
|
||||
wave: 0
|
||||
ratbot: {fileID: 398740452138961375, guid: 5887eeeb7c78eb5c7bf46c5893fd4846, type: 3}
|
||||
shop: {fileID: 6569104281457075541, guid: c0d23b24c9c882ef89013998dab29dea, type: 3}
|
||||
|
||||
@@ -1381,7 +1381,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
upgrade: 5
|
||||
amount: 5
|
||||
amount: 1000
|
||||
--- !u!1 &4600683873005582980
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -29,9 +29,9 @@ public class Teo : MonoBehaviour
|
||||
// Move player
|
||||
if (!dashing) {
|
||||
controller.AddRelativeForce (new Vector2 (
|
||||
Input.GetAxis("Horizontal"),
|
||||
Input.GetAxis("Vertical")
|
||||
).normalized * moveSpeed);
|
||||
Input.GetAxisRaw("Horizontal"),
|
||||
Input.GetAxisRaw("Vertical")
|
||||
).normalized * moveSpeed * Time.deltaTime);
|
||||
}
|
||||
// Attack on click if not on cooldown
|
||||
if (Input.GetMouseButtonDown(0)) {
|
||||
|
||||
Reference in New Issue
Block a user