1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-26 06:28:30 +02:00

Add entityclass::moveblockto()

This function will restore a block's hitbox after it has been disabled
by `entityclass::nocollisionat()`.
This commit is contained in:
Misa 2020-10-09 17:04:03 -07:00 committed by Ethan Lee
parent d8cee4866e
commit c83132f4fa
2 changed files with 20 additions and 0 deletions

View File

@ -1081,6 +1081,24 @@ void entityclass::removeblockat( int x, int y )
}
}
void entityclass::moveblockto(int x1, int y1, int x2, int y2, int w, int h)
{
for (size_t i = 0; i < blocks.size(); i++)
{
if (blocks[i].xp == x1 && blocks[i].yp == y1)
{
blocks[i].xp = x2;
blocks[i].yp = y2;
blocks[i].wp = w;
blocks[i].hp = h;
blocks[i].rectset(blocks[i].xp, blocks[i].yp, blocks[i].wp, blocks[i].hp);
break;
}
}
}
void entityclass::nocollisionat(int x, int y)
{
for (size_t i = 0; i < blocks.size(); i++)

View File

@ -79,6 +79,8 @@ public:
void removeblockat(int x, int y);
void moveblockto(int x1, int y1, int x2, int y2, int w, int h);
void nocollisionat(int x, int y);
void removetrigger(int t);