Skip to content

Instantly share code, notes, and snippets.

@ryan-linehan
Created November 30, 2019 20:48
Show Gist options
  • Save ryan-linehan/d517e8909d9dc83c9800d300cc356b11 to your computer and use it in GitHub Desktop.
Save ryan-linehan/d517e8909d9dc83c9800d300cc356b11 to your computer and use it in GitHub Desktop.
using Godot;
using System;
using SuperBrickBreaker.GameEnumerations;
public class Brick : RigidBody2D
{
// Declare member variables here. Examples:
// private int a = 2;
// private string b = "text";
// Called when the node enters the scene tree for the first time.
AnimatedSprite sprite;
Random rand;
BrickColor[] colors = { BrickColor.blue, BrickColor.brown, BrickColor.darkgreen, BrickColor.green, BrickColor.grey,
BrickColor.lightblue, BrickColor.orange, BrickColor.yellow, BrickColor.red, BrickColor.purple };
public override void _Ready()
{
rand = new Random();
sprite = GetNode<AnimatedSprite>("AnimatedSprite");
sprite.SetAnimation(rand.Next(0, colors.Length).ToString());
}
// // Called every frame. 'delta' is the elapsed time since the previous frame.
// public override void _Process(float delta)
// {
//
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment