/// SPΔWN[CAMPGAMES]™
/// SCRAPS (scripts-development) v2025
/// License: CCBYNC4.0
// DEPLOY
using UnityEngine;
using UnityEngine.InputSystem;
public class SAMPCO_Alpha : MonoBehaviour
{
public float moveSpeed = 5f;
public Rigidbody2D rb;
public Transform graphics;
void Update()
{
float moveInput = 0f;
// get our input
if (Keyboard.current.aKey.isPressed)
moveInput = -1f;
if (Keyboard.current.dKey.isPressed)
moveInput = 1f;
// use input to flip / scale graphics
if (moveInput > 0)
{
// flip to face right
Vector3 scale = graphics.localScale;
scale.x = 1f;
graphics.localScale = scale;
}
if (moveInput < 0)
{
// flip to face left
Vector3 scale = graphics.localScale;
scale.x = -1f;
graphics.localScale = scale;
}
// move player
rb.linearVelocity = new Vector2(moveInput * moveSpeed, rb.linearVelocity.y);
}
}