Enemy added + new Music Jams added

This commit is contained in:
GungHolo
2023-05-21 17:47:39 +02:00
parent a10e301731
commit 687ee48f65
6 changed files with 288 additions and 95 deletions

View File

@@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: ba23db2ceb808f84187d8c0a4305c959
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -128,7 +128,7 @@ Rigidbody2D:
m_LinearDrag: 5
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_Material: {fileID: 6200000, guid: 9a162dcdc92b4194ba53630f8785bed1, type: 2}
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0

View File

@@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : MonoBehaviour
{
public float maxSpeed;
private Rigidbody2D rb;
private CapsuleCollider2D cc;
private SpriteRenderer sr;
void Start()
{
rb = GetComponent<Rigidbody2D>();
cc = GetComponent<CapsuleCollider2D>();
sr = GetComponent<SpriteRenderer>();
}
// Update is called once per frame
void FixedUpdate()
{
rb.velocity = new Vector2(maxSpeed, rb.velocity.y);
}
void OnTriggerEnter2D(Collider2D cc)
{
if (!cc.gameObject.CompareTag("Player"))
{
maxSpeed = -maxSpeed;
sr.flipX = !sr.flipX;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f90e1f9169948b4499e0a5541c86d7bb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: