- Home /
Question by
EliteHedgehog56 · Feb 20, 2018 at 11:58 AM ·
camerauiinput
ipad splitscreen display and on screen joystick and button ui
I am wanting to create a splitscreen shooter for ios with splitscreen, similar to what was done with Neon Shadow on the appstore. Is there a way to display each character screen on each half of the screen facing the oppisite direction like on the pic?
also how do I create an on screen joystick and button ui component that acts as an input for these scrips
movement script:
var canaim : boolean = false;
var canlock : boolean = false;
var normalmove : boolean = true;
var turn = 30;
var walk = 30;
var enemy : Transform;
function FixedUpdate (){
//change to input instead of keycodes
if (Input.GetKey(KeyCode.D)){
transform.Rotate(Vector3.up * turn * Time.deltaTime);
}
if (Input.GetKey(KeyCode.A)){
transform.Rotate(-Vector3.up * turn * Time.deltaTime);
}
if (Input.GetKey(KeyCode.W)){
transform.Translate(Vector3.forward * walk * Time.deltaTime);
}
if (Input.GetKey(KeyCode.S)){
transform.Translate(Vector3.back * walk * Time.deltaTime);
}
}
Shoot script:
RequireComponent(AudioSource);
var audioSource: AudioSource;
var Projectile : Rigidbody;
var ProjectileSpeed : int = 10;
var FireRate : float = 10; // The number of bullets fired per second
var lastfired : float; // The value of Time.time at the last firing moment
var gunshot : AudioClip;
function Start() {
audioSource = GetComponent.<AudioSource>();
}
function Update ()
{
if (Input.GetButton("Fire1"))
{
if (Time.time - lastfired > 1 / FireRate)
{
lastfired = Time.time;
var clone : Rigidbody;
clone = Instantiate(Projectile, transform.position, transform.rotation);
clone.velocity = transform.TransformDirection (Vector3.forward * ProjectileSpeed);
audioSource.PlayOneShot(gunshot, 0.7F);
}
}
}
thanks
fge.jpg
(86.7 kB)
Comment