mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01: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:
parent
d8cee4866e
commit
c83132f4fa
2 changed files with 20 additions and 0 deletions
|
@ -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++)
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue