Commit a9445a02 authored by Christopher Benes's avatar Christopher Benes
Browse files

MainLevel Update

parent ff8fb112
fileFormatVersion: 2
guid: 83b2ccd8caab22846876189bc6815151
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 074dbdd93ec6ac143b8ac27fa8a39ccd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 45dc3cd47d608cf449e822b512001707
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MovingPlatform : MonoBehaviour
{
public float dirX, moveSpeed = 3;
bool moveRight = true;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if(transform.position.x > 4f)
{
moveRight = false;
}
if(transform.position.x < -4f)
{
moveRight = true;
}
if(moveRight)
{
transform.position = new Vector2(transform.position.x + moveSpeed * Time.deltaTime, transform.position.y);
}
else
{
transform.position = new Vector2(transform.position.x - moveSpeed * Time.deltaTime, transform.position.y);
}
}
}
fileFormatVersion: 2
guid: d0571132ce629be469a095e772a94c88
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMoveWithPlatform : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnTriggerStay(other:Collider)
{
if (other.gameObject.tag == "platform")
{
transform.parent = other.transform;
}
}
void OnTriggerExit(other:Collider)
{
if (other.gameObject.tag == "platform")
{
transform.parent = null;
}
}
}
fileFormatVersion: 2
guid: 2e0736b5a4fcf8f489fddd2d53920483
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment