Created
November 30, 2019 20:49
-
-
Save ryan-linehan/81d125719f6504657a609e170aea0631 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Godot; | |
using System; | |
using 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) | |
// { | |
// | |
// } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace GameEnumerations | |
{ | |
public enum BrickColor | |
{ | |
blue = 1, | |
bluecracked = 2, | |
brown = 3, | |
browncracked = 4, | |
darkgreen = 5, | |
darkgreencracked = 6, | |
green = 7, | |
greencracked = 8, | |
grey = 9, | |
greycracked = 10, | |
lightblue = 11, | |
lightbluecracked = 12, | |
orange = 13, | |
orangecracked = 14, | |
purple = 15, | |
purplecracked = 16, | |
red = 17, | |
redcracked = 18, | |
yellow = 19, | |
yellowcracked = 20 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment