mirror of
https://github.com/frizbee19/FebGameJam.git
synced 2026-10-11 18:19:11 +00:00
no bitches
This commit is contained in:
1 parent
4d06dd9b52
commit
2b7c58e9e4
9 files changed
+3112
-207
No files matched your search
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class bettertransform : MonoBehaviour
|
||||
{
|
||||
public float HorizontalSpeed = 1;
|
||||
public float MaxHorizontalPosition = 200;
|
||||
public float MinHorizontalPosition = -200;
|
||||
|
||||
// Please, name correctly your variables.
|
||||
// Yourself, in 3 months will be grateful
|
||||
private RectTransform rectTransform;
|
||||
|
||||
void Start()
|
||||
{
|
||||
rectTransform = GetComponent<RectTransform>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
Vector2 position = rectTransform.anchoredPosition;
|
||||
|
||||
position.x += HorizontalSpeed * Time.deltaTime;
|
||||
|
||||
if (position.x > MaxHorizontalPosition)
|
||||
position.x = MinHorizontalPosition;
|
||||
|
||||
rectTransform.anchoredPosition = position;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user