Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class BreakableBlock : MonoBehaviour
- {
- int blockLives = 3;
- //public Sprite blockStateB;
- //public Sprite blockStateC;
- // Start is called before the first frame update
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- if(blockLives == 2)
- {
- //GetComponent(SpriteRenderer).sprite
- }
- if (blockLives == 1)
- {
- //GetComponent(SpriteRenderer).sprite
- }
- if (blockLives == 0)
- {
- Destroy(gameObject);
- }
- }
- private void OnCollisionEnter2D(Collision2D collision)
- {
- blockLives = blockLives - 1;
- }
- }
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class MovementStart : MonoBehaviour
- {
- public Vector3 startBoost = new Vector3(0.0f, 0.0f, 0.0f);
- bool notMoving = true;
- int ballLives = 3;
- // Start is called before the first frame update
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- if (notMoving == true)
- {
- GetComponent<Rigidbody2D>().AddForce(startBoost, ForceMode2D.Impulse);
- notMoving = false;
- }
- if (transform.position.y <= 0)
- {
- ballLives = ballLives - 1;
- transform.position = new Vector3 (9.16f, 7.57f, 0);
- GetComponent<Rigidbody2D>().velocity = Vector3.zero;
- notMoving = true;
- }
- if (ballLives == 0)
- {
- //find a way to load the game over scene;
- //SceneLoader.LoadGameOverScene();
- }
- }
- }
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class PaddleMovement : MonoBehaviour
- {
- float paddleSpeed = 7.0f;
- // Start is called before the first frame update
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- if (Input.GetKey(KeyCode.RightArrow))
- {
- transform.Translate(Vector3.right * Time.deltaTime * paddleSpeed);
- }
- if (Input.GetKey(KeyCode.LeftArrow))
- {
- transform.Translate(Vector3.left * Time.deltaTime * paddleSpeed);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement