3/4/25, 6:07 PM RGIPT Google Apps Mail - Game Designing : Unity Code
PRAVESH KUMAR <23cd3029@[Link]>
Game Designing : Unity Code
1 message
Susham Biswas <susham@[Link]> Thu, Feb 13, 2025 at 9:19 AM
To: ARD 2024 <ARD_2024@[Link]>
using UnityEngine;
public class MoveAndScale : MonoBehaviour
{
public float moveSpeed = 5f; // Speed of movement (left to right)
public float scaleSpeed = 0.5f; // Speed of scaling down
void Update()
{
// Move Right (Translation)
[Link] += new Vector3(1, 1, 0) * moveSpeed * [Link];
// Scale Down (Shrinking)
[Link] -= new Vector3(1, 1, 1) * scaleSpeed * [Link];
// Prevent scale from becoming negative
if ([Link].x < 0.1f) [Link] = new Vector3(0.1f, [Link].y,
[Link].z);
if ([Link].y < 0.1f) [Link] = new Vector3([Link].x, 0.1f,
[Link].z);
if ([Link].z < 0.1f) [Link] = new Vector3([Link].x,
[Link].y, 0.1f);
}
}
//////////////////////////////
using UnityEngine;
public class movu : MonoBehaviour
{
public Rigidbody2D myRigidbody;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
// Update is called once per frame
void Update()
{
if ([Link]([Link])==true)
{
[Link]=[Link]*10;
}
}
}
///////////////////////
[Link] 1/2
3/4/25, 6:07 PM RGIPT Google Apps Mail - Game Designing : Unity Code
using UnityEngine;
public class blockspawn : MonoBehaviour
{
public GameObject block;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
// Update is called once per frame
void Update()
{
Instantiate(block,[Link],[Link]);
}
}
//////////////////////////////
using UnityEngine;
public class blocksp : MonoBehaviour
{
public GameObject block;
public float spawnRate = 2f;
private float timer = 0f;
// Update is called once per frame
void Update()
{
// Increment the timer based on the time passed since the last frame
timer += [Link];
// Check if the timer has passed the spawn rate
if (timer >= spawnRate)
{
// Instantiate the block at the current position and rotation
Instantiate(block, [Link], [Link]);
// Reset the timer after instantiating the block
timer = 0f;
}
}
}
[Link] 2/2