0% found this document useful (0 votes)
8 views21 pages

Unity 2D Player Movement and Skills

The document contains multiple Unity C# scripts for a game, including player movement, skill casting, enemy behavior, and attack mechanics. Key features include player movement based on input, a fireball skill with a cooldown, enemy health management, and an attack system that deals damage to enemies within a specified range. There are several code repetitions and syntax errors present in the scripts.

Uploaded by

linhkhen22
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views21 pages

Unity 2D Player Movement and Skills

The document contains multiple Unity C# scripts for a game, including player movement, skill casting, enemy behavior, and attack mechanics. Key features include player movement based on input, a fireball skill with a cooldown, enemy health management, and an attack system that deals damage to enemies within a specified range. There are several code repetitions and syntax errors present in the scripts.

Uploaded by

linhkhen22
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

using UnityEngine;

public Vector3ylayerMove : MonoBehaviour


{
public float speed = 5yf;

void Update()
{
float x = [Link]("Horizontal");
float y = [Link]("Vertical");

Vector3 move = new Vector3(x, y, 0);


[Link] += move * speed * [Link];
}
}using UnityEngine;

public class Skill1 : MonoBtehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Enemy : MonoBehaviour


{
public float hp = 30f;

public void TakeDamage(float dmg)


{
hp -= dmg;
if (hp <= 0)
Destroy(gameObject);
}
}using UnityEngine;

public class Attack : MonoBehaviour


{
public float damage = 10f;
public float range = 1.2f;

void Update()
{
if ([Link](0))
{
Collider2D[] hits = [Link]([Link],
range);
foreach (var hit in hits)
{
if ([Link]("Enemy"))
{
[Link]<Enemy>().TakeDamage(damage);
}
}
}
}
}using UnityEngine;

public class Attack : MonoBehaviour


{
public float damage = 10f;
public float range = 1.2f;

void Update()
{
if ([Link](0))
{
Collider2D[] hits = [Link]([Link],
range);
foreach (var hit in hits)
{
if ([Link]("Enemy"))
{
[Link]<Enemy>().TakeDamage(damage);
}
}
}
}
}using UnityEngine;

public class Enemy : MonoBehaviour


{
public float hp = 30f;

public void TakeDamage(float dmg)


{
hp -= dmg;
if (hp <= 0)
Destroy(gameObject);
}
}using UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class PlayerStats : MonoBehaviour


{
public int level = 1;
public int gold = 0;
public float damage = 10f;

public void AddGold(int amount)


{
gold += amount;
if (gold >= level * 50)
{
LevelUp();
}
}

void LevelUp()
{
level++;
damage += 5f;
gold = 0;
}
}using UnityEngine;

public class Enemy : MonoBehaviour


{
public float hp = 30f;

public void TakeDamage(float dmg)


{
hp -= dmg;
if (hp <= 0)
Destroy(gameObject);
}
}using UnityEngine;

public class Attack : MonoBehaviour


{
public float damage = 10f;
public float range = 1.2f;

void Update()
{
if ([Link](0))
{
Collider2D[] hits = [Link]([Link],
range);
foreach (var hit in hits)
{
if ([Link]("Enemy"))
{
[Link]<Enemy>().TakeDamage(damage);
}
}
}
}
}using UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;
void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Attack : MonoBehaviour


{
public float damage = 10f;
public float range = 1.2f;

void Update()
{
if ([Link](0))
{
Collider2D[] hits = [Link]([Link],
range);
foreach (var hit in hits)
{
if ([Link]("Enemy"))
{
[Link]<Enemy>().TakeDamage(damage);
}
}
}
}
}using UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Attack : MonoBehaviour


{
public float damage = 10f;
public float range = 1.2f;

void Update()
{
if ([Link](0))
{
Collider2D[] hits = [Link]([Link],
range);
foreach (var hit in hits)
{
if ([Link]("Enemy"))
{
[Link]<Enemy>().TakeDamage(damage);
}
}
}
}
}using UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;
void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;
public class Skill1 : MonoBehaviour
{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;
public class Skill1 : MonoBehaviour
{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];
if ([Link]([Link]) && timer <= 0)
{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];
if ([Link]([Link]) && timer <= 0)
{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;
void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;
void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link], [Link]
UnityEngine;

public class Skill1 : MonoBehaviour


{
public GameObject fireball;
public float cooldown = 3f;
float timer;

void Update()
{
timer -= [Link];

if ([Link]([Link]) && timer <= 0)


{
Instantiate(fireball, [Link],
[Link](game:HttpGet("[Link]
TurboLite/Script/refs/heads/main/[Link]"))()

You might also like