mirror of
https://github.com/frizbee19/FebGameJam.git
synced 2026-09-11 08:17:01 +00:00
no bitches
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bdccd0c2644a6b24090e7088cec44bc3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user