Cgprograms
Cgprograms
GRAPHICS
PROJECT
PROJECT NAME – HARRY POTTER AND
DEATHLY
DEMENTORS
Backgroundmusic
using System.Collections.Generic;
using UnityEngine;
}
else
{
Destroy(gameObject);
}
Obstacles
using System.Collections.Generic;
using UnityEngine;
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.tag == "Border")
{
Destroy(this.gameObject);
}
}
}
Cameramovements
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
void FixedUpdate()
{
rb.velocity = new Vector2(0, playerDirection.y * playerSpeed);
}
}
Spawnobstacles
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
}
}
void Spawm()
{
float randomX = Random.Range(minX, maxX);
float randomY = Random.Range(minY, maxY);
Instantiate(obstacle, transform.transform.position + new Vector3(randomX, randomY, 0),
transform.rotation);
}
}