Move entityclass::setblockcolour() to blockclass::setblockcolour()

This moves the function setblockcolour(), so I can directly call it on a
particular block without having to have it be inside obj.blocks.
This commit is contained in:
Misa
2020-04-03 15:26:19 -07:00
committed by Ethan Lee
parent 2cb90afbda
commit 7edbebac92
4 changed files with 103 additions and 103 deletions

View File

@@ -34,3 +34,68 @@ void blockclass::rectset(const int xi, const int yi, const int wi, const int hi)
rect.w = wi;
rect.h = hi;
}
void blockclass::setblockcolour( std::string col )
{
if (col == "cyan")
{
r = 164;
g = 164;
b = 255;
}
else if (col == "red")
{
r = 255;
g = 60;
b = 60;
}
else if (col == "green")
{
r = 144;
g = 255;
b = 144;
}
else if (col == "yellow")
{
r = 255;
g = 255;
b = 134;
}
else if (col == "blue")
{
r = 95;
g = 95;
b = 255;
}
else if (col == "purple")
{
r = 255;
g = 134;
b = 255;
}
else if (col == "white")
{
r = 244;
g = 244;
b = 244;
}
else if (col == "gray")
{
r = 174;
g = 174;
b = 174;
}
else if (col == "orange")
{
r = 255;
g = 130;
b = 20;
}
else
{
//use a gray
r = 174;
g = 174;
b = 174;
}
}